-
-
Notifications
You must be signed in to change notification settings - Fork 287
Description
ScalacWorker is not releasing all the file handles (i.e. for the jar files) after it is done with a job. Happening in rules_scala 5.0.0 as well as latest master code.
One error caused by this happens when editing code that causes an ijar to change. The ijar file handle is still open in the ScalacWorker from a previous compile, and the JavaIjar action cannot write to it and gives error:
ERROR: ... Extracting interface for jar xxxx.jar failed: failed to delete output files before executing action
I can see that the xxx-ijar.jar file (among many other jar files) is still open by the ScalacWorker process. Calling bazel shutdown will solve the problem since it closes the ScalacWorker processes which in turn closes the file handles.
I am kind of surprised this hasn’t come up before, but it is pretty annoying when compiling after code edits. Note I am using Windows, so there’s a chance this only causes the error on windows but not linux.
I didn’t see too much wrong with the ScalacWorker code, so I suspect it is either the ScalacWorker is not closing the scalac objects correctly at the end of the job, OR there is a bug in the scalac code itself. Someone smarter than me probably should investigate further.
I would categorize this issue as critical, since it is causing unnecessary errors and it is nearly unusable when editing code.