ch.vorburger.exec
ch.vorburger.exec copied to clipboard
Unexpected error when calling waitForExit
Here's the issue that we're seeing:
ManagedProcess process = builder.build();
process.start();
process.waitForExit(); // Crashes the error below:
waitForExit fails with this:
Caused by: ch.vorburger.exec.ManagedProcessException: Asked to waitFor Program
[/tmp/75968747865555/MysqlDB4j/base/bin/mysql, -uroot, --socket=/tmp/75968747865555/MysqlDB4j.33803.sock]
(in working directory /tmp/75968747865555/MysqlDB4j/base), but it was never even start()'ed! |
| | at ch.vorburger.exec.ManagedProcess.assertWaitForIsValid(ManagedProcess.java:478)
| | at ch.vorburger.exec.ManagedProcess.waitForExitMaxMsWithoutLog(ManagedProcess.java:439) |
| | at ch.vorburger.exec.ManagedProcess.waitForExit(ManagedProcess.java:418) |
| | at com.airbnb.mysql4j.DB.run(DB.java:405) |
[...]
This is failing randomly, at a rate of say 5%. Succeeds after retries.
Based on the comment from here: https://github.com/vorburger/ch.vorburger.exec/blob/07f251115af56a4f6d38eb46cb2cbd76d10a10ed/src/main/java/ch/vorburger/exec/ManagedProcess.java#L198
... I suspect (without being able to prove this via a test) that what's happening is this, inside startExecute()
executor.executestarts execution of something that will failthis.wait(100)returns with no error, but incorrectly fails to detect that the background thread has an errorisAlive = watchDog.isWatching()correctly returns False, because the background thread has indeed failedwaitForExitwill callassertWaitForIsValid(), which throws becauseisAlive = False(from 3) andhasResult = False(from 2)
@mihneagiurgea do you want to check if #96 from @cardamon might fix this problem?
@mihneagiurgea if you are still seeing this with the new 3.1.5 I am about to release, I would welcome a PR to fix!
@mosesn perhaps you would like to chime in here - do you know if this one can be closed? Still needs a fix?
I'm still working on the MariaDB4J upgrade–the SLF4J 2.x upgrade is incompatible with some of the versions of the other libraries we use (Spark, Dropwizard, etc) so it has been a bit of a slog. I'm hoping to merge it in soon, and I should be able to give you better feedback once that's done.