Fix concurrent connect in ConsoleColorProvider#2806
Open
vogella wants to merge 1 commit into
Open
Conversation
The default ConsoleColorProvider is shared across ConsoleCreation jobs that run in parallel. connect(IProcess, IConsole) stored both arguments in fields and then wired up via those fields, so concurrent calls could interleave and connect a console to another process' streams proxy. This led to an ArrayIndexOutOfBoundsException on the wrong console's stream listeners and to consoles not being connected. Wire up using the method arguments instead of the shared fields. Refs eclipse-platform#2638 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The default
ConsoleColorProvideris shared acrossConsoleCreationjobs that run in parallel.connect(IProcess, IConsole)stored both arguments in thefProcess/fConsolefields and then wired up via those fields, so concurrent calls could interleave and connect a console to another process' streams proxy. This caused anArrayIndexOutOfBoundsExceptionon the wrong console's stream listeners and consoles not being connected (#2638).Fix
Wire up using the method arguments instead of the shared fields.
Independent of the initialization-race fix (#2637); touches only
ConsoleColorProvider.Refs #2638