Commit 868c9e5
committed
fix: correct lock ordering in processMeshRequest to prevent deadlock
The previous lock ordering in processMeshRequest was:
epochLock -> sizeLock -> arenaLock
This conflicted with meshAllSizeClassesLocked (called via mallctl
mesh.compact with AllLocksGuard) which uses:
sizeLocks[0..N-1] -> arenaLock -> epochLock
This inconsistent ordering could cause deadlock:
- Thread A (mallctl): holds miniheapLocks, waits for epochLock
- Thread B (processMeshRequest): holds epochLock, waits for miniheapLock
Fix by reordering processMeshRequest to match the established order:
sizeLock -> arenaLock -> epochLock
Also moves drainPendingPartialLocked inside the epoch-locked section
to match the pattern in meshAllSizeClassesLocked.1 parent 9b13777 commit 868c9e5
1 file changed
+6
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
331 | 331 | | |
332 | 332 | | |
333 | 333 | | |
334 | | - | |
| 334 | + | |
| 335 | + | |
335 | 336 | | |
336 | | - | |
337 | | - | |
338 | 337 | | |
339 | 338 | | |
340 | 339 | | |
| |||
345 | 344 | | |
346 | 345 | | |
347 | 346 | | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
348 | 351 | | |
349 | 352 | | |
350 | 353 | | |
| |||
0 commit comments