-
Notifications
You must be signed in to change notification settings - Fork 14
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
Hypertrace config is being loaded twice #223
Comments
Hey @pavolloffay 👋 If you're looking for someone to take on this issue, I'd be happy to help! It looks to me like the bug is with the implementation of double-checked locking in the The example they give in that article is very similar to the // (Still) Broken multithreaded version
// "Double-Checked Locking" idiom
class Foo {
private Helper helper = null;
public Helper getHelper() {
if (helper == null)
synchronized(this) {
if (helper == null)
helper = new Helper();
}
return helper;
}
// other functions and members...
} The above case is not a valid implementation of double-checking locking because:
SolutionsThere's a number of solutions to this problem, I'm not positive which would be the best fit that lines up with the goals for the internal architecture of this project
Based on my understanding of the solutions and this project's constraints, I think the best solution would be to improve the double-checking locking implementation with the |
I was curious to learn more about the internals of the Hypertrace javaagent, so I forked this repository and tried out a few of the approaches. I'll hold off on opening a PR until if/when a consensus is reached on the desired solution, but if it's helpful I have a branch leveraging the |
In our case, I think the main issue was that the config object was loaded in app/system classloader, then classes were added into bootstrap classloader and config was loaded again from agent classloader. The issue seems to be fixed now, at least I am not able to reproduce it again
But I agree that we should use volatile. Would you like to submit a PR? |
I also tried to reproduce with the Vertx sample app and wasn't able to, I wasn't sure if it was just a rare race condition or if it was architecture dependent. Either way, good chance that this was fixed upstream somewhere! Happy to open a PR for the small thread-safety issue 😄 |
The config file is being loaded twice. The config should live in the bootstrap classloader and be loaded only once.
The text was updated successfully, but these errors were encountered: