sarkaramrit1993 opened a new pull request, #5065:
URL: https://github.com/apache/solr/pull/5065

   https://issues.apache.org/jira/browse/SOLR-18010
   
   Creating a role with permissions in the Admin UI sends one request per 
permission, all at the same time. In standalone mode each request reads 
security.json, changes it and writes it back, and nothing stops two of them 
from doing that at once. SolrCloud doesn't have this problem because ZooKeeper 
rejects a write made from an old copy.
   
   So one change gets lost, and when two writes overlap the file ends up with 
leftover text after the JSON. From then on the security API calls fail with 
"Failed opening existing security.json file", and after a restart Solr won't 
start at all.
   
   Changes:
   - In standalone mode, requests to the security API now run one at a time. 
Reads wait too, so they never see a half-written file.
   
   Not changed:
   - The file is still written the same way. I tried writing to a temp file and 
renaming it over security.json, but that changes the file's permissions, 
replaces a symlinked security.json instead of updating it, and fails when the 
Solr home folder is read-only or security.json is mounted into Docker on its 
own. Running the requests one at a time is enough to fix this bug. Happy to 
open a separate issue for making the write crash-safe.
   - The UI still sends its requests all at once. That's fine now.
   
   Tests: new testConcurrentEdits in BasicAuthStandaloneTest sends 20 edits at 
once. It fails on main with an HTTP 500 from the broken file. I also ran the 
handler.admin and security tests, the basic_auth and security_manager BATS 
tests, and created a role in the browser on a dev build.
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to