Commit bd49aff
authored
Sample script to test replay concurrency safety (#101)
## Overview
Noticed some issues with our replay stop + download flow. Adding a
script to help with testing scenarios / repeatability.
I ran the docker container locally and then hit it directly. Even on
local we can reasonably repro the failures
## Testing
Ran locally and confirmed we can detect the failures. Example run:
```
Testing concurrent stop race condition
URL: http://localhost:444
Duration: 3s
Concurrency: 2
Iterations: 5
=== Iteration 1/5 (id=race-test-1764972766315168000-0) ===
Starting recording...
Recording for 3 seconds...
Calling stop 2 times concurrently...
Downloading recording...
Downloaded 36 bytes
Validating with ffprobe...
❌ FAILED: validation failed: ffprobe failed: exit status 1
Output: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x11f606420] moov atom not found
/var/folders/km/8rkz_b8s4dj0djvhk0p82bm80000gn/T/race-test-812359799.mp4: Invalid data found when processing input
{
}
=== Iteration 2/5 (id=race-test-1764972770128817000-1) ===
Starting recording...
Recording for 3 seconds...
Calling stop 2 times concurrently...
Downloading recording...
Downloaded 36 bytes
Validating with ffprobe...
❌ FAILED: validation failed: ffprobe failed: exit status 1
Output: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x150804820] moov atom not found
/var/folders/km/8rkz_b8s4dj0djvhk0p82bm80000gn/T/race-test-877575510.mp4: Invalid data found when processing input
{
}
=== Iteration 3/5 (id=race-test-1764972773977277000-2) ===
Starting recording...
Recording for 3 seconds...
Calling stop 2 times concurrently...
Downloading recording...
Downloaded 20968 bytes
Validating with ffprobe...
Video duration: 3.600000 seconds
Cleaning up...
✅ PASSED
=== Iteration 4/5 (id=race-test-1764972777850324000-3) ===
Starting recording...
Recording for 3 seconds...
Calling stop 2 times concurrently...
Downloading recording...
Downloaded 21007 bytes
Validating with ffprobe...
Video duration: 3.600000 seconds
Cleaning up...
✅ PASSED
=== Iteration 5/5 (id=race-test-1764972781717936000-4) ===
Starting recording...
Recording for 3 seconds...
Calling stop 2 times concurrently...
Downloading recording...
Downloaded 20978 bytes
Validating with ffprobe...
Video duration: 3.600000 seconds
Cleaning up...
✅ PASSED
=== RESULTS: 3 passed, 2 failed ===
```
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Introduce a Go script to test concurrent recording stop behavior, add
retry dependency, and ignore local recordings.
>
> - **Scripts/Tooling**:
> - Add `server/scripts/concurrent_stop_test/main.go` to reproduce and
validate concurrent recording `stop` behavior (start, concurrent stop
calls, retrying download, ffprobe validation, cleanup; configurable via
flags).
> - **Dependencies**:
> - Add `github.com/avast/retry-go/v5` (updated `go.mod`/`go.sum`).
> - **Repo**:
> - Ignore `recordings/` in `.gitignore`.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
7808c6c. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent 3dfcec2 commit bd49aff
File tree
4 files changed
+246
-0
lines changed- server
- scripts/concurrent_stop_test
4 files changed
+246
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
188 | 188 | | |
189 | 189 | | |
190 | 190 | | |
| 191 | + | |
| 192 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
| 5 | + | |
4 | 6 | | |
5 | 7 | | |
6 | 8 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
0 commit comments