Commit c53f41e
committed
Avoid 'Text file busy' race when starting KafkaContainer
Fixes #11682.
The container's command waits for /tmp/testcontainers_start.sh to appear,
then exec's it. containerIsStarting writes the script via a single
Container Archive PUT. On busy hosts the directory entry becomes visible
before the docker engine has released the writer, and the immediate exec
fails with ETXTBSY (exit 126).
Switch to a two-file handshake: write the starter script first, then a
separate /tmp/testcontainers_start.ready marker. The wait loop polls the
marker instead of the script. By the time the second copyFileToContainer
returns, the script's writer is fully closed, so the subsequent exec is
safe. The marker file is never executed, so its own copy can race with
the directory listing harmlessly.1 parent 3878311 commit c53f41e
2 files changed
Lines changed: 9 additions & 1 deletion
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
75 | 81 | | |
76 | 82 | | |
77 | 83 | | |
| |||
Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
31 | | - | |
| 33 | + | |
32 | 34 | | |
33 | 35 | | |
34 | 36 | | |
| |||
0 commit comments