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

Summary: tighten up Terminal InputOutput synchronisation
Product: cnd Reporter: ivan <ivan>
Component: TerminalemulatorAssignee: ilia
Status: NEW ---    
Severity: normal CC: akrasny
Priority: P3    
Version: 7.3   
Hardware: All   
OS: All   
See Also: http://netbeans.org/bugzilla/show_bug.cgi?id=222859
http://netbeans.org/bugzilla/show_bug.cgi?id=223370
Issue Type: DEFECT Exception Reporter:

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. ***