-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Windows, Java workers: worker sometimes gets stuck in a bad state #2538
Comments
what is the right category @laszlocsomor? This seems to be Windows only? |
I don't know. I'm only using Windows these days, so I haven't had the chance to see it elsewhere. |
The 90s called, they want their general protection faults back:
Considering that ijar is crashing here, but ijar is not a worker, ... how is this related to workers? |
Dumping some notes, so that I don't forget:
One idea to "fix" this would be to force a GC run again after each unit of work in the JavaBuilder. This would also "solve" the recent memory leak / file handle leak issues reported by users, but comes at a performance cost. The correct solution would be to find where those file handles are being leaked and close them correctly, e.g. by always using try-with-resources. |
@cushon FYI. |
I'm not sure the file handles are leaked. It may be that they're intentionally kept open? |
@ulfjack The problem is, even if it is "intentional" from a Javac perspective (e.g. for caching purposes or something), it is very undesirable from our perspective, because worker processes should not keep visible state between units of work. It is fine if they cache things and still return correct results, but if they keep file handles open, blocking the deletion of input artifacts, we have a problem. Another issue with the file handle leaking is that we had to disable persistent workers in our Google-internal config on macOS, because JavaBuilder would crash all the time due to running out of file handles. |
The file ijar can't open is the output jar of a library. JavaBuilder only opens those files to write them, they should never be on the classpath (that's what ijars are for). It should be easy to make sure the output files get closed. I sent @philwo a CL to refactor things a bit, but I don't see anything that code is obviously doing wrong: |
To make it more obvious that the JarOutputStream is closed (see #2538). -- PiperOrigin-RevId: 148791125 MOS_MIGRATED_REVID=148791125
I think we have a fix for this now (dc857b3), but I haven't had the time to verify on Windows. I've checked an idle JavaBuilder using http://file-leak-detector.kohsuke.org/ and couldn't see leaked file handles anymore after the fix, so let's hope that this helped. |
@philwo : can we close this? |
AFAIK this was fixed and I haven't seen this occurring in a long time. |
Description of the problem / feature request / question:
Sometimes the persistent Java worker gets into a bad state where I can't build. I haven't found a reliable way to trigger this, and it doesn't always happen, but once it does, no amount of retrying the build helps and I need to kill the running worker in Task Manager.
Environment info
Operating System: Windows 10, MSYS2 20161025
Bazel version (output of
bazel info release
): dev version, but I've seen this weeks, maybe months ago alreadyThe text was updated successfully, but these errors were encountered: