Compile hangs on "Searching for compilable files..."


#1

It used to be that when I compiled my Kotlin project, it would say "Searching for compilable files..." for maybe 10-15 seconds. That was annoying, but now after upgrading to beta 1.0.0 plugin, it stays forever. I can't compile anything with Kotlin files. If I create a blank Java or Kotlin project - add one Kotlin file and try to compile, it hangs forever.

No one else is complaining about this so I’m guessing it’s something weird about my system. Any ideas on how to diagnose?  I can’t even cancel it. I click the red X and then it says “Stopping - Searching for compilable files…” forever.

IntelliJ 14.1.5, Kotlin 1.0.0 beta plugin, Mac OS X 10.11.1

Rob


IntelliJ - "Searching for Compilable Files" when running/building Kotlin files
#2

I wiped out some of the IntelliJ folders in ~/Library (Preferences, Application Support) and reinstalled the kotlin plugin. Now it hangs saying "Make" instead of "Searching for compilable files". I still can't compile anything with .kt files.

Rob


#3

Could you, please, share relevant idea and build log files. You may find their location upon clicking Help->Show Log in Finder.


#4

Here are some logs from IDEA 15 EAP. (I downloaded that to see if it was different that IDEA 14. I get the same error. I'll post some logs from IDEA 14 too if I see anything different.)

I hit F9 for “Make Project”, and then it hangs.

In idea.log:
2015-10-23 03:49:40,891 [23210601]   INFO - ij.compiler.impl.CompileDriver - COMPILATION STARTED (BUILD PROCESS)
2015-10-23 03:49:41,389 [23211099]   INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stdout]: Build process started. Classpath: /Applications/IntelliJ IDEA 15 EAP.app/Contents/lib/jps-launcher.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/lib/tools.jar:/Applications/IntelliJ IDEA 15 EAP.app/Contents/lib/optimizedFileManager.jar:/Applications/IntelliJ IDEA 15 EAP.app/Contents/lib/ecj-4.4.jar

In build-log/build.log:
2015-10-23 03:49:41,390 [   0]   INFO - etbrains.jps.cmdline.BuildMain - Build process started. Classpath: /Applications/IntelliJ IDEA 15 EAP.app/Contents/lib/jps-launcher.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/lib/tools.jar:/Applications/IntelliJ IDEA 15 EAP.app/Contents/lib/optimizedFileManager.jar:/Applications/IntelliJ IDEA 15 EAP.app/Contents/lib/ecj-4.4.jar
2015-10-23 03:49:41,923 [   533]   INFO - etbrains.jps.cmdline.BuildMain - Connection to IDE established in 483 ms
2015-10-23 03:49:42,073 [   683]   INFO - jps.cmdline.JpsModelLoaderImpl - Loading model: project path = /Users/rob/Workspace/TestKotlin4, global options path = /Users/rob/Library/Preferences/IntelliJIdea15/options
2015-10-23 03:49:42,492 [   1102]   INFO - jps.cmdline.JpsModelLoaderImpl - Model loaded in 419 ms
2015-10-23 03:49:42,492 [   1102]   INFO - jps.cmdline.JpsModelLoaderImpl - Project has 1 modules, 1 libraries
2015-10-23 03:49:42,577 [   1187]   INFO - ellij.util.io.PagedFileStorage - lower=100; upper=200; buffer=10; max=631767040
2015-10-23 03:49:42,796 [   1406]   INFO - .incremental.IncProjectBuilder - Building project; isRebuild:false; isMake:true parallel compilation:false
2015-10-23 03:49:43,010 [   1620]   INFO - kotlin.jps.build.KotlinBuilder - is Kotlin incremental compilation enabled: true
2015-10-23 03:49:43,011 [   1621]   INFO - kotlin.jps.build.KotlinBuilder - Label in local history: build started ff04a9ab
2015-10-23 03:49:43,037 [   1647]   INFO - r.api.ClassFilesIndicesBuilder - class files data index disabled


#5

Here's a log from IDEA 14. I included some messages and a stack trace that appear when I quit the application (the build process is still running so it kills it).

In Logs/IntelliJIdea14/idea.log:
2015-10-23 04:02:06,088 [ 205148]   INFO - ij.compiler.impl.CompileDriver - COMPILATION STARTED (BUILD PROCESS)
2015-10-23 04:02:06,856 [ 205916]   INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stdout]: Build process started. Classpath: /Applications/IntelliJ IDEA 14.app/Contents/lib/jps-launcher.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/lib/tools.jar:/Applications/IntelliJ IDEA 14.app/Contents/lib/optimizedFileManager.jar:/Applications/IntelliJ IDEA 14.app/Contents/lib/ecj-4.4.jar
  [ Now, I’m quitting the IDE. ]
2015-10-23 04:03:58,401 [ 317461]   INFO - org.jetbrains.io.BuiltInServer - web server stopped
2015-10-23 04:03:58,402 [ 317462]   INFO - Types.impl.FileTypeManagerImpl - FileTypeManager: 171 auto-detected files
Elapsed time on auto-detect: 114 ms
2015-10-23 04:03:58,410 [ 317470]   INFO - il.indexing.FileBasedIndexImpl - START INDEX SHUTDOWN
2015-10-23 04:03:58,410 [ 317470]  ERROR - j.compiler.server.BuildManager - Already disposed
java.lang.AssertionError: Already disposed
at com.intellij.openapi.components.impl.ComponentManagerImpl.getMessageBus(ComponentManagerImpl.java:96)
at com.intellij.compiler.server.BuildManager$NotifyingMessageHandler.sessionTerminated(BuildManager.java:1276)
at com.intellij.compiler.server.DelegatingMessageHandler.sessionTerminated(DelegatingMessageHandler.java:33)
at com.intellij.compiler.server.BuildMessageDispatcher$1.sessionTerminated(BuildMessageDispatcher.java:59)
at com.intellij.compiler.server.BuildMessageDispatcher.channelInactive(BuildMessageDispatcher.java:207)
at io.netty.channel.ChannelHandlerInvokerUtil.invokeChannelInactiveNow(ChannelHandlerInvokerUtil.java:56)
at io.netty.channel.DefaultChannelHandlerInvoker.invokeChannelInactive(DefaultChannelHandlerInvoker.java:92)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.java:164)
at io.netty.channel.ChannelInboundHandlerAdapter.channelInactive(ChannelInboundHandlerAdapter.java:75)
at io.netty.channel.ChannelHandlerInvokerUtil.invokeChannelInactiveNow(ChannelHandlerInvokerUtil.java:56)
at io.netty.channel.DefaultChannelHandlerInvoker.invokeChannelInactive(DefaultChannelHandlerInvoker.java:92)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.java:164)
at io.netty.handler.codec.ByteToMessageDecoder.channelInactive(ByteToMessageDecoder.java:294)
at io.netty.channel.ChannelHandlerInvokerUtil.invokeChannelInactiveNow(ChannelHandlerInvokerUtil.java:56)
at io.netty.channel.DefaultChannelHandlerInvoker.invokeChannelInactive(DefaultChannelHandlerInvoker.java:92)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.java:164)
at io.netty.channel.ChannelInboundHandlerAdapter.channelInactive(ChannelInboundHandlerAdapter.java:75)
at io.netty.channel.ChannelHandlerInvokerUtil.invokeChannelInactiveNow(ChannelHandlerInvokerUtil.java:56)
at io.netty.channel.DefaultChannelHandlerInvoker.invokeChannelInactive(DefaultChannelHandlerInvoker.java:92)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.java:164)
at io.netty.channel.DefaultChannelPipeline.fireChannelInactive(DefaultChannelPipeline.java:929)
at io.netty.channel.AbstractChannel$AbstractUnsafe$7.run(AbstractChannel.java:647)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:343)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:356)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:834)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
at org.jetbrains.ide.PooledThreadExecutor$1$1.run(PooledThreadExecutor.java:56)
2015-10-23 04:03:58,416 [ 317476]  ERROR - j.compiler.server.BuildManager - IntelliJ IDEA 14.1.5  Build #IU-141.2735.5
2015-10-23 04:03:58,416 [ 317476]  ERROR - j.compiler.server.BuildManager - JDK: 1.8.0_65
2015-10-23 04:03:58,416 [ 317476]  ERROR - j.compiler.server.BuildManager - VM: Java HotSpot™ 64-Bit Server VM
2015-10-23 04:03:58,417 [ 317477]  ERROR - j.compiler.server.BuildManager - Vendor: Oracle Corporation
2015-10-23 04:03:58,417 [ 317477]  ERROR - j.compiler.server.BuildManager - OS: Mac OS X
2015-10-23 04:03:58,417 [ 317477]  ERROR - j.compiler.server.BuildManager - Last Action: Exit
2015-10-23 04:03:58,467 [ 317527]   INFO - il.indexing.FileBasedIndexImpl - END INDEX SHUTDOWN
2015-10-23 04:03:58,467 [ 317527]   INFO - stubs.SerializationManagerImpl - START StubSerializationManager SHUTDOWN
2015-10-23 04:03:58,468 [ 317528]   INFO - stubs.SerializationManagerImpl - END StubSerializationManager SHUTDOWN


#6

Do logs end here? Usually there are more diagnostics below.

And could you please, try it without

  • daemon - Preferences->Build, Execution, Deployment->Compiler->Kotlin Compiler->Keep compiler process alive between invocations
  • parallel compilation - Preferences->Build, Execution, Deployment->Compiler->Compile Independent modules in Parallel
  • incremental compilation - same page as above->Rebuild module on dependency change

and if it helps - please try to find, which option exactly causes the problems.


#7

ilya.chernikov wrote:

Do logs end here? Usually there are more diagnostics below.

And could you please, try it without

  • daemon - Preferences->Build, Execution, Deployment->Compiler->Kotlin Compiler->Keep compiler process alive between invocations
  • parallel compilation - Preferences->Build, Execution, Deployment->Compiler->Compile Independent modules in Parallel
  • incremental compilation - same page as above->Rebuild module on dependency change

and if it helps - please try to find, which option exactly causes the problems.


The first one - unchecking “Keep compiler process alive…” causes it to work again.  Turning it back on causes it to hang again.

And yes, I included the log up until the end of the log file.

At least I can compile things again, so the real pain is over. Thank you!

Thoughts on possible causes…  Unlike most people, when I upgraded to El Capitan, I did a hard drive wipe and reinstall. Other than that I can’t think of anything odd about my computer. I had disk utility check the hard drive - it didn’t find anything.  I’ve noticed that the new OS X changed some permissions that messed with other programs.  For example, an ACL prevented psql (postgres console) from saving its file to my home directory (error: could not save history to file “/Users/rob/.psql_history”: Permission denied).

Rob


#8

I'm glad that it helps, but please, bear with us, I need to diagnose it a bit further. :)

I’d appreciate very much if you’ll check the following:

  1. check if daemon process is actually running after you’re starting the build, e.g. using: ps ax | grep kotlin-compiler | grep -v grep
  2. daemon creates a log file within “java.io.tmpdir”. On osx I usually look at it using: find /var/folders/xp -name “kotlin-daemon.2015*.log” | tail -1 | xargs less
  3. please check if there is an accessible directory “.kotlin-daemon” in the home dir (if not - it will be similar to your case with psql)

#9

ilya.chernikov wrote:

I’m glad that it helps, but please, bear with us, I need to diagnose it a bit further. :slight_smile:

I’d appreciate very much if you’ll check the following:

  1. check if daemon process is actually running after you’re starting the build, e.g. using: ps ax | grep kotlin-compiler | grep -v grep
  2. daemon creates a log file within “java.io.tmpdir”. On osx I usually look at it using: find /var/folders/xp -name “kotlin-daemon.2015*.log” | tail -1 | xargs less
  3. please check if there is an accessible directory “.kotlin-daemon” in the home dir (if not - it will be similar to your case with psql)

  • I see a process called “compile-server”, but nothing matches “kotlin-compiler”.
  • There is nothing under /var/folders with “kotlin” in the name.
  • There is no ~/.kotlin-daemon.  Maybe I can manually create it?
  • I need to run but will be back online in ~1.5 hours.

    Rob


    #10

    compile-server is a different process, but the one that supposed to execute daemon. Could you send me a stack dump of it in the moment then compilation hangs, via jstack -l?


    #11

    I attached it as a text file. I see some lock related stack traces.

    Rob



    stack1.txt.zip (2.29 KB)

    #12

    That looks like it, thank you very much. I'll try to craft a fix soon, and will inform you here. Meanwhile, as you already discovered, switching off the daemon should help.


    #13

    Robert, in the oficial kotlin beta, you don't need to disable daemon anymore, If it detects problems with access to the files, it should now fall back to non-daemon compilation automatically. In the next beta it will use other location for the runtime files, so hopefully the problem will not surface anymore at all. Thank you once again for your help.


    #14

    hi ilya.chernikov, I have the same pain with my Intellij UTIMATE 2017.3

    My project is Spring MVC maven project and front end uses nodejs. Each time after I compile my nodejs source and begin to run the whole project, it will hang at “Searching for compilable files…”

    I have tryed those three suggestions you give, but it still not work. Could you help me to analyze this problem?

    This is the idea logs: idea.log.zip (50.8 KB)