fix: use atomic loads for clip state and buffer_size in engine_process_commands

Co-authored-by: aider (deepseek/deepseek-coder) <aider@aider.chat>
This commit is contained in:
Loic Coenen
2026-05-02 11:23:00 +00:00
parent b6cea54a89
commit 6ca2a4c01a
67 changed files with 198 additions and 4 deletions

47
err.log Normal file
View File

@@ -0,0 +1,47 @@
JACK Looper started
Client name: jack-looper
Control channel: 0
Sample rate: 48000 Hz
Press Ctrl+C to stop
[?1049h(B[?7h[?1h[?25l[?1000h                        [?7l [?7h(BJACK Looper - 8x8 Clip Grid(B  0  1 2 3 4 5 6 7 8 9 10 11 12 13 14 1516 17 18 19 20 21 22 2324 25 26 27 28 29 30 3132 33 34 35 36 37 38 3940 41 42 43 44 45 46 4748 49 50 51 52 53 54 5556 57 58 59 60 61 62 63 (B[?1000l[?12h[?25h
[?1049l
[?1l==================
WARNING: ThreadSanitizer: data race (pid=925560)
Write of size 1 at 0x55e2d55c4e20 by main thread:
#0 engine_stop_save_load_thread /home/jt/code/wheelie/engine.c:400 (jack-looper+0x4d6a) (BuildId: 1db9d60d6df5722c162e756ee0458e30040c8571)
#1 engine_stop /home/jt/code/wheelie/engine.c:1115 (jack-looper+0x9883) (BuildId: 1db9d60d6df5722c162e756ee0458e30040c8571)
#2 main /home/jt/code/wheelie/main.c:108 (jack-looper+0x2b6c) (BuildId: 1db9d60d6df5722c162e756ee0458e30040c8571)
Previous read of size 1 at 0x55e2d55c4e20 by thread T5:
#0 save_load_thread_func /home/jt/code/wheelie/engine.c:303 (jack-looper+0x4c43) (BuildId: 1db9d60d6df5722c162e756ee0458e30040c8571)
#1 <null> <null> (libtsan.so.2+0x541b9) (BuildId: f29521f558650bcc384c0178d8c6d0fd49466e29)
Location is global 'engine' of size 39432 at 0x55e2d55bb420 (jack-looper+0x24e20)
Thread T5 (tid=925567, running) created by main thread at:
#0 pthread_create <null> (libtsan.so.2+0x5fb47) (BuildId: f29521f558650bcc384c0178d8c6d0fd49466e29)
#1 engine_start_save_load_thread /home/jt/code/wheelie/engine.c:388 (jack-looper+0x4cff) (BuildId: 1db9d60d6df5722c162e756ee0458e30040c8571)
#2 engine_start /home/jt/code/wheelie/engine.c:1101 (jack-looper+0x979f) (BuildId: 1db9d60d6df5722c162e756ee0458e30040c8571)
#3 main /home/jt/code/wheelie/main.c:79 (jack-looper+0x2a25) (BuildId: 1db9d60d6df5722c162e756ee0458e30040c8571)
SUMMARY: ThreadSanitizer: data race /home/jt/code/wheelie/engine.c:400 in engine_stop_save_load_thread
==================
==================
WARNING: ThreadSanitizer: unlock of an unlocked mutex (or by a wrong thread) (pid=925560)
#0 pthread_mutex_unlock <null> (libtsan.so.2+0x5c2ec) (BuildId: f29521f558650bcc384c0178d8c6d0fd49466e29)
#1 <null> <null> (libpipewire-0.3.so.0+0xd250) (BuildId: 6c351c9a14f26a16201ad1530bbec8bc2bdf8106)
Location is heap block of size 1512 at 0x726800001200 allocated by main thread:
#0 calloc <null> (libtsan.so.2+0x9126c) (BuildId: f29521f558650bcc384c0178d8c6d0fd49466e29)
#1 <null> <null> (libpipewire-0.3.so.0+0x6bbef) (BuildId: 6c351c9a14f26a16201ad1530bbec8bc2bdf8106)
#2 main /home/jt/code/wheelie/main.c:67 (jack-looper+0x2999) (BuildId: 1db9d60d6df5722c162e756ee0458e30040c8571)
Mutex M0 (0x726800001710) created at:
#0 pthread_mutex_init <null> (libtsan.so.2+0x5e23a) (BuildId: f29521f558650bcc384c0178d8c6d0fd49466e29)
#1 <null> <null> (libspa-support.so+0x8bd0) (BuildId: 24a3df4fe9996f17f516f9dca3d5b18bfce2133f)
#2 main /home/jt/code/wheelie/main.c:67 (jack-looper+0x2999) (BuildId: 1db9d60d6df5722c162e756ee0458e30040c8571)
SUMMARY: ThreadSanitizer: unlock of an unlocked mutex (or by a wrong thread) (/usr/lib/libpipewire-0.3.so.0+0xd250) (BuildId: 6c351c9a14f26a16201ad1530bbec8bc2bdf8106)
==================