Community
Participate
Working Groups
Build Identifier: 20110615-0604 In IOConsolePartitioner there are two jobs - QueueProcessingJob and TrimJob. Although they cannot run simultaneously, there is no guarantee about the order in which they'll run. This may cause corrupted console output for clients of MessageConsole in the case where in same thread first there is a call to MessageConsole.clearConsole() and immediately after that several calls to println() on the message stream acquired from the console. In this case there the job for clearing the console may run after the job for processing the message stream, thus loosing lines. Reproducible: Always
This is still an issue. I have an idea how to fix it but first want to merge my other pending console changes or I conflict with myself.
Moved to M3, please change if you have some other plans.
*** Bug 323816 has been marked as a duplicate of this bug. ***
New Gerrit change created: https://git.eclipse.org/r/155654
Apart from the reported situation with print after clear and the later printed content is falsely cleared the reversed situation is also possible. It is just less useful but also possible that a print immediately followed by clear still shows the printed content in console. If a user does the following in a single thread: outStream.print("First"); console.clearConsole(); outStream.print("Second"); he can expect to see only "Second" in console and after this change it should be the case.
Created attachment 281477 [details] Plugin to test race condition I made a small plugin for verification. It adds a test console (ClearConsole) and a test button/icon in Console view (eclipse icon). In fact the button is added and usable on each MessageConsole. The button execute similar code as in my example above. Print "must be cleared" Clear Print "must be shown" Before fix with race condition described in comment 0 the actual result is an empty console. In the other race condition I added it shows both strings. In fixed console only the second string is visible.
Gerrit change https://git.eclipse.org/r/155654 was merged to [master]. Commit: http://git.eclipse.org/c/platform/eclipse.platform.debug.git/commit/?id=1cf22e3c35e548b84bd22a7341b4ea06e97804b3
(In reply to Paul Pazderski from comment #1) > This is still an issue. I have an idea how to fix it but first want to merge > my other pending console changes or I conflict with myself. Old implementation set next trim offset to -1 and the trim job removes all if offset is -1. The idea and fix is to use the current document length when clear is called as trim offset. This way content added after clear but before trim is not cleared anymore.