This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Summary: | Deadlock on start: nbhandler.log vs. nbpreferences.sync | ||
---|---|---|---|
Product: | ide | Reporter: | Jaroslav Tulach <jtulach> |
Component: | Logger | Assignee: | Martin Entlicher <mentlicher> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | mmirilovic |
Priority: | P1 | ||
Version: | 8.0 | ||
Hardware: | PC | ||
OS: | Linux | ||
Issue Type: | DEFECT | Exception Reporter: | |
Bug Depends on: | |||
Bug Blocks: | 243865 | ||
Attachments: | Defering access to NbPreferences until the classloading is over |
Description
Jaroslav Tulach
2014-03-24 11:01:53 UTC
Created attachment 146495 [details]
Defering access to NbPreferences until the classloading is over
Looks like the simplest fix is to delay prefs.sync() a bit. I think restored() is a good place, it is called on every initialization and hopefully soon enough.
Please consider applying my patch.
...and ignore the jsbreakpoint related part of the fix. This locks up in class loaders. We log a message during class loading and the log handler initialization waits for another class loading. I do not see a different fix, than change EarlyHandler to work asynchronously. Store the records in some queue, initialize Installer in a separate thread and then switch to the UI logger. I've applied a hotfix, that should solve this particular issue. changeset: 273533:6d332776e3cc http://hg.netbeans.org/core-main/rev/6d332776e3cc But an asynchronous EarlyHandler might be necessary as well... Integrated into 'main-silver', will be available in build *201404060001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/6d332776e3cc User: mentlicher@netbeans.org Log: #243208: Do not access Installer class when we do not have to. Blocked issue is P1. Making P1 and requesting integration into 8.0. I did not reproduce this deadlock specifically, but the problem can be seen by starting NetBeans with -J-Dorg.netbeans.JarClassLoader.level=100 option. With the original code it crashes with java.lang.NullPointerException at java.lang.String.startsWith(String.java:1392) at java.lang.String.startsWith(String.java:1421) at org.netbeans.modules.uihandler.EarlyHandler.publish(EarlyHandler.java:79) at org.netbeans.core.startup.TopLogging$LookupDel.publish(TopLogging.java:453) at java.util.logging.Logger.log(Logger.java:731) at java.util.logging.Logger.doLog(Logger.java:754) at java.util.logging.Logger.log(Logger.java:839) at org.netbeans.JarClassLoader$JarSource.resource(JarClassLoader.java:606) at org.netbeans.Archive.getData(Archive.java:212) at org.netbeans.JarClassLoader$JarSource.readClass(JarClassLoader.java:577) at org.netbeans.JarClassLoader$Source.getClassData(JarClassLoader.java:374) at org.netbeans.JarClassLoader.doLoadClass(JarClassLoader.java:221) at org.netbeans.ProxyClassLoader.selfLoadClass(ProxyClassLoader.java:259) at org.netbeans.ProxyClassLoader.loadClass(ProxyClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at org.netbeans.modules.uihandler.UIHandler.<clinit>(UIHandler.java:77) Caused: java.lang.ExceptionInInitializerError at org.netbeans.modules.uihandler.Installer.<clinit>(Installer.java:127) at org.netbeans.modules.uihandler.EarlyHandler.publish(EarlyHandler.java:79) at org.netbeans.core.startup.TopLogging$LookupDel.publish(TopLogging.java:453) With the "hotfix" it blocks and does not start up at all. An asynchronous handling of log records is probably the only way to go. Fixed by changeset: 273906:63e55b1cb765 http://hg.netbeans.org/core-main/rev/63e55b1cb765 A test included. Although it does not have much impact on functionality, this is likely worth to include as well, for consistency: changeset: 273928:23331fbb2009 http://hg.netbeans.org/core-main/rev/23331fbb2009 The fix has revealed a race-condition in class loading: issue #243945. Integrated into 'main-silver', will be available in build *201404210001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/63e55b1cb765 User: mentlicher@netbeans.org Log: #243208: EarlyHandler initializes and restores Installer asynchronously in order not to block records publishing. Since the fix can be dangerous and has revealed issue #243945, I'm removing patch candidate. |