You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by GitBox <gi...@apache.org> on 2020/01/21 18:06:41 UTC

[GitHub] [trafficcontrol] rob05c opened a new issue #4311: Fix ORT to atomically place files.

rob05c opened a new issue #4311: Fix ORT to atomically place files.
URL: https://github.com/apache/trafficcontrol/issues/4311
 
 
   ## I'm submitting a ...
   <!-- (check all that apply with "[x]") -->
   <!--- security vulnerability (STOP!! - see above)-->
   - [x] bug report
   - [ ] new feature / enhancement request
   - [ ] improvement request (usability, performance, tech debt, etc.)
   - [ ] other <!--(Please do not submit support requests here - see above)-->
   
   ## Traffic Control components affected ...
   <!-- (check all that apply with "[x]") -->
   - [ ] CDN in a Box
   - [ ] Documentation
   - [ ] Grove
   - [ ] Traffic Control Client
   - [ ] Traffic Monitor
   - [ ] Traffic Ops
   - [x] Traffic Ops ORT
   - [ ] Traffic Portal
   - [ ] Traffic Router
   - [ ] Traffic Stats
   - [ ] Traffic Vault
   - [ ] unknown
   
   ## Current behavior:
   ORT does not atomically place new files. It uses `cp`, which is not atomic. 
   
   This means if somethings fails – Perl crashes, the OS crashes, the syscall fails for some reason – the file will be half-written, causing ATS reloading to fail.
   
   ## Expected / new behavior:
   The proper procedure is to make a new temporary file, and then call `mv`, which is guaranteed to be atomic, and either succeed or fail.
   
   Code is here:
   
   https://github.com/apache/trafficcontrol/blob/master/traffic_ops/ort/traffic_ops_ort.pl#L1575
   
   ## Minimal reproduction of the problem with instructions:
   
   Difficult to reproduce. You'd have to run ORT and kill the Perl when it was in the middle of a file write. But it would definitely happen. And then your ATS reload or restart would fail.
   
   ## Anything else:
   
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [trafficcontrol] rob05c commented on issue #4311: Fix ORT to atomically place files.

Posted by GitBox <gi...@apache.org>.
rob05c commented on issue #4311: Fix ORT to atomically place files.
URL: https://github.com/apache/trafficcontrol/issues/4311#issuecomment-577309029
 
 
   Also: it's common practice to run the OS temp directory on a different filesystem for security reasons, which will cause `mv` to be non-atomic as it then has to actually copy bytes.
   
   Therefore, the temporary file should be in the same directory as the real file, to ensure it's on the same filesystem.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services