Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 382374

Summary: Synchronization looks fishy in org.eclipse.ui.console.IOConsoleOutputStream
Product: [Eclipse Project] Platform Reporter: Dani Megert <daniel_megert>
Component: DebugAssignee: Michael Rennie <Michael_Rennie>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: Michael_Rennie, pawel.1.piech
Version: 3.8   
Target Milestone: 4.3 M3   
Hardware: All   
OS: All   
Whiteboard:

Description Dani Megert CLA 2012-06-12 09:53:48 EDT
3.8 RC4

Synchronization looks fishy in org.eclipse.ui.console.IOConsoleOutputStream: this class has 3 'write' methods but only one is synchronized. This does not look right.
Comment 1 Michael Rennie CLA 2012-10-01 16:43:42 EDT
I agree, since the class is not to be used (noinstantiate and noextend) and all of the write methods call encodedWrite, we could just synchronize that method.

pushed fix to:

http://git.eclipse.org/c/platform/eclipse.platform.debug.git/commit/?id=82015c577ff5e8dce7172b91f80218760f027bfa
Comment 2 Pawel Piech CLA 2012-10-30 23:38:56 EDT
I tried to review the fix, and while adding the synchronized to the write method seems correct, the overall synchronization in IOConsoleOutputStream and IOConsolePartitioner still seems pretty scary.  There's a half dozen locks used between the two and IOConsole (not counting the UI thread or the jobs), and they hold references to each other.  Given the fact that there's no deadlocks being reported it's likely that everything matches up, but small changes in this code could have dangerous consequences.
Comment 3 Dani Megert CLA 2013-11-08 04:59:50 EST
See bug 421303 for a potential follow-up issue.