-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Fixes Resolver delete race against file resolve #3581
Conversation
Signed-off-by: Paulo Lopes <[email protected]>
Signed-off-by: Paulo Lopes <[email protected]>
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.
LGTM
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.
a couple of changes.
Signed-off-by: Paulo Lopes <[email protected]>
I've applied the "fixes" from the comments and added a few extra checks:
All validation tests pass on my side + the issue that was used to identify the problem (vertx-web tests) also pass on my side (no leaks of caches to the CWD or TMP. |
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.
some changes
Signed-off-by: Paulo Lopes <[email protected]>
All changes added. |
Signed-off-by: Paulo Lopes <[email protected]>
Signed-off-by: Paulo Lopes [email protected]
Motivation:
Cleaning the FileSystem cache happens usually on a shutdown thread, outside the resolver monitor. It also changes the resolver state to set the cache dir object to null.
This has a couple of side effects:
cacheDir
object isnull
which will lead to resolved file to be written to the${user.dir}
.cacheDir
shared the same directory for all instances (by default) a clear for instance A will wipe the cache for instance BThe last item was also reported by #3510
This PR addresses the issue in the following way:
cacheDir
isfinal
and computed at<ctor>
time.clearCache
will be synchronized on theresolver
iif the iscacheDir
The last item only addresses the uniqueness and independence of caches not the full discussion on #3510 . As a note the mentioned issue warns about potential collisions, however wikipedia tells us that the change of a collision is 1 in a billion: https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_4_(random) . Given that most
unices
can handle a few million processes:I'm not attempting to change the current use of UUIDs + on regular operations caches are deleted on VM shutdown, which means the probability will be even smaller.