ValidateLayerConsistencyTest is flaky
See original GitHub issueApache NetBeans version
Apache NetBeans latest daily build
What happened
The ValidateLayerConsistencyTest seems to be flaky:
Sometimes fails in an assertion:
2022-06-08T18:30:24.0613903Z [junit] FINE [org.openide.util.lookup.implspi.ActiveQueue]: Got dequeued reference org.openide.util.lookup.AbstractLookup$ReferenceToResult@597289e4
2022-06-08T18:30:24.0614562Z [junit] FINE [org.openide.util.lookup.implspi.ActiveQueue]: Got dequeued reference org.openide.util.lookup.AbstractLookup$ReferenceToResult@67cb9a30
2022-06-08T18:30:27.1650822Z [junit] java.lang.AssertionError: Has to be NbRepository: org.openide.filesystems.Repository@5cf749fa Initialization stack: java.lang.Exception: initialized
2022-06-08T18:30:27.1651908Z [junit] at org.openide.filesystems.Repository.<init>(Repository.java:326)
2022-06-08T18:30:27.1652502Z [junit] at org.openide.filesystems.Repository$3.call(Repository.java:373)
2022-06-08T18:30:27.1652987Z [junit] at org.openide.filesystems.Repository$3.call(Repository.java:368)
2022-06-08T18:30:27.1653709Z [junit] at org.openide.filesystems.Repository.delayFileSystemAttachImpl(Repository.java:1018)
2022-06-08T18:30:27.1654297Z [junit] at org.openide.filesystems.Repository.getDefault(Repository.java:368)
2022-06-08T18:30:27.1654794Z [junit] at org.netbeans.core.startup.Main.start(Main.java:298)
2022-06-08T18:30:27.1655764Z [junit] at org.netbeans.core.startup.TopThreadGroup.run(TopThreadGroup.java:98)
2022-06-08T18:30:27.1656203Z [junit] at java.lang.Thread.run(Thread.java:750)
2022-06-08T18:30:27.1656523Z [junit]
2022-06-08T18:30:27.1656885Z [junit] at org.netbeans.core.startup.Main.start(Main.java:298)
2022-06-08T18:30:27.1657532Z [junit] at org.netbeans.core.startup.TopThreadGroup.run(TopThreadGroup.java:98)
2022-06-08T18:30:27.1657948Z [junit] at java.lang.Thread.run(Thread.java:750)
The full log of the run is zipped: fulllog.txt.zip (The quoted part start in line 109186).
The listed stack trace was retrieved using an idea from @jtulach, by creating a fake exception in the Repository constructor, fetching the stacktrace from it and storing it into a public field of that class.
This seems to be a race when initializing the META-INF based services. The NbRepository
that is expected, is registered as such a service and thus should be available from the default lookup.
This is the code in master (at time of writing):
and the wrong Repository is created in line 362.
Did this work correctly in an earlier version?
No
Operating System
Linux
JDK
JDK 8 - 19 all show behavior sometimes
Apache NetBeans packaging
Other
Issue Analytics
- State:
- Created a year ago
- Comments:10 (10 by maintainers)
https://en.wikipedia.org/wiki/The_real_McCoy FYI
Is some sort of additional tear down logic needed in some context (after test or before test)to prevent or something to setup this correctly?