Scala Programming Language
  1. Scala Programming Language
  2. SI-8135

Race condition in presentation compiler `askTypeAt`

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: Scala 2.11.0-M8
    • Fix Version/s: None
    • Labels:
      None

      Description

      As this PR demonstrates, there is a race condition when `askTypeAt(pos)` is called on implicitly[Foo[A]].foo where pos is matches the end point of the former expression. The issue is that the returned Tree is unattributed, which is why the error No symbol is associated with tree implicitly[Foo[A]].foo is reported.

      I'm going to move the spuriously failing test in pending, but would be good to look at it at some point.

        Issue Links

          Activity

          Hide
          Mirco Dotta added a comment -

          PR for disabling the test https://github.com/scala/scala/pull/3349

          Show
          Mirco Dotta added a comment - PR for disabling the test https://github.com/scala/scala/pull/3349
          Hide
          Jason Zaugg added a comment -

          I can reproduce it locally by making a bunch of copies of the test and letting partest have at them:

           % for i in {1..20}; do cp -R test/files/presentation/context-bounds1 test/files/presentation/context-bounds1_$i; cp test/files/presentation/context-bounds1.check test/files/presentation/context-bounds1_$i.check; done
          % ./test/partest test/files/presentation/context-bounds1_*
          
          # starting 20 tests in presentation
          ok  1 - presentation/context-bounds1_12
          ok  2 - presentation/context-bounds1_14
          ok  3 - presentation/context-bounds1_13
          ok  4 - presentation/context-bounds1_15
          ok  5 - presentation/context-bounds1_16
          ok  6 - presentation/context-bounds1_1
          ok  7 - presentation/context-bounds1_11
          ok  8 - presentation/context-bounds1_10
          ok  9 - presentation/context-bounds1_2
          ok 10 - presentation/context-bounds1_4
          !! 11 - presentation/context-bounds1_20           [output differs]
          ok 12 - presentation/context-bounds1_5
          ok 13 - presentation/context-bounds1_17
          ok 14 - presentation/context-bounds1_18
          ok 15 - presentation/context-bounds1_19
          ok 16 - presentation/context-bounds1_3
          ok 17 - presentation/context-bounds1_6
          ok 18 - presentation/context-bounds1_7
          ok 19 - presentation/context-bounds1_8
          ok 20 - presentation/context-bounds1_9
          # 19/20 passed, 1 failed in presentation
          
          % cat /Users/jason/code/scala/test/files/presentation/context-bounds1_20-presentation.log | tail
          ================================================================================
          [response] found askHyperlinkPos for `A` at (4,12) ContextBounds.scala
          ================================================================================
          
          No symbol is associated with tree: implicitly[Foo[A]].foo
          
          askHyperlinkPos for `A` at (10,14) ContextBounds.scala
          ================================================================================
          [response] found askHyperlinkPos for `A` at (9,11) ContextBounds.scala
          ================================================================================
          
          Show
          Jason Zaugg added a comment - I can reproduce it locally by making a bunch of copies of the test and letting partest have at them: % for i in {1..20}; do cp -R test/files/presentation/context-bounds1 test/files/presentation/context-bounds1_$i; cp test/files/presentation/context-bounds1.check test/files/presentation/context-bounds1_$i.check; done % ./test/partest test/files/presentation/context-bounds1_* # starting 20 tests in presentation ok 1 - presentation/context-bounds1_12 ok 2 - presentation/context-bounds1_14 ok 3 - presentation/context-bounds1_13 ok 4 - presentation/context-bounds1_15 ok 5 - presentation/context-bounds1_16 ok 6 - presentation/context-bounds1_1 ok 7 - presentation/context-bounds1_11 ok 8 - presentation/context-bounds1_10 ok 9 - presentation/context-bounds1_2 ok 10 - presentation/context-bounds1_4 !! 11 - presentation/context-bounds1_20 [output differs] ok 12 - presentation/context-bounds1_5 ok 13 - presentation/context-bounds1_17 ok 14 - presentation/context-bounds1_18 ok 15 - presentation/context-bounds1_19 ok 16 - presentation/context-bounds1_3 ok 17 - presentation/context-bounds1_6 ok 18 - presentation/context-bounds1_7 ok 19 - presentation/context-bounds1_8 ok 20 - presentation/context-bounds1_9 # 19/20 passed, 1 failed in presentation % cat /Users/jason/code/scala/test/files/presentation/context-bounds1_20-presentation.log | tail ================================================================================ [response] found askHyperlinkPos for `A` at (4,12) ContextBounds.scala ================================================================================ No symbol is associated with tree: implicitly[Foo[A]].foo askHyperlinkPos for `A` at (10,14) ContextBounds.scala ================================================================================ [response] found askHyperlinkPos for `A` at (9,11) ContextBounds.scala ================================================================================
          Hide
          Jason Zaugg added a comment -

          When it works, we see this tree as found by `interactive.Global#signalDone`

          scala.this.Predef.implicitly[Foo[A]](evidence$7).foo
          

          When it fails, we see:

          implicitly[Foo[A]].foo(x$7)
          

          Find the "x$7", and we'll be close the the culprit. Hopefully this will just entail a refinement of the fix for SI-7558.

          Show
          Jason Zaugg added a comment - When it works, we see this tree as found by `interactive.Global#signalDone` scala.this.Predef.implicitly[Foo[A]](evidence$7).foo When it fails, we see: implicitly[Foo[A]].foo(x$7) Find the "x$7", and we'll be close the the culprit. Hopefully this will just entail a refinement of the fix for SI-7558 .
          Hide
          Jason Zaugg added a comment -

          Trying to capture some logging: https://gist.github.com/retronym/8351926

          Show
          Jason Zaugg added a comment - Trying to capture some logging: https://gist.github.com/retronym/8351926

            People

            • Assignee:
              Unassigned
              Reporter:
              Mirco Dotta
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:

                Development