Commit 05ade5d
Atomic lib replacement in update script to prevent mmap corruption
The update script uses cp -a to overwrite shared ORT libraries while the
running capsper process has them mmap'd. On Linux, cp truncates and
rewrites the same inode, corrupting the running process's memory-mapped
pages. This caused segfaults at garbage addresses (e.g. 0x2a0b40 — a
corrupted ORT API function pointer) after the daily update timer staged
a new release with updated deps.
Fix: write .so files to a temp name in the same directory, then mv
(rename). The rename is atomic on the same filesystem and creates a new
inode, so the running process keeps reading from the old one.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 0447972 commit 05ade5d
1 file changed
Lines changed: 22 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
21 | 35 | | |
22 | 36 | | |
23 | 37 | | |
| |||
72 | 86 | | |
73 | 87 | | |
74 | 88 | | |
75 | | - | |
| 89 | + | |
76 | 90 | | |
77 | 91 | | |
78 | 92 | | |
| |||
110 | 124 | | |
111 | 125 | | |
112 | 126 | | |
113 | | - | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
114 | 134 | | |
115 | 135 | | |
116 | 136 | | |
| |||
0 commit comments