-
Notifications
You must be signed in to change notification settings - Fork 853
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
StackOverflowError on each startup, when indexing Javascript #3669
Comments
Someone said that the original indexer for JS was not that good enough to handle the amount of node_modules etc. It was not made for this. I think this is the problem now. If you just have a plain HTML, CSS, JS project, there will be no problem, but with npm, houston we have a problem. |
Many thanks for this feedback! But if I remove this directory, NetBeans complains it's a "Project problem" that kiwix-js uses npm modules that are not installed. And if I let it install them, the problem is back. |
Yes you can add the folder node_modules to the |
But in general this is still a topic to do to fix/rewrite the indexer. |
Appending Many thanks @Chris2011 for the hints. |
Yes, it will be ignored completely and your code completion will not work for your npm modules, due to the missing index. Yes it will not be shown in the project but there is a PR for this, which was merged december 2021: #3209. This will allow to still have the folder to navigate through but w/o indexing. |
Putting the discussion about the indexer in general aside the issue here is that the indexer does not handle self referential structures well. A minimal reproducer is this: function mod(actions) {
return actions.map((action) => {
action = { action };
return action;
});
}; With that at least the occurrences finder:
and the indexer are affected:
the immediate idea is using a Map/Set to store the visited maps would fix this, but that breaks intentional usages. Here is the original offender (name of the property and the indexable being indexed):
|
JS structures, that reference themselves can cause unlimited recursion in several places. In this changeset the JsIndexer and OccurrencesSupport are modified, so that recursive structures can be scanned without causing a StackOverflowError. Closes: apache#3669
JS structures, that reference themselves can cause unlimited recursion in several places. In this changeset the JsIndexer and OccurrencesSupport are modified, so that recursive structures can be scanned without causing a StackOverflowError. Closes: apache#3669
I created a PR with changes, that at least allow parsing of the structures. It is most probably not perfect, but at least allows working the files in a sane way. Please see the referenced PR for the changes themselves. If you can't build from source, here is a test build: NetBeans-dev-dev-18f9648d4000a2f0f025e23cf728f16812f9774c-release.zip It would be good if you could test it. |
Many thanks @matthiasblaesing However, I have another exception appearing in NetBeans UI (on each startup), that I do not have on NetBeans 13:
|
Thank you for the test. The |
Thanks, the AssertionError disappears with the config you mentioned. |
JS structures, that reference themselves can cause unlimited recursion in several places. In this changeset the JsIndexer and OccurrencesSupport are modified, so that recursive structures can be scanned without causing a StackOverflowError. Closes: apache#3669
Apache NetBeans version
Apache NetBeans 12.6
What happened
After upgrading NetBeans from 12.0 to 12.6 (and importing the settings from 12.0, as suggested by the UI), I have a StackOverflow error on each startup.
During the "background scanning of projects", an exception is thrown, and displayed by NetBeans with an infinite loop on org.netbeans.modules.javascript2.editor.index.JsIndexer.storeObject(JsIndexer.java:229)
(see stacktrace)
The background scanning of projects never ends, and consumes a lot of CPU in the background
How to reproduce
On my computer, it can be reproduced on each startup.
As a workaround, I could switch to another project group (with other non-javascript projects), then restart Netbeans.
In this case, there is no exception and no background CPU usage on startup. But the symptom comes back if I switch back to the project group where I have a specific javascript project.
This project is an open-source one: https://github.com/kiwix/kiwix-js
But this project is also open in a project group of another computer with no problem (same OS, same version of Netbeans, also upgraded from 12.0).
Did this work correctly in an earlier version?
Apache NetBeans 12.3 or earlier
Operating System
Ubuntu 20.04.3 amd64, with all updates installed
JDK
OpenJDK 11.0.13 (provided by Ubuntu). Same result with OpenJDK 17.0.1 (provided by Ubuntu)
Apache NetBeans packaging
Apache NetBeans provided installer
Anything else
Stacktrace:
(this last line is repeated around 1000 times)
Removing the cache and restarting Netbeans does not help.
I'd be happy to help to test/investigate on that issue.
(originally reported on https://issues.apache.org/jira/browse/NETBEANS-6467)
Are you willing to submit a pull request?
No response
Code of Conduct
Yes
The text was updated successfully, but these errors were encountered: