Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: b49bfbc84045a2c858476223df8ea27b13f58e904f43196eb074dbdb6e0c42ff
Ticket: 270f78ca95b642fbed81ed03ad381d64a0d0f7df
file mkdir: race condition if two workers creates same directory and one worker deletes it immediately
User & Date: sebres on 2018-07-09 16:03:29
Changes

  1. icomment:
    Hmmm, you're right.
    
    Corresponding the code this can indeed happen, but this time as dual race condition:
    
    <table border=1>
    <tr><th>Worker 1</th><th>Worker 2</th><th>Worker 3</th></tr>
    <tr><td>Tcl_FSCreateDirectory (mkdir) succeeds</td><td>Tcl_FSCreateDirectory (mkdir) fails with EEXIST</td><td>-</td></tr>
    <tr><td>return TCL_OK</td><td>Tcl_FSStat and check is S_ISDIR</td><td><b>deleted the directory</b></td></tr>
    <tr><td>-</td><td><b>not exists, so return TCL_ERROR</b></td><td>-</td></tr>
    </table>
    This was introduced (even as race condition prevention;) in [./artifact?udc=1&ln=276-277&name=d0f1daac754e8554|d0f1daac754e8554].
    But ATM it produces another race condition (as worker 3 deletes the directory and worker 2 doing the stats check)...
    
    I'll fix it, thanks! WiP.
    
  2. login: "sebres"
  3. mimetype: "text/x-fossil-wiki"