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.

Bug 210820 - Deadlock in Installer class
Summary: Deadlock in Installer class
Status: RESOLVED FIXED
Alias: None
Product: ide
Classification: Unclassified
Component: Logger (show other bugs)
Version: 7.2
Hardware: PC All
: P2 normal (vote)
Assignee: Martin Entlicher
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-06 12:45 UTC by Martin Entlicher
Modified: 2012-04-07 10:10 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Entlicher 2012-04-06 12:45:48 UTC
Installer.writeOut() method is executed in a task and it uses
synchronized (UIGESTURE_LOG_LOCK).
Installer.readLogs() uses synchronized (UIGESTURE_LOG_LOCK), under which it waits for the task to finish.

This creates waiting on two locks in opposite order and leads to deadlock.

Before this change http://hg.netbeans.org/main/rev/3febf5809ae5 the deadlock was interrupted by the timeout.
Comment 1 Martin Entlicher 2012-04-06 12:48:17 UTC
See http://deadlock.netbeans.org/hudson/job/NB-Core-Build/8108/console

Thread Test Watch Dog: testLogsReceivedOnExit
	at java.lang.Object.wait(Object.java:-2)
	at org.openide.util.Task.waitFinished(Task.java:161)
	at org.openide.util.RequestProcessor$Task.waitFinished(RequestProcessor.java:1747)
	at org.netbeans.modules.uihandler.UIHandler.waitFlushed(UIHandler.java:180)
	at org.netbeans.modules.uihandler.Installer.readLogs(Installer.java:713)
	at org.netbeans.modules.uihandler.Installer.getLogs(Installer.java:800)
	at org.netbeans.modules.uihandler.InstallerTest.getLogsSize(InstallerTest.java:572)
	at org.netbeans.modules.uihandler.LogsTooLateTest.testLogsReceivedOnExit(LogsTooLateTest.java:86)
	at org.netbeans.junit.NbTestCase.access$200(NbTestCase.java:95)
	at org.netbeans.junit.NbTestCase$2.doSomething(NbTestCase.java:400)
	at org.netbeans.junit.NbTestCase$1Guard.run(NbTestCase.java:326)
	at java.lang.Thread.run(Thread.java:662)

Thread Flush UI Logs
	at org.netbeans.modules.uihandler.Installer.writeOut(Installer.java:443)
	at org.netbeans.modules.uihandler.UIHandler$2WriteOut.run(UIHandler.java:154)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1452)
	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2032)

	at org.netbeans.junit.NbTestCase$1Guard.waitFinished(NbTestCase.java:367)
	at org.netbeans.junit.NbTestCase.runBare(NbTestCase.java:425)
	at org.netbeans.junit.NbTestCase.run(NbTestCase.java:260)
Comment 2 Martin Entlicher 2012-04-06 13:10:27 UTC
Fixed by changeset:   218085:bb2409b5bd34
http://hg.netbeans.org/main/rev/bb2409b5bd34
Comment 3 Martin Entlicher 2012-04-06 13:20:41 UTC
BTW: there is also a synchronization problem of logsSize field and clearLogs() method
Issue #210823.
Comment 4 Quality Engineering 2012-04-07 10:10:12 UTC
Integrated into 'main-golden', will be available in build *201204070400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/bb2409b5bd34
User: mentlicher@netbeans.org
Log: #210820: Deadlock resolution.