Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #5087 Use lock to protect Deployment Mgr startup errors #5139

Merged
merged 3 commits into from
Aug 24, 2020

Conversation

janbartel
Copy link
Contributor

Closes #5087

The synchronize is there to protect the MultiException, which is not threadsafe. This is one possible solution to removing the synchronize in DeploymentManager: introduce a lock to protect the MultiException. A different solution would be to use a CopyOnWriteArrayList and then pump them all into a MultiException to throw.

@janbartel janbartel linked an issue Aug 12, 2020 that may be closed by this pull request
@janbartel janbartel requested review from joakime and sbordet August 12, 2020 11:01
Copy link
Member

@olamy olamy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but maybe could be easy to make MultiExceptions thread safe by using CopyOnWriteArrayList?

@lachlan-roberts
Copy link
Contributor

Why do need to protect this MulitException from being used from different threads?

The only place addOnStartupError(t) is called has an isStarting() check guarding it, and the only place we check it is in doStart(). Wouldn't this all be done in the same thread.

@lorban
Copy link
Contributor

lorban commented Aug 21, 2020

LGTM, especially as this fixes a bug (onStartupErrors was not accessed from within a lock in doStart()) but I do find @lachlan-roberts 's comment pertinent.

@janbartel
Copy link
Contributor Author

@lachlan-roberts @lorban during DeploymentManager.doStart(), it calls AppProvider.start() on all of its child app providers. When these start some of them start a new thread. These threads can start deploying apps they find immediately, at which time they call back into DeploymentManager.requestAppGoal(App, String) which collects the exceptions. Thus, as there are potentially multiple threads calling back into DeploymentManager and affecting the MultiException, it's best to protect it.

@janbartel janbartel merged commit f143bab into jetty-9.4.x Aug 24, 2020
@janbartel janbartel deleted the jetty-9.4.x-5087-deployment-mgr-locking branch August 24, 2020 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Review DeploymentManager locking
4 participants