You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "ocadaruma (via GitHub)" <gi...@apache.org> on 2025/05/26 14:52:20 UTC
[PR] KAFKA-19334 MetadataShell execution unintentionally deletes lock file [kafka]
ocadaruma opened a new pull request, #19817:
URL: https://github.com/apache/kafka/pull/19817
## Summary
- MetadataShell may deletes lock file unintentionally when it exists or fails to acquire lock. If there's running server, this causes unexpected result as below:
* MetadataShell succeeds on 2nd run unexpectedly
* Even worse, LogManager/RaftManager's lock also no longer work from concurrent Kafka process startup
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-19334 MetadataShell execution unintentionally deletes lock file [kafka]
Posted by "frankvicky (via GitHub)" <gi...@apache.org>.
frankvicky merged PR #19817:
URL: https://github.com/apache/kafka/pull/19817
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-19334 MetadataShell execution unintentionally deletes lock file [kafka]
Posted by "frankvicky (via GitHub)" <gi...@apache.org>.
frankvicky commented on PR #19817:
URL: https://github.com/apache/kafka/pull/19817#issuecomment-2954625380
Cherry pick to 3.9 and 4.0 branches.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-19334 MetadataShell execution unintentionally deletes lock file [kafka]
Posted by "frankvicky (via GitHub)" <gi...@apache.org>.
frankvicky commented on PR #19817:
URL: https://github.com/apache/kafka/pull/19817#issuecomment-2954594512
I have merged it.
Feel free to raise issues if there are any.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-19334 MetadataShell execution unintentionally deletes lock file [kafka]
Posted by "FrankYang0529 (via GitHub)" <gi...@apache.org>.
FrankYang0529 commented on code in PR #19817:
URL: https://github.com/apache/kafka/pull/19817#discussion_r2173166538
##########
shell/src/main/java/org/apache/kafka/shell/MetadataShell.java:
##########
@@ -114,7 +114,7 @@ static FileLock takeDirectoryLock(File directory) throws IOException {
"directory before proceeding.");
}
} catch (Throwable e) {
- fileLock.destroy();
+ fileLock.unlockAndClose();
Review Comment:
IIUC, the MetadataShell only tries to do file lock when there is an `.lock` file. If there is a `.lock` file and the MetadataShell cannot acquire it, it means another process (probably server) holds it, so the MetadataShell cannot remove the file.
https://github.com/apache/kafka/blob/05b6e81688846f77927a853b1181d7ff295c2e23/shell/src/main/java/org/apache/kafka/shell/MetadataShell.java#L97-L103
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-19334 MetadataShell execution unintentionally deletes lock file [kafka]
Posted by "frankvicky (via GitHub)" <gi...@apache.org>.
frankvicky commented on PR #19817:
URL: https://github.com/apache/kafka/pull/19817#issuecomment-2911237948
@cmccabe: Could you please take a look when you have a free moment?
Thanks!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org