You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Presently the only way to fix this is to clean the project and build again, but the plugin should detect this case as best it can and start the task over instead of waiting forever for the other process that originally started the work to finish it.
Several degrees of mitigation, with some assumptions:
The process that started the work should somehow mark that it is still running, for example by touching the cache entry directory every 1s or so. If another process detects that the directory is stale by some amount (5s, for example?) we could then assume it to have failed, try to delete it, and start again. Failure mode, on windows the other process might merely be stuck (gc, debugger, etc) and have locked some contents and prevent it from being deleted, the deleting process could either assume it is still being built, or just error out. This would need to be implemented as another thread in the scheduler watching one or more tasks as they work, touching the directories periodically.
Separately, a shutdown hook should be added as part of the scheduler, so that on shutdowns where work was in progress, that work should be stopped in some way, or have its output deleted to allow a later build to take over for it. This can also fail if that other process is still trying to finish its work, the shutdown hook can warn if delete fails and inform the user they may need to perform a clean.
Finally the DiskCache should detect a directory being deleted while running, and use that to signal that this process should attempt to own that task and start it, allowing one process to halt and another to pick up after it. In order to correctly handle the shutdown hook, it should be shut down before the BuildScheduler is stopped, so a process doesn't try to take over during its own shutdown.
Probably replace "shutdown hook" above with Closable.close() so that the services themselves don't watch for shutdown, but maven or whatever else is using the services can shut them down in the appropriate order. This order in turn should be documented.
The text was updated successfully, but these errors were encountered:
This pull request applies the three basic suggestions from #121, to
ensure that a stopping process will either clean up after itself, or
that other processes can detect a stale cache and cancel the work,
start over.
This doesn't go so far as to cancel in-progress work, to permit watch
mode to more quickly start a new build, but it should make this
easier to write.
Fixes#121
Presently the only way to fix this is to clean the project and build again, but the plugin should detect this case as best it can and start the task over instead of waiting forever for the other process that originally started the work to finish it.
Several degrees of mitigation, with some assumptions:
Probably replace "shutdown hook" above with Closable.close() so that the services themselves don't watch for shutdown, but maven or whatever else is using the services can shut them down in the appropriate order. This order in turn should be documented.
The text was updated successfully, but these errors were encountered: