HaxeFoundation / intellij-haxe

Haxe plugin for IntelliJ Platform based IDEs (IDEA, Android-Studio)
http://intellij-haxe.org
Apache License 2.0
219 stars 100 forks source link

IntelliJ corrupted upon next start after installing Haxe plugin #580

Open jasonsturges opened 7 years ago

jasonsturges commented 7 years ago

Strange issue that is consistently repeatable, my IntelliJ IDEA works great after initial installation of the Haxe plugin - everything from code completions to debugging work perfectly.

I've made a YouTube video demonstrating setup of the development environment with debugging: https://youtu.be/kvFg1Zee4h4

However, after exiting IntelliJ IDEA, upon the next start the app is corrupted, appearing as below:

image

First, note the menu has been moved from Mac's menu bar to PC-style inside the IDE:

image

It also gives the error:

External file changes sync may be slow: Native file watcher executable not found

As well, functionality is broken - for example, the debugger never attaches.

I must reset and reinstall IntelliJ for it to go back to normal, removing the following folders and completely re-installing the application:

Afterwards, it's perfectly fine again. If I re-install Haxe Support plugin it works perfectly for that session, until I exit and launch IntelliJ, in which this cycle repeats.

image

Has this plugin received testing on Mac?

IntelliJ IDEA 2016.3.4 Build #IU-163.12024.16, built on January 31, 2017 JRE: 1.8.0_112-release-408-b6 x86_64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o Mac OS X 10.11.6 OS X El Capitan

EricBishton commented 7 years ago

(Hi @jasonsturges, long time no see! )

What version of the plugin are you using?

This is the first report of the issue. I do have a mac, but must confess that I don't test against it regularly or use it much for development. (My primary environment is Linux.) I know that a few of the regular contributors (EliasKu and his cohorts over at Playtika) use a mac as their primary environment.

If you are continuing on using IDEA, can you capture the pre- and post-error conditions of the directories you mention above and post the differences? (gist.github.com or pastebin.com is fine, or you can attach a file below.)

As for the menus changing position, that's a weird one for me. IDEA must not be able to determine that it's running on a mac, and thus it's not using the OSX system calls. Here is a discussion from somebody else with that problem: https://intellij-support.jetbrains.com/hc/en-us/community/posts/206805955-Opened-a-windows-idea-project-on-mac-and-now-my-menubar-is-part-of-the-editor-window- That talks about Info.plist being corrupted. A reinstall worked for him, while it only works temporarily for you.

Have you tried installing IDEA without the plugin, opening the project, closing down IDEA and then re-opening it again? Not that it's useful to your workflow, but might help isolate the problem.

jasonsturges commented 7 years ago

@EricBishton, Hi, good to be back with Haxe.

Haxe Support plugin is Version: 0.10.1.1 for IDEA 2016.1 through 2016.3.

Infinitely reopening Haxe projects without the plugin is not a problem.

The problem happens somewhere in the Haxe dialogs - setting up the SDK and Debug. If I simply install the plugin, then exit / restart - no problem. The issue occurs somewhere when the plugin dialog windows are open. When I configure the projects / modules / libraries, then add a debug configuration is where something goes wrong.

Strangely, there's no difference in my Info.plist between a fresh install and after the issue occurs that moves the menu system within the window.

There's quite a lot of delta to parse, which I'll try to put into a gist.

After the error, in my ~/Library/Preferences a jdk.table.xml is created:

<application>
  <component name="ProjectJdkTable">
    <jdk version="2">
      <name value="Haxe 3.4.0" />

~/Library/Application Support is unchanged.

~/Library/Caches has wild delta, but nothing immediately stands out.

~/Library/Logs has significant error after the restart:

2017-03-23 13:04:53,055 [  83996]  ERROR - llij.ide.plugins.PluginManager - Sorry but parent: com.intellij.openapi.roots.impl.CompilerModuleExtensionImpl@369b7f60 has already been disposed (see the cause for stacktrace) so the child: com.intellij.openapi.vfs.impl.VirtualFilePointerManagerImpl$DelegatingDisposable@6e1dbdda will never be disposed 
com.intellij.util.IncorrectOperationException: Sorry but parent: com.intellij.openapi.roots.impl.CompilerModuleExtensionImpl@369b7f60 has already been disposed (see the cause for stacktrace) so the child: com.intellij.openapi.vfs.impl.VirtualFilePointerManagerImpl$DelegatingDisposable@6e1dbdda will never be disposed
    at com.intellij.openapi.util.objectTree.ObjectTree.register(ObjectTree.java:65)
    at com.intellij.openapi.util.Disposer.register(Disposer.java:92)
    at com.intellij.openapi.util.Disposer.register(Disposer.java:86)
    at com.intellij.openapi.vfs.impl.VirtualFilePointerManagerImpl$DelegatingDisposable.a(VirtualFilePointerManagerImpl.java:562)
    at com.intellij.openapi.vfs.impl.VirtualFilePointerManagerImpl$DelegatingDisposable.access$000(VirtualFilePointerManagerImpl.java:547)
    at com.intellij.openapi.vfs.impl.VirtualFilePointerManagerImpl.a(VirtualFilePointerManagerImpl.java:214)
    at com.intellij.openapi.vfs.impl.VirtualFilePointerManagerImpl.create(VirtualFilePointerManagerImpl.java:143)
    at com.intellij.openapi.roots.impl.CompilerModuleExtensionImpl.a(CompilerModuleExtensionImpl.java:195)
    at com.intellij.openapi.roots.impl.CompilerModuleExtensionImpl.setCompilerOutputPath(CompilerModuleExtensionImpl.java:202)
    at com.intellij.plugins.haxe.ide.projectStructure.ui.HaxeConfigurationEditor.apply(HaxeConfigurationEditor.java:469)
    at com.intellij.plugins.haxe.ide.projectStructure.HaxeModuleConfigurationEditor.apply(HaxeModuleConfigurationEditor.java:72)
2017-03-23 13:07:59,052 [ 173468]  ERROR - llij.ide.plugins.PluginManager - null 
java.lang.AssertionError
    at com.intellij.plugins.haxe.ide.projectStructure.ui.HaxeConfigurationEditor$5.actionPerformed(HaxeConfigurationEditor.java:186)
2017-03-23 13:08:00,876 [ 175292]  ERROR - llij.ide.plugins.PluginManager - null 
java.lang.AssertionError
    at com.intellij.plugins.haxe.ide.projectStructure.ui.HaxeConfigurationEditor$5.actionPerformed(HaxeConfigurationEditor.java:186)
2017-03-23 13:08:01,044 [ 175460]  ERROR - llij.ide.plugins.PluginManager - null 
java.lang.AssertionError
    at com.intellij.plugins.haxe.ide.projectStructure.ui.HaxeConfigurationEditor$5.actionPerformed(HaxeConfigurationEditor.java:186)
2017-03-23 13:09:08,367 [ 242783]   WARN - n.process.BaseOSProcessHandler - Must specify non-empty 'commandLine' parameter 
java.lang.IllegalArgumentException: Must specify non-empty 'commandLine' parameter
    at com.intellij.execution.process.BaseOSProcessHandler.<init>(BaseOSProcessHandler.java:65)
    at com.intellij.execution.process.OSProcessHandler.<init>(OSProcessHandler.java:67)
    at com.intellij.execution.process.KillableProcessHandler.<init>(KillableProcessHandler.java:67)
    at com.intellij.execution.process.ColoredProcessHandler.<init>(ColoredProcessHandler.java:54)
    at com.intellij.plugins.haxe.util.HaxeCommonCompilerUtil.compile(HaxeCommonCompilerUtil.java:211)
    at com.intellij.plugins.haxe.compilation.HaxeCompiler.compileModule(HaxeCompiler.java:177)
    at com.intellij.plugins.haxe.compilation.HaxeCompiler.run(HaxeCompiler.java:140)
    at com.intellij.plugins.haxe.compilation.HaxeCompiler.process(HaxeCompiler.java:124)
    at com.intellij.plugins.haxe.compilation.HaxeCompilerTask.execute(HaxeCompilerTask.java:38)
jasonsturges commented 7 years ago

idea.log.txt jdk.table.xml.txt

EricBishton commented 7 years ago

I recognize that last IllegalArgumentException. That is similar to the HaxeCompilerCompletionContributor when it tries to start completion for OpenFL. (And is now fixed in the 0.10.1.Test.CompilerCompletion build.) In the contributor's case, it was because an empty argument was placed on the command line. In your case, I think the compile should fail, but the failure should be benign to IDEA. So, each target uses a different path to start the compiler. What target are you compiling for?

jasonsturges commented 7 years ago

Flash, with major intent behind this to use the debugger.

jasonsturges commented 7 years ago

This is the OpenFL Project XML bug - never works the first time:

2017-03-23 14:01:52,656 [ 123123]  ERROR - llij.ide.plugins.PluginManager - null 
java.lang.AssertionError
    at com.intellij.plugins.haxe.ide.projectStructure.ui.HaxeConfigurationEditor$5.actionPerformed(HaxeConfigurationEditor.java:186)

intellij-plugin

jasonsturges commented 7 years ago

Actually, what happens to my configuration must redirect my logs elsewhere.

After this error which transforms my IntelliJ to an oddly PC-esque configuration, my log files are no longer updated. Here, a tail follow of the logs isn't even updating.

intellij-plugin-2

So, I'm probably not retrieving anything helpful.

Inside OS X Console, I see:

3/23/17 2:13:47.792 PM idea[10948]: allVms required 1.8*,1.8+
3/23/17 2:13:47.795 PM idea[10948]: fullFileName is: /Applications/IntelliJ IDEA.app/Contents/bin/idea.vmoptions
3/23/17 2:13:47.795 PM idea[10948]: fullFileName exists: /Applications/IntelliJ IDEA.app/bin/idea.vmoptions
3/23/17 2:13:47.795 PM idea[10948]: Value of IDEA_VM_OPTIONS is (null)
3/23/17 2:13:47.795 PM idea[10948]: Processing VMOptions file at /Applications/IntelliJ IDEA.app/bin/idea.vmoptions
3/23/17 2:13:47.797 PM idea[10948]: No content found at /Applications/IntelliJ IDEA.app/bin/idea.vmoptions 
EricBishton commented 7 years ago

Could it be that IDEA is using the system JVM instead of the one it shipped with? (During the second run.)

If the class path is different for some reason, then IDEA may not be picking up log4j. Thus, no log output.

If debugging is your primary reason for using flash targets, the hxcpp targets might serve you better.

jasonsturges commented 7 years ago

Quite possible - Console reports it's looking for Contents/bin, but found bin; though, it's within the Contents folder:

jsturges:bin jsturges$ pwd
/Applications/IntelliJ IDEA.app/Contents/bin

Regardless of target, IDE is pretty thoroughly hosed after restart.

That's entirely possible, but strange this only happens with the IntelliJ plugin. My system is pretty vanilla, and I don't do Java development - everything is Apple default. Other IntelliJ plugins like NodeJS have worked fine.

Likewise identical results on a separate Mac, though also running the same El Capitan

EricBishton commented 7 years ago

I see the failure to open the project dialog in your logs. That's an issue inside of JetBrains' dialog manager (or swing, I guess). The NPE is coming while trying to construct the dialog. I'm not sure if that's something we can work around or not; it might be an option on the dialog or some data that we're not filling in.

EricBishton commented 7 years ago

Well, at least it's consistent on two machines. I'm willing to believe that the Haxe plugin is causing the issue. We just have to figure out why.

jasonsturges commented 7 years ago

Really appreciate your taking a look. At some point, I need to embrace running a dev environment of this plugin to help debugging.

Let me know if I can help provide any information. Otherwise, I'll keep in touch over time as I hone in on root cause. Thanks.

EricBishton commented 7 years ago

@jasonsturges Do you still have this issue? It may be that your "project output" directory on the "Haxe Compiler" page (even though you aren't using that) is set to $APPLICATION_DIR$. (I think that's the name.) I found that I was deleting (unopened) files in my IDEA main directory because that had been set incorrectly on a new project (still not sure why it that was set that way). There was another bug about this, too.

I think I'm going to add a check before compiling to halt if APPLICATION_DIR or USER_HOME are part of the path. (Though USER_HOME/someproject is fairly common and OK.)

jasonsturges commented 7 years ago

@EricBishton That makes sense. My haxe environment is behind the times, and I'm a little weary of dealing with IntelliJ issues given my current workload. Let me get back to you on this soon.

Thanks for the followup.

mayakwd commented 6 years ago

Any news?

EricBishton commented 5 years ago

Also, see #284, #342, and #641.