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 16432 - Mutex.writeAccess and Mutex.postWriteRequest do not behave as documented
Summary: Mutex.writeAccess and Mutex.postWriteRequest do not behave as documented
Status: RESOLVED WONTFIX
Alias: None
Product: platform
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 3.x
Hardware: All All
: P4 blocker (vote)
Assignee: Jesse Glick
URL:
Keywords: API
Depends on: 32439
Blocks: 16600
  Show dependency tree
 
Reported: 2001-10-10 15:04 UTC by Jesse Glick
Modified: 2008-12-22 23:56 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2001-10-10 15:04:43 UTC
[dev oct 9] I have one thread which holds a certain write mutex
(module system) and waits for some task to finish. Another thread
(with that task) calls mutex.postWriteRequest(Runnable) and
immediately blocks, contrary to its docs: "If there is no writer &
reader, it will be run immediately; otherwise it will be run later
when the last writer and/or reader finishes." This causes a deadlock.
Same for writeAccess, which is documented: "It may be run
asynchronously." which is not in fact true, the code shows that it
always blocks. Workaround: post to request processor and from there
run synchronously in write mutex.
Comment 1 Jaroslav Tulach 2001-10-11 08:40:13 UTC
I see. The true is that postWriteRequest javadoc should mention that
we are talking about one thread. If the writer is in different thread
and there is no other writer/reader in my thread. It blocks.

Running post write access in different thread (after all
readers/writers exits) might be useful, but could be dangerous!? Or
not?

Anyway the javadoc should be probably made more precise & for future
we introduce a new method (or boolean flag) to allow a postXRequest to
be executed in any thread.

Comment 2 Jesse Glick 2001-10-11 09:48:08 UTC
Right. I can see the current behaviors of these methods being useful
in some circumstances. The point is that if you expect them to behave
as documented, you can easily be disappointed (as in deadlock). Maybe
just documentation needs to be corrected; or add nonblocking variants
of these calls.
Comment 3 anovak 2001-10-15 16:47:35 UTC
I updated the docs, so now it should be clear. Yarda told me to add
methods that will allow completely asynchronous processing of posted
requests, but this is planned for 3.4
Comment 4 Jesse Glick 2001-10-15 20:17:08 UTC
Thanks, the docs look much better and the tests too... if you have a
request for added methods, probably better to file them separately and
mark this FIXED. Nobody ever gets REMINDED by IssueZilla.
Comment 5 Jaroslav Tulach 2001-10-16 10:29:36 UTC
Ok, I am opening this as an enh. for new methods for release 3.4

Please add methods post(Read|Write)Request (Runnable run, boolean
anythread) that will allow to place a request into the mutex and run
it without blocking the callers thread.



Comment 6 Marek Grummich 2002-07-22 11:15:58 UTC
Set target milestone to TBD
Comment 7 Marek Grummich 2002-07-22 11:19:05 UTC
Set target milestone to TBD
Comment 8 Jesse Glick 2003-03-27 23:10:40 UTC
In issue #32439's patch, readAccess(Runnable) and
writeAccess(Runnable) do indeed run their runnables asynch (using a
private dedicated request processor) in case they would other block
for a writer or the last reader to exit.
Comment 9 Jesse Glick 2003-03-27 23:12:18 UTC
Possibly could be considered an API change - behavior of
*Access(Runnable) is a bit different.
Comment 10 Jesse Glick 2003-09-09 16:50:04 UTC
Rather won't make changes to semantics of existing Mutex.