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 238643 - RequestProcessor may never execute Tasks
Summary: RequestProcessor may never execute Tasks
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 7.4
Hardware: All All
: P1 normal (vote)
Assignee: Jaroslav Tulach
URL:
Keywords:
Depends on:
Blocks: 226051
  Show dependency tree
 
Reported: 2013-11-21 10:06 UTC by mklaehn
Modified: 2013-12-18 16:31 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
proposed patch (957 bytes, application/octet-stream)
2013-11-21 10:06 UTC, mklaehn
Details

Note You need to log in before you can comment on or make changes to this bug.
Description mklaehn 2013-11-21 10:06:08 UTC
Created attachment 142435 [details]
proposed patch

In our application we have had the problem that tasks (Runnable and Callable alike) that have been dispatched on a specific RequestProcessor are never executed. The RequestProcessor in question is created using the following invokation:

new RequestProcessor(EventDataManagerRequestHandler.class.getSimpleName(), 2, false, false)

In our logfiles we've seen two of the following exceptions

java.lang.OutOfMemoryError: unable to create new native thread
	at java.lang.Thread.start0(Native Method)
	at java.lang.Thread.start(Thread.java:713)
	at org.openide.util.RequestProcessor$Processor.get(RequestProcessor.java:1921)
	at org.openide.util.RequestProcessor.enqueue(RequestProcessor.java:617)
	at org.openide.util.RequestProcessor$Task.schedule(RequestProcessor.java:1524)
	at org.openide.util.RequestProcessor$Task.schedule(RequestProcessor.java:1495)
	at org.openide.util.RequestProcessor.submit(RequestProcessor.java:816)

Our application (at those times) is running with a fairly extensive heap and number of threads. We are at the limit of the system we're required to run on. It is not surprising to get that Exception.

What is surprising is that the RequestProcessor did not attempt to run its submitted tasks. A heapdump supported this finding.
Further analysis of heap showed that the RequestProcessor in question showed
	throughput        = 2
	running           = 2
	processors.size() = 0

Code analysis showed that running is increased prior to retrieving a new Processor via Processor.get(). Should an Exception occur during the retrieval of a new Processor the RequestProcessor will think it actually got the Processor. Let that happen two time in this case and that RequestProcessor will never execute anything it is to execute.

The attached Patch will rectify this problem.
Comment 1 mklaehn 2013-11-21 10:07:54 UTC
If the described situation happens there's no way around it. setting to P1
Comment 2 Jaroslav Tulach 2013-11-26 13:14:01 UTC
ergonomics#4e43dbf15739
Comment 3 Quality Engineering 2013-11-29 02:54:31 UTC
Integrated into 'main-silver', will be available in build *201311290002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/4e43dbf15739
User: Jaroslav Tulach <jtulach@netbeans.org>
Log: #238643: Why do we the running field at all!? Using size of the processor's collection should be good enough.