Closed jnpatrick99 closed 11 months ago
Thanks, I'll take a look!
When it starts using high CPU, does any AS3/MXML code intelligence (completion, hover, signature help, etc) work? Or does it stop working?
Thank you! Yeah, most of the time it keeps working. But two or three times I noticed it stopped with a lot of crash messages in the Output window. Didn't have time to copy them, just restarted VS Code and killed java
process.
If you do happen to see the crash messages again, please copy and paste them here. They might provide a clue!
Thank you! Is there another way to see what went wrong? I don't see any messages anymore in the output but I do constantly experience 300% CPU issue.
I'm assuming that a thread is getting stuck in an infinite loop somehow. There isn't a simple way to figure out what could be causing that, unfortunately.
On my computer, I left the task manager open all morning today while I worked on an AIR/Flex project, and I while the CPU usage often went up very high while I was actively typing on my keyboard or building the project, it always went back down to single digits when I was idle again. There may be something about your project that is different from mine, and I guess that we'll need to figure out what that is.
Thank you for the hints!
I have some JavaScript (.js) and TypeScript (.ts) files open alongside with the main ActionScript project. Also I noticed that "Initializing JS/TS language features" takes a bit longer when AS3 extension is activated.
Can it be the case?
Other languages shouldn't affect the as3/mxml extension. It explicitly ignores other file extensions.
I see, that's great.
Here are some of the errors I noticed in the Output window:
Error - 10:54:48 AM] Request textDocument/hover failed.
Error: Connection got disposed.
at Object.dispose (/Users/XXX/.vscode/extensions/bowlerhatllc.vscode-nextgenas-0.23.2/extension.js:1:13868)
at Object.dispose (/Users/XXX/.vscode/extensions/bowlerhatllc.vscode-nextgenas-0.23.2/extension.js:1:60555)
at t.LanguageClient.handleConnectionClosed (/Users/XXX/.vscode/extensions/bowlerhatllc.vscode-nextgenas-0.23.2/extension.js:1:60730)
at t.LanguageClient.handleConnectionClosed (/Users/XXX/.vscode/extensions/bowlerhatllc.vscode-nextgenas-0.23.2/extension.js:165:2091)
at t (/Users/XXX/.vscode/extensions/bowlerhatllc.vscode-nextgenas-0.23.2/extension.js:1:58931)
at invoke (/Users/XXX/.vscode/extensions/bowlerhatllc.vscode-nextgenas-0.23.2/extension.js:1:68038)
at r.fire (/Users/XXX/.vscode/extensions/bowlerhatllc.vscode-nextgenas-0.23.2/extension.js:1:68768)
at $ (/Users/XXX/.vscode/extensions/bowlerhatllc.vscode-nextgenas-0.23.2/extension.js:1:6054)
at invoke (/Users/XXX/.vscode/extensions/bowlerhatllc.vscode-nextgenas-0.23.2/extension.js:1:68038)
at r.fire (/Users/XXX/.vscode/extensions/bowlerhatllc.vscode-nextgenas-0.23.2/extension.js:1:68768)
at d.fireClose (/Users/XXX/.vscode/extensions/bowlerhatllc.vscode-nextgenas-0.23.2/extension.js:1:71008)
at Socket.readable.on (/Users/XXX/.vscode/extensions/bowlerhatllc.vscode-nextgenas-0.23.2/extension.js:1:71765)
at Socket.emit (events.js:187:15)
at Pipe._handle.close (net.js:606:12)
Nov 05, 2019 6:39:37 PM org.eclipse.lsp4j.jsonrpc.RemoteEndpoint handleCancellation
WARNING: Unmatched cancel notification for request id 228
Thank you!
Update: I also think this begins to happen after I Cmd+click on any method or class to go to its definition. Most of the time it just doesn't work, the progress goes into infinite loop and java process starts to eat CPU. And the definition would never open. Sometimes it does work though.
Also when I hover my mouse over methods with Cmd pressed the methods never get underlined. I'm using VS Code 1.39.2 by the way.
P.S. It wasn't like that with previous (~2-3 months old) versions of the extension.
I think it would be best if you could try to create a very simple project where this issue will reproduce consistently, and then upload it here. Basically, strip things down to the bare minimum (no extra classes or anything that that isn't required to make the issue happen).
It does indeed sound like it's getting stuck in an infinite loop with a project configured in a certain way, but until I can reproduce, it's basically impossible to fix.
It's very hard to make an isolated case. I will try! Here go some more error messages:
[Error - 7:11:49 PM] Request textDocument/codeAction failed.
Message: Internal error.
Code: -32603
java.util.concurrent.CompletionException: java.lang.NullPointerException
at java.util.concurrent.CompletableFuture.internalComplete(CompletableFuture.java:205)
at java.util.concurrent.CompletableFuture$AsyncApply.exec(CompletableFuture.java:507)
at java.util.concurrent.CompletableFuture$Async.run(CompletableFuture.java:428)
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)
Caused by: java.lang.NullPointerException
at com.as3mxml.vscode.utils.ASTUtils.getCompilationUnitAST(ASTUtils.java:70)
at com.as3mxml.vscode.providers.CodeActionProvider.codeAction(CodeActionProvider.java:119)
at com.as3mxml.vscode.ActionScriptServices.lambda$codeAction$9(ActionScriptServices.java:529)
at com.as3mxml.vscode.ActionScriptServices$$Lambda$17/1903717044.apply(Unknown Source)
at java.util.concurrent.CompletableFuture$AsyncApply.exec(CompletableFuture.java:501)
... 4 more
Nov 09, 2019 7:11:53 PM org.eclipse.lsp4j.jsonrpc.RemoteEndpoint handleNotification
WARNING: Notification threw an exception: {
"jsonrpc": "2.0",
"method": "textDocument/didChange",
"params": {
"textDocument": {
"version": 586,
"uri": "file:///XXX.mxml"
},
"contentChanges": [
{
"range": {
"start": {
"line": 4824,
"character": 20
},
"end": {
"line": 4824,
"character": 20
}
},
"rangeLength": 0,
"text": "."
},
{
"range": {
"start": {
"line": 4824,
"character": 21
},
"end": {
"line": 4824,
"character": 21
}
},
"rangeLength": 0,
"text": "s"
},
{
"range": {
"start": {
"line": 4824,
"character": 22
},
"end": {
"line": 4824,
"character": 22
}
},
"rangeLength": 0,
"text": "e"
},
{
"range": {
"start": {
"line": 4824,
"character": 23
},
"end": {
"line": 4824,
"character": 23
}
},
"rangeLength": 0,
"text": "t"
},
{
"range": {
"start": {
"line": 4824,
"character": 24
},
"end": {
"line": 4824,
"character": 24
}
},
"rangeLength": 0,
"text": "S"
},
{
"range": {
"start": {
"line": 4824,
"character": 25
},
"end": {
"line": 4824,
"character": 25
}
},
"rangeLength": 0,
"text": "t"
},
{
"range": {
"start": {
"line": 4824,
"character": 26
},
"end": {
"line": 4824,
"character": 26
}
},
"rangeLength": 0,
"text": "y"
},
{
"range": {
"start": {
"line": 4824,
"character": 27
},
"end": {
"line": 4824,
"character": 27
}
},
"rangeLength": 0,
"text": "l"
},
{
"range": {
"start": {
"line": 4824,
"character": 28
},
"end": {
"line": 4824,
"character": 28
}
},
"rangeLength": 0,
"text": "e"
}
]
}
}
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:67)
at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint$$Lambda$7/896681694.apply(Unknown Source)
at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.notify(GenericEndpoint.java:152)
at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleNotification(RemoteEndpoint.java:220)
at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:187)
at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:192)
at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94)
at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
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)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:65)
... 12 more
Caused by: java.lang.OutOfMemoryError: GC overhead limit exceeded
Nov 09, 2019 7:11:53 PM org.eclipse.lsp4j.jsonrpc.RemoteEndpoint handleCancellation
WARNING: Unmatched cancel notification for request id 1490
java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: GC overhead limit exceeded
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at org.apache.royale.compiler.internal.units.requests.RequestMaker$Request.get(RequestMaker.java:80)
at com.as3mxml.vscode.utils.ASTUtils.getCompilationUnitAST(ASTUtils.java:70)
at com.as3mxml.vscode.providers.CodeActionProvider.codeAction(CodeActionProvider.java:119)
at com.as3mxml.vscode.ActionScriptServices.lambda$codeAction$9(ActionScriptServices.java:529)
at com.as3mxml.vscode.ActionScriptServices$$Lambda$17/1903717044.apply(Unknown Source)
at java.util.concurrent.CompletableFuture$AsyncApply.exec(CompletableFuture.java:501)
at java.util.concurrent.CompletableFuture$Async.run(CompletableFuture.java:428)
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)
Caused by: java.lang.OutOfMemoryError: GC overhead limit exceeded
at org.apache.royale.compiler.internal.scopes.ASScopeCache.findPropertyQualified(ASScopeCache.java:280)
at org.apache.royale.compiler.internal.scopes.ASScope.findPropertyQualified(ASScope.java:1594)
at org.apache.royale.compiler.internal.definitions.references.ResolvedQualifiersReference.resolve(ResolvedQualifiersReference.java:80)
at org.apache.royale.compiler.internal.definitions.DefinitionBase.resolveType(DefinitionBase.java:1107)
at org.apache.royale.compiler.internal.definitions.DefinitionBase.resolveType(DefinitionBase.java:1147)
at org.apache.royale.compiler.internal.definitions.ClassDefinition.resolveBaseClass(ClassDefinition.java:374)
at org.apache.royale.compiler.internal.definitions.ClassDefinitionBase$ClassIterator.next(ClassDefinitionBase.java:605)
at org.apache.royale.compiler.internal.definitions.ClassDefinitionBase$ClassIterator.next(ClassDefinitionBase.java:571)
at org.apache.royale.compiler.internal.projects.RoyaleProject.resolveEffect(RoyaleProject.java:1441)
at org.apache.royale.compiler.internal.projects.RoyaleProject.resolveSpecifier(RoyaleProject.java:1300)
at org.apache.royale.compiler.internal.tree.mxml.MXMLClassReferenceNodeBase.createSpecifierNode(MXMLClassReferenceNodeBase.java:777)
at org.apache.royale.compiler.internal.tree.mxml.MXMLClassReferenceNodeBase.processTagSpecificAttribute(MXMLClassReferenceNodeBase.java:410)
at org.apache.royale.compiler.internal.tree.mxml.MXMLInstanceNode.processTagSpecificAttribute(MXMLInstanceNode.java:236)
at org.apache.royale.compiler.internal.tree.mxml.MXMLNodeBase.processAttribute(MXMLNodeBase.java:387)
at org.apache.royale.compiler.internal.tree.mxml.MXMLNodeBase.initializeFromTag(MXMLNodeBase.java:274)
at org.apache.royale.compiler.internal.tree.mxml.MXMLClassReferenceNodeBase.processChildTag(MXMLClassReferenceNodeBase.java:512)
at org.apache.royale.compiler.internal.tree.mxml.MXMLClassDefinitionNode.processChildTag(MXMLClassDefinitionNode.java:292)
at org.apache.royale.compiler.internal.tree.mxml.MXMLDocumentNode.processChildTag(MXMLDocumentNode.java:101)
at org.apache.royale.compiler.internal.tree.mxml.MXMLNodeBase.processContentUnit(MXMLNodeBase.java:522)
at org.apache.royale.compiler.internal.tree.mxml.MXMLNodeBase.initializeFromTag(MXMLNodeBase.java:280)
at org.apache.royale.compiler.internal.tree.mxml.MXMLFileNode.processRootTag(MXMLFileNode.java:272)
at org.apache.royale.compiler.internal.tree.mxml.MXMLFileNode.processUnits(MXMLFileNode.java:191)
at org.apache.royale.compiler.internal.tree.mxml.MXMLFileNode.initialize(MXMLFileNode.java:156)
at org.apache.royale.compiler.internal.tree.mxml.MXMLTreeBuilder.build(MXMLTreeBuilder.java:319)
at org.apache.royale.compiler.internal.units.MXMLCompilationUnit.handleSyntaxTreeRequest(MXMLCompilationUnit.java:104)
at org.apache.royale.compiler.internal.units.CompilationUnitBase.processSyntaxTreeRequest(CompilationUnitBase.java:839)
at org.apache.royale.compiler.internal.units.CompilationUnitBase.access$100(CompilationUnitBase.java:109)
at org.apache.royale.compiler.internal.units.CompilationUnitBase$2$1.call(CompilationUnitBase.java:263)
at org.apache.royale.compiler.internal.units.CompilationUnitBase$2$1.call(CompilationUnitBase.java:259)
at org.apache.royale.compiler.internal.units.requests.RequestMaker$1.call(RequestMaker.java:228)
at org.apache.royale.compiler.internal.units.requests.RequestMaker$1.call(RequestMaker.java:222)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
Nov 09, 2019 7:11:53 PM org.eclipse.lsp4j.jsonrpc.RemoteEndpoint fallbackResponseError
SEVERE: Internal error: java.lang.NullPointerException
java.util.concurrent.CompletionException: java.lang.NullPointerException
at java.util.concurrent.CompletableFuture.internalComplete(CompletableFuture.java:205)
at java.util.concurrent.CompletableFuture$AsyncApply.exec(CompletableFuture.java:507)
at java.util.concurrent.CompletableFuture$Async.run(CompletableFuture.java:428)
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)
Caused by: java.lang.NullPointerException
at com.as3mxml.vscode.utils.ASTUtils.getCompilationUnitAST(ASTUtils.java:70)
at com.as3mxml.vscode.providers.CodeActionProvider.codeAction(CodeActionProvider.java:119)
at com.as3mxml.vscode.ActionScriptServices.lambda$codeAction$9(ActionScriptServices.java:529)
at com.as3mxml.vscode.ActionScriptServices$$Lambda$17/1903717044.apply(Unknown Source)
at java.util.concurrent.CompletableFuture$AsyncApply.exec(CompletableFuture.java:501)
... 4 more
Hope it could help! Thanks again.
Oddly, those line numbers in the stack traces don't line up properly with the code in v0.23.2. It seems like you might be running v0.22.0 instead.
Sorry! I was doing a lot of tests and trying to downgrade. So in addition to CPU hikes I got a ton of errors in the output. The new version 0.23.2 doesn't output anything but puts a much higher load on CPU, now it's around 350%. Also ctrl/cmd+clicking doesn't work for most mxml files.
I couldn't make an isolated case so far. Will try to.
Now I face a 400% CPU load. Couldn't make an isolated case because the project is quite complex.
Here's the structure of my asconfig.json
. I have the main project and additional libraries shared between projects (that are also in the source-path
):
{
"config": "air",
"compilerOptions": {
"output": "bin-debug/project.swf",
"warnings": false,
"target-player": "10.1",
"source-path": [
"src",
"/Users/user/Projects/additional-sources-for-libraries"
],
"library-path": [
"/Applications/Adobe Flash Builder 4.6/etc.swc",
"..."
],
"external-library-path": [
]
},
"files":
[
"src/project.mxml"
],
"htmlTemplate": "html-template",
"additionalOptions": "...compiler-defines..."
}
Maybe something's wrong with using a structure like that?
I don't see anything wrong with the basic structure. However, it's difficult to say for sure because you did not post the full contents of the file.
Same problem. I have a very big project, and sometime it takes a very long time for as3mxml language server initialization. And sometimes it takes high cpu load(almost 100% on windows).
If I kill the process I got "Connection to server got closed. Server will restart." on output of as3mxml language server, ant then the load of cpu goes high again.
Here are some infomations.
I don't see anything wrong with the basic structure. However, it's difficult to say for sure because you did not post the full contents of the file.
Unfortunately I cannot post my project source as it's under very strict NDA. Also I cannot reproduce it starting from scratch. Removing files one by one doesn't work either - I have like 40 files in my project and when I remove just one I get numerous crashes and errors from the plugin (well obviously). It takes forever to get rid of those errors.
I think it's the problem with the size of the project. If it's a very small one, like 2-3 .as/.mxml files, no more than 2000 lines then there are no problems. When it starts getting bigger, starts using various AS3 features the plugin cannot handle it.
P.S. By the way Flash Builder handles it just fine, also there are no compile time errors.
So after a while a gave new version a try! Thanks for all the hard work!
I did some tests, seems there's the same problem, but it's only on our MacBook Pros. Java process starts throttling after around 15-20mins at 400-500% CPU. My guess it's mainly a memory problem. Plugin starts 2-3 java
processes with each consuming ~1.7GB of memory. So it's 5.1GB total. We have only 8GB on our MacBooks.
If I open second window with an ActionScript project in it, the number of java
processes increase.
Is there a way to reduce the memory print or number of java
processes? Thank you very much!
There should be one main Java process that runs all of the time, which is the language server that provides code intelligence. If you are using "Quick Compile & Debug/Run, there may be a second Java process that keeps running. You can avoid the second one by using regular build tasks instead of the "Quick Compile". This should actually save a lot of memory.
There are various other Java processes that may run intermittently, but they should not stay open all of the time. For instance, the SWF debugger, or the build tasks.
There's no way to reduce the extra Java process that open in a second window, except to add the folders from the second window into the workspace of your first window.
What is "Quick Compile"? Probably I'm not using it.
Also as I start VS Code with plugin enabled there are immediately two java
processes belonging to the plugin, one is running adt.jar
and another running slf4j-nop-1.7.21.jar
. As I work they multiply. Please see screenshots attached, this is what I see right when I start VS Code and first open an AS3 project:
What is "Quick Compile"? Probably I'm not using it.
Also as I start VS Code with plugin enabled there are immediately two java processes belonging to the plugin, one is running adt.jar and another running slf4j-nop-1.7.21.jar.
I suspect that these particular .jar files are on the classpath of different .jar files that are the primary ones actually launched by the Java process. In the case of slf4j, it's not even possible to use it as the main .jar file, as far as I know. I definitely don't launch it standalone like that.
Anyway, it seems strange that you are seeing are two Java processes (assuming that you have only one VSCode window open because multiple windows will always require more... just a strict VSCode requirement). There should be only one Java process once everything has initialized (purely for code intelligence — not counting new processes started when you build, of course). There may be one or two temporary ones during initialization, but they should exit within a second or less after starting.
I'll see if I can reproduce on macOS. My initial test on Windows shows only one Java process being started, as I would expect.
For a single window, even if it has multiple root folders open, I'm seeing just one Java process on macOS after initializations. Obviously, there are more Java processes temporarily if I build a project or debug/run a SWF later, but they appear to exit at the appropriate time and don't stick around.
No I'm not using "Quick Compile".
Well, after a couple restarts and reinstalls now there's only one java
process (using around 2GB of memory). But it didn't change CPU usage - still at 400%-500% after a while.
I don't know. I don't know how is anybody using this plugin. I now get "~1,500%" CPU usage on new Mac Pro, fresh Catalina 10.15.5 on any project I'm running it on :-(
I don't know how is anybody using this plugin.
Obviously, not everyone is encountering the same issue. There must something about the way that your project or computer is configured that is different from others. We simply haven't figured out what this is yet.
It seems unlikely that we'll figure it out randomly. I suspect that the only way that we can move forward is for you to send me a project that consistently triggers this issue. Then, I can try to reproduce with the same project on another computer. If you need to send me something privately, you can email it to my Github username at bowlerhat.dev.
@jnpatrick99 I just published AS3 & MXML extension v1.5.0, which includes a new setting, as3mxml.languageServer.concurrentRequests
. Can you try setting as3mxml.languageServer.concurrentRequests
to false
, and let me know if you see any difference? After you change the setting, I recommend completely closing VSCode and opening it fresh, just to be safe. You might even consider doing a full computer restart after the change. Thanks!
Sorry to dredge up an old issue here but I've just encountered the same problem, I'm also running OSX Mojave 10.14.6, with a fully updated plugin (v1.7.1) and vscode install.
Strangely I couldn't produce the bug on demand, trying multiple times with huge project folders, files and even a single normal actionscript file. But at random I will suddently notice there are 3-6 java processes that are tearing into CPU even after vscode is closed (I only notice because my whole machine starts lagging). Tried with different versions of java installed too. It's definitely related to the plugin because all the java processes have plugin files open and this only happens if/after I'm using it.
Sorry I couldn't provide any more insight here, I tried using process monitor, checking network/memory and nothing weird is standing out, (except some java processes CPU are well over 100% and the other ones remain in unison at around 18%) but I guess this confirms the issue is still outstanding.
I am having a potentially related issue. At the moment, no known steps, but I have some observations that may help. If this is a distinctly new issue, I'll be happy to write it up.
When Visual Studio Code starts up, it launches the as3-server as a Java sub-process to VSCode. After some period, and likely some specific steps, it seems to unlink from VSCode and become it's own process. Once this happens, the as3-server starts to respond very slowly and eventually stops responding. Saves, for instance, pause auto formatting to wait for "something". If I cancel the waiting dialog, the save completes.
Once I reach this point, I have to close VSCode, then manually find the java process, usually around 2.5Gb in size, and kill it. This is why I say unlinked from VSCode. In the beginning, it's within the process tree of VSCode (as seen in Windows Task Manager), then after the event, it's by itself and no longer under the VSCode tree.
FYI, this is happening several times a day for me currently. I've been trying to isolate the steps, but have so far not found anything specific. Also, no output in the log. Is there a way to enable debug logging so that we can further assist?
After recent updates to as3mxml (v0.23.2) the
java
process started to throttle CPU when using as3mxml extension with VS Code (I'm using the most recent one, 1.39.2).I'm on a MacBook Pro, macOS Mojave 10.14.6 and I never faced an issue like that before. Processor usage was high but never that high. And now
java
constantly does that even if the mxml/as files are closed in the editor.P.S. It starts after a while, I think after I open 2-3 .as or .mxml files. And
java
process doesn't quit if I quit VS Code. I have to killjava
manually every time I close the window.How can I pinpoint the problem? Thank you!