-
Notifications
You must be signed in to change notification settings - Fork 121
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
Make PositionImpl thread-safe #465
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, one question.
} | ||
} catch { | ||
// TODO - catch ReflectiveOperationException once sbt is migrated to JDK7 | ||
case ignored: Throwable => None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we postpone this change for an RC cycle?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have a hawk eye. Sure, I'll be fine with moving that change to 1.1.x.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's clearer when ignoring whitespace changes: https://github.com/sbt/zinc/pull/465/files?w=1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess that will fix the bug, but what should really be fixed is the underlying logging infrastructure, otherwise this will come back in another form.
Reviewing this tomorrow. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just one minor request and it's good to go.
/** | ||
* Strict and immutable implementation of Position. | ||
*/ | ||
private[sbt] final class PositionImpl( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're only going to instantiate this class via its apply method in the companion, could we make this constructor private?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good suggestion. I'll make the change.
Fixes sbt#464 sbt/sbt#3623 Currently compiling a lot of Java code in CI environment causes NullPointerException, which is suspected of race condition around `javax.tools.Diagnostics[S]`, which is held by `PositionImpl` and then later accessed by async logging. This change makes the `PositionImpl` strict and immutable, and extracts it from a Java Diagnostics object. No other observable changes are introduced besides, hopefully the lack of NPE. Credit on the detective work goes to Lightbend Akka team ktoso, 2m, and jrudolph.
Fixes #464
Fixes sbt/sbt#3623
Currently, compiling a lot of Java code in CI environment causes NullPointerException, which is
suspected of race condition around
javax.tools.Diagnostics[S]
, which is held byPositionImpl
and then later accessed by async logging.This change makes the
PositionImpl
strict and immutable, and extracts it from a Java Diagnostics object. No other observable changes are introduced besides, hopefully the lack of NPE. Credit on the detective work goes to Lightbend Akka team @ktoso, @2m, and @jrudolph.