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 210991 - EventQueue.invokeAndWait may be waiting but it is not invoking
Summary: EventQueue.invokeAndWait may be waiting but it is not invoking
Status: VERIFIED WONTFIX
Alias: None
Product: platform
Classification: Unclassified
Component: JDK Problems (show other bugs)
Version: 7.2
Hardware: PC Mac OS X
: P2 normal (vote)
Assignee: Antonin Nebuzelsky
URL:
Keywords: TEST
: 211067 211569 212178 212734 213508 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-04-11 08:45 UTC by soldatov
Modified: 2012-06-14 07:44 UTC (History)
9 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
stacktrace (1.15 KB, text/plain)
2012-05-30 17:11 UTC, Exceptions Reporter
Details

Note You need to log in before you can comment on or make changes to this bug.
Description soldatov 2012-04-11 08:45:22 UTC
in Gui tests on MacOSX 10.6 (nightly builds) I see such random exception:

SEVERE [org.openide.util.RequestProcessor]: Error in RequestProcessor org.netbeans.modules.project.ui.OpenProjectList$4
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
	at java.util.ArrayList.RangeCheck(ArrayList.java:547)
	at java.util.ArrayList.get(ArrayList.java:322)
	at org.openide.util.Mutex.doEventAccess(Mutex.java:1394)
	at org.openide.util.Mutex.readAccess(Mutex.java:271)
	at org.netbeans.modules.project.ui.OpenProjectList.open(OpenProjectList.java:748)
	at org.netbeans.modules.project.ui.OpenProjectList$4.run(OpenProjectList.java:584)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1452)
[catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2032)

other problem - new project doesn't appear in Projects tab.
Comment 1 Jesse Glick 2012-04-11 12:48:05 UTC
new ArrayList<T>(1) sets an initial capacity, but the size is still zero. Clearly something was thrown from run.run() which EventQueue.invokeAndWait did not rethrow; I can only guess that some category of error (OOME?) was thrown in EQ and logged by other means. The complete log file might provide a clue, but that was not supplied.

At any rate, an AtomicReference<T> would be both clearer and safer here; get() would just be null in case a strange error was thrown, which could be returned as is from doEventAccess, though it would be better to keep track of the fact that run.run() did _not_ return null and throw some kind of exception:

final AtomicBoolean wasSet = new AtomicBoolean();
final AR<T> res = new AR<T>;
...
try {
  res.add(run.run());
  wasSet.set(true);
} catch (...) {...}
...
if (wasSet.get()) {
  return res.get();
} else if (exc.get() != null) {
  throw exc.get(); // wrapping as needed
} else {
  throw new IllegalStateException("???");
}

(Could use an AtomicReference<Throwable> as well to hold the exception; strange to be using two different idioms for the same purpose here!)
Comment 2 Jesse Glick 2012-04-11 12:48:48 UTC
I guess I will take care of it.
Comment 3 Jesse Glick 2012-04-11 14:04:43 UTC
core-main #ff3de058c18b
Comment 4 Quality Engineering 2012-04-12 10:02:50 UTC
Integrated into 'main-golden', will be available in build *201204120400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/ff3de058c18b
User: Jesse Glick <jglick@netbeans.org>
Log: #210991: IOOBE in Mutex.doEventAccess
Comment 5 Jesse Glick 2012-04-12 23:24:37 UTC
*** Bug 211067 has been marked as a duplicate of this bug. ***
Comment 6 soldatov 2012-04-13 06:59:27 UTC
you are right. in 201204120400 build I see such exception in log.

SEVERE [org.openide.util.RequestProcessor]: Error in RequestProcessor org.netbeans.modules.project.ui.OpenProjectList$4
java.lang.IllegalStateException: #210991: got neither a result nor an exception
	at org.openide.util.Mutex.doEventAccess(Mutex.java:1400)
	at org.openide.util.Mutex.readAccess(Mutex.java:272)
	at org.netbeans.modules.project.ui.OpenProjectList.open(OpenProjectList.java:748)
	at org.netbeans.modules.project.ui.OpenProjectList$4.run(OpenProjectList.java:584)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1452)
[catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2032)
Comment 7 Jesse Glick 2012-04-13 17:14:14 UTC
Not sure what this means. EventQueue.invokeAndWait was called but its Runnable does not seem to have been run. Duplicate was also on a Mac, so perhaps it is a bug in the Mac JDK. If you can consistently reproduce I can add more logging for diagnosis.
Comment 8 soldatov 2012-04-13 18:50:23 UTC
(In reply to comment #7)
> Not sure what this means. EventQueue.invokeAndWait was called but its Runnable
> does not seem to have been run. Duplicate was also on a Mac, so perhaps it is a
> bug in the Mac JDK. If you can consistently reproduce I can add more logging
> for diagnosis.
Yes I can (5-10 tests per day catches this exception)

P.S. I use jdk 1.6.0_31 too (MacOSX update appeared few days ago)
Comment 9 Quality Engineering 2012-04-15 09:41:13 UTC
Integrated into 'main-golden', will be available in build *201204150400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/ea5cb379cc9f
User: Jesse Glick <jglick@netbeans.org>
Log: Diagnostics for #210991.
Comment 10 soldatov 2012-04-16 07:39:09 UTC
SEVERE [org.openide.util.RequestProcessor]: Error in RequestProcessor org.netbeans.modules.project.ui.OpenProjectList$4
java.lang.IllegalStateException: #210991: got neither a result nor an exception; started=false finished=false invoked=true
	at org.openide.util.Mutex.doEventAccess(Mutex.java:1406)
	at org.openide.util.Mutex.readAccess(Mutex.java:273)
	at org.netbeans.modules.project.ui.OpenProjectList.open(OpenProjectList.java:748)
	at org.netbeans.modules.project.ui.OpenProjectList$4.run(OpenProjectList.java:584)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1452)
[catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2032)
Comment 11 Jesse Glick 2012-04-23 13:02:36 UTC
*** Bug 211569 has been marked as a duplicate of this bug. ***
Comment 12 Jesse Glick 2012-05-08 13:54:57 UTC
*** Bug 212178 has been marked as a duplicate of this bug. ***
Comment 13 Jesse Glick 2012-05-21 16:15:36 UTC
*** Bug 212734 has been marked as a duplicate of this bug. ***
Comment 14 Exceptions Reporter 2012-05-25 01:56:26 UTC
This bug already has 5 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=186935
Comment 15 Antonin Nebuzelsky 2012-05-25 13:15:20 UTC
It seems like this may be already fixed in 6u32 builds on Mac. Tomas will check with Apple engineers.

Please, try 6u32 and reopen if you encounter this problem again.
Comment 16 Exceptions Reporter 2012-05-30 17:11:45 UTC
Created attachment 120080 [details]
stacktrace
Comment 17 Jesse Glick 2012-06-04 22:13:14 UTC
*** Bug 213508 has been marked as a duplicate of this bug. ***
Comment 18 soldatov 2012-06-14 07:44:28 UTC
Nice days!
After Russia Day I updated my MacOSX machines (to Java 1.6.0_33), and I have stable test results!