-
Notifications
You must be signed in to change notification settings - Fork 5
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
Plugin is not thread safe #14
Comments
Point taken. |
@phax Any updates on this issue? You are of course right that synchronization must be placed in the static methods of |
Of course not :( I forgot - sorry. |
Version 4.1.1 will be on Maven Central within the next half hour (I hope). |
@phax, thanks a lot! We'll test this and provide an update. |
Your changes seems to do the trick. I ran 8 builds with no errors in the environment that was most prone to the issue. I sent a PR to mark the plugin as thread safe to get rid of the maven warning, see #16. |
When testing this plugin in multithreaded maven builds, it failed in 3 out of 5 runs.
Maven creates a new instance of the mojo for each thread. So in general, for a plugin to be thread safe, it cannot use any system resources, e.g. writing to common tmp dirs or system properties. Also, it should not use any non-final static fields.
In all cases when the build fails, we see stack traces from two of our maven modules that run
ToolFacade.run
at exactly the same time (stack trace is identical for both modules):In about half the cases, we don't see any more details. But the remaining builds report a NullPointerException for one of the modules:
It seems that
JavaCCMojo.processGrammar
is a common entry point. A quick fix might be to synchronize the method if the root cause is difficult to find.The text was updated successfully, but these errors were encountered: