-
-
Notifications
You must be signed in to change notification settings - Fork 9
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
Fix for https://github.com/vorburger/MariaDB4j/issues/233 #96
Conversation
Did you need to extend the class? It looks like a good fix that could be inlined with the main class without causing any extra issues. |
Agreed, but commons-exec latest release is dated Nov 6, 2014. Although it seems that it recently became active again... If a new release is in the works than adding something like this over there would indeed be better. |
Thanks for the contribution! I'll run this etc. once https://github.com/vorburger/MariaDB4j/issues/680 is fixed... |
@cardamon sorry for the long delay. I've run the build on this now, and it fails due to a missing license header in your new |
@@ -473,7 +473,7 @@ public ManagedProcess waitForExitMaxMsOrDestroy(long maxWaitUntilDestroyTimeout) | |||
} | |||
|
|||
protected void assertWaitForIsValid() throws ManagedProcessException { | |||
if (!isAlive() && !resultHandler.hasResult()) { | |||
if (!watchDog.isStopped() && !isAlive() && !resultHandler.hasResult()) { |
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.
THREAD_SAFETY_VIOLATION: Read/Write race. Non-private method ManagedProcess.assertWaitForIsValid()
indirectly reads without synchronization from this.isAlive
. Potentially races with write in method ManagedProcess.startExecute()
.
Reporting because another access to the same memory occurs on a background thread, although this access may not.
ℹ️ Expand to see all @sonatype-lift commands
You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.
Command | Usage |
---|---|
@sonatype-lift ignore |
Leave out the above finding from this PR |
@sonatype-lift ignoreall |
Leave out all the existing findings from this PR |
@sonatype-lift exclude <file|issue|path|tool> |
Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file |
Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.
Help us improve LIFT! (Sonatype LiftBot external survey)
Was this a good recommendation for you? Answering this survey will not impact your Lift settings.
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]
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.
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.
@vorburger it doesn't seem like this patch introduced this thread safety violation. Can we merge in this patch? It would be a useful improvement even if it preserved the thread safety issue.
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.
@mosesn thank you very much for having reviewed this; I agree - so (finally, sorry) MERGE this now!
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.
Thank you!!
Hi,
A fix/mitigation for https://github.com/vorburger/MariaDB4j/issues/233
https://github.com/vorburger/MariaDB4j/issues/233#issuecomment-1131559138 and https://github.com/vorburger/MariaDB4j/issues/233#issuecomment-1258651583 pointed in the right direction, but that seems not to be the actual issue.
ExecuteWatchdog#isWatching()
callsExecuteWatchdog#ensureStarted()
, which blocks untilExecuteWatchdog#start(Process)
is called by theDefaultExecutor
inexecuteInternal(...)
.The issue appears to be the opposite - the process completes so quickly that
isAlive
inManagedProcess
is never set to true because by the timeisAlive = watchDog.isWatching()
is called, the process already completed.The
or already finished
part in the comment// watchDog.isWatching() blocks if the process never started or already finished,
isn't true I think?