scala-ide / scala-search

Next Scala Search Engine
6 stars 10 forks source link

Race condition in importers #39

Closed dragos closed 11 years ago

dragos commented 11 years ago
java.lang.AssertionError: assertion failed: Race condition detected: You are running a presentation compiler method outside the PC thread.[phase: <no phase>] Please file a ticket with the current stack trace at https://www.assembla.com/spaces/scala-ide/support/tickets
    at scala.tools.nsc.interactive.Global.assertCorrectThread(Global.scala:452)
    at scala.reflect.internal.Symbols$Symbol.rawInfo(Symbols.scala:1298)
    at scala.reflect.internal.Symbols$Symbol.info(Symbols.scala:1239)
    at scala.reflect.internal.Importers$StandardImporter.importOrRelink$1(Importers.scala:140)
    at scala.reflect.internal.Importers$StandardImporter.importSymbol(Importers.scala:202)
    at scala.reflect.internal.Importers$StandardImporter.importOrRelink$1(Importers.scala:148)
    at scala.reflect.internal.Importers$StandardImporter.importSymbol(Importers.scala:202)
    at scala.reflect.internal.Importers$StandardImporter.importOrRelink$1(Importers.scala:148)
    at scala.reflect.internal.Importers$StandardImporter.importSymbol(Importers.scala:202)
    at scala.reflect.internal.Importers$StandardImporter.importOrRelink$1(Importers.scala:148)
    at scala.reflect.internal.Importers$StandardImporter.importSymbol(Importers.scala:202)
    at scala.reflect.internal.Importers$StandardImporter.importSymbol(Importers.scala:27)
    at org.scala.tools.eclipse.search.searching.SearchPresentationCompiler.org$scala$tools$eclipse$search$searching$SearchPresentationCompiler$$importSymbol(SearchPresentationCompiler.scala:133)
    at org.scala.tools.eclipse.search.searching.SearchPresentationCompiler$$anonfun$comparator$1$$anon$1$$anonfun$isSameAs$1$$anonfun$apply$4.apply(SearchPresentationCompiler.scala:78)
    at org.scala.tools.eclipse.search.searching.SearchPresentationCompiler$$anonfun$comparator$1$$anon$1$$anonfun$isSameAs$1$$anonfun$apply$4.apply(SearchPresentationCompiler.scala:77)
    at scala.tools.nsc.util.InterruptReq.execute(InterruptReq.scala:26)
    at scala.tools.nsc.interactive.Global.pollForWork(Global.scala:339)
    at scala.tools.nsc.interactive.PresentationCompilerThread.run(PresentationCompilerThread.scala:22)
mads-hartmann commented 11 years ago

I don't understand this, because my call to the importers is already wrapped in an askOption https://github.com/mads379/scala-search/blob/1001686-integrate-with-eclipse/org.scala.tools.eclipse.search/src/org/scala/tools/eclipse/search/searching/SearchPresentationCompiler.scala#L77

dragos commented 11 years ago

I just had this one, with the latest nightly (June 7):

java.lang.AssertionError: assertion failed: Race condition detected: You are running a presentation compiler method outside the PC thread.[phase: <no phase>] Please file a ticket with the current stack trace at https://www.assembla.com/spaces/scala-ide/support/tickets
    at scala.tools.nsc.interactive.Global.assertCorrectThread(Global.scala:452)
    at scala.reflect.internal.Symbols$Symbol.rawInfo(Symbols.scala:1298)
    at scala.reflect.internal.Symbols$Symbol.isCoDefinedWith(Symbols.scala:1931)
    at scala.reflect.internal.Symbols$ClassSymbol$$anonfun$companionModule0$1.apply(Symbols.scala:2980)
    at scala.reflect.internal.Symbols$ClassSymbol$$anonfun$companionModule0$1.apply(Symbols.scala:2980)
    at scala.reflect.internal.Symbols$Symbol.filter(Symbols.scala:1664)
    at scala.reflect.internal.Symbols$Symbol.suchThat(Symbols.scala:1668)
    at scala.reflect.internal.Symbols$ClassSymbol.companionModule0(Symbols.scala:2979)
    at scala.reflect.internal.Symbols$ClassSymbol.companionModule(Symbols.scala:2982)
    at scala.reflect.internal.Symbols$PackageClassSymbol.sourceModule(Symbols.scala:3130)
    at scala.reflect.internal.Importers$StandardImporter.importOrRelink$1(Importers.scala:152)
    at scala.reflect.internal.Importers$StandardImporter.importSymbol(Importers.scala:202)
    at scala.reflect.internal.Importers$StandardImporter.importOrRelink$1(Importers.scala:148)
    at scala.reflect.internal.Importers$StandardImporter.importSymbol(Importers.scala:202)
    at scala.reflect.internal.Importers$StandardImporter.importOrRelink$1(Importers.scala:148)
    at scala.reflect.internal.Importers$StandardImporter.importSymbol(Importers.scala:202)
    at scala.reflect.internal.Importers$StandardImporter.importOrRelink$1(Importers.scala:148)
    at scala.reflect.internal.Importers$StandardImporter.importSymbol(Importers.scala:202)
    at scala.reflect.internal.Importers$StandardImporter.importOrRelink$1(Importers.scala:148)
    at scala.reflect.internal.Importers$StandardImporter.importSymbol(Importers.scala:202)
    at scala.reflect.internal.Importers$StandardImporter.importSymbol(Importers.scala:27)
    at org.scala.tools.eclipse.search.searching.SearchPresentationCompiler$$anonfun$org$scala$tools$eclipse$search$searching$SearchPresentationCompiler$$importSymbol$4.apply(SearchPresentationCompiler.scala:296)
    at org.scala.tools.eclipse.search.searching.SearchPresentationCompiler$$anonfun$org$scala$tools$eclipse$search$searching$SearchPresentationCompiler$$importSymbol$4.apply(SearchPresentationCompiler.scala:295)
    at scala.tools.nsc.util.InterruptReq.execute(InterruptReq.scala:26)
    at scala.tools.nsc.interactive.Global.pollForWork(Global.scala:339)
    at scala.tools.nsc.interactive.PresentationCompilerThread.run(PresentationCompilerThread.scala:22)
mads-hartmann commented 11 years ago

Oh damn, really hoped we had solved that one. Do you remember what kind of symbol you were searching for?

From the docs:

/** In the current universe, locates or creates a symbol that corresponds to the provided symbol in the source universe.
 *  If necessary imports the owner chain, companions, type signature, annotations and attachments.
 */

Currently we only initialise the symbol and all the symbols in the owner chain, i.e. we don't do anything with the companion objects, type signature, annotations and attachments. Should we just go "all in" and load everything?

dotta commented 11 years ago

@mads379 Could you move this ticket as well

dotta commented 11 years ago

Please, follow updates on this issue here. I'm closing this ticket.