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 223636 - tighten up Terminal InputOutput synchronisation
Summary: tighten up Terminal InputOutput synchronisation
Status: NEW
Alias: None
Product: cnd
Classification: Unclassified
Component: Terminalemulator (show other bugs)
Version: 7.3
Hardware: All All
: P3 normal (vote)
Assignee: ilia
URL:
Keywords:
: 223376 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-12-11 06:49 UTC by ivan
Modified: 2017-02-03 11:39 UTC (History)
1 user (show)

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 ivan 2012-12-11 06:49:36 UTC
This arose out of bug #222859 where it was determined that a synchronization
problem exists between TerminalInputOutput.dispose() and getOut().
if dispose() and getOut() are executed "simultaneously" it is possible for getOut() 
to return a null reference (nulled by dispose).

Moving the synchronized in getOut() to method level (and adding one to dispose())
isn't quite appropriate because terminal.setOutConnected() has a side-effect of calling
callbacks and that's not a good idea while holding locks.

Even if there was no callback there's the issue of getOut() returning a new OutputWriter
after dispose(). This leads to the notion that operations on InputOutput after a 
call to InputOutput.closeInputOutput(), which ultimately calls dispose(),  are 
"undefined" in the documentation and should perhaps raise IllegalStateException.

Synchronous test-and-set access to such an "illegal state" might be a more
tractable problem to solve than synchronising 'outputWriter'. (although ...
can one re-open an InputOutput tat has been closeInputOutput()ed?).

See .../terminal/README.close_semantics for a discussion of InputOutput state
transitions.
Comment 1 ivan 2012-12-13 05:24:10 UTC
*** Bug 223376 has been marked as a duplicate of this bug. ***