You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by "sahvx655-wq (via GitHub)" <gi...@apache.org> on 2026/05/29 05:42:22 UTC

[PR] Fix race condition in MemoryUserDatabase.save() by extending lock scope [tomcat]

sahvx655-wq opened a new pull request, #1014:
URL: https://github.com/apache/tomcat/pull/1014

   This PR fixes a concurrency issue in MemoryUserDatabase.save() where file rename operations were performed after releasing the writeLock.
   
   Under concurrent save requests, multiple threads could interfere with the same .new and .old files, leading to IOExceptions or inconsistent tomcat-users.xml state.
   
   This change extends the writeLock scope to cover the complete file replacement workflow, ensuring the save operation remains atomic.
   
   Changes
   Hold writeLock until all rename operations complete
   Move backup/rename logic inside the protected section
   Add TestMemoryUserDatabaseConcurrency.java regression test


-- 
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: dev-unsubscribe@tomcat.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: [PR] Fix race condition in MemoryUserDatabase.save() by extending lock scope [tomcat]

Posted by "sahvx655-wq (via GitHub)" <gi...@apache.org>.
sahvx655-wq commented on PR #1014:
URL: https://github.com/apache/tomcat/pull/1014#issuecomment-4750409247

   Apologies for the delay and for the issues in the original submission. Thank you for taking the time to review it. If you are open to it, I would like to work on a corrected version and submit a new PR


-- 
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: dev-unsubscribe@tomcat.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: [PR] Fix race condition in MemoryUserDatabase.save() by extending lock scope [tomcat]

Posted by "markt-asf (via GitHub)" <gi...@apache.org>.
markt-asf commented on PR #1014:
URL: https://github.com/apache/tomcat/pull/1014#issuecomment-4727161594

   No response for two weeks. Simple fix applied.


-- 
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: dev-unsubscribe@tomcat.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: [PR] Fix race condition in MemoryUserDatabase.save() by extending lock scope [tomcat]

Posted by "markt-asf (via GitHub)" <gi...@apache.org>.
markt-asf commented on PR #1014:
URL: https://github.com/apache/tomcat/pull/1014#issuecomment-4750577001

   No objections.


-- 
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: dev-unsubscribe@tomcat.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: [PR] Fix race condition in MemoryUserDatabase.save() by extending lock scope [tomcat]

Posted by "markt-asf (via GitHub)" <gi...@apache.org>.
markt-asf closed pull request #1014: Fix race condition in MemoryUserDatabase.save() by extending lock scope
URL: https://github.com/apache/tomcat/pull/1014


-- 
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: dev-unsubscribe@tomcat.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org