Commit 49e1978
authored
[server][dvc] Fix use-after-free in RMD block cache metrics callbacks (linkedin#2742)
Fix JVM SIGSEGV crashes caused by RMD block cache async gauge callbacks
dereferencing a freed RocksDB Cache JNI handle after factory shutdown. The
callbacks previously captured `rmdCache` directly and could still run on OTel
or Tehuti collection threads after native cache memory had already been freed.
Store the cache in a volatile field and have callbacks read it into a local
variable before the null check and JNI call. Also null the reference in
`closeRMDBlockCache()` and invoke it from
`RocksDBStorageEngineFactory.close()` before `sharedRMDCache.close()`, so
metrics callbacks observe null before native memory is released.1 parent 9ac8c24 commit 49e1978
2 files changed
Lines changed: 34 additions & 2 deletions
File tree
- clients/da-vinci-client/src/main/java/com/linkedin/davinci
- stats
- store/rocksdb
Lines changed: 29 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
192 | 200 | | |
193 | 201 | | |
194 | 202 | | |
195 | 203 | | |
196 | 204 | | |
| 205 | + | |
197 | 206 | | |
198 | 207 | | |
199 | 208 | | |
200 | 209 | | |
201 | 210 | | |
202 | 211 | | |
203 | 212 | | |
204 | | - | |
| 213 | + | |
205 | 214 | | |
206 | 215 | | |
207 | 216 | | |
208 | | - | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
209 | 236 | | |
210 | 237 | | |
211 | 238 | | |
| |||
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
303 | 303 | | |
304 | 304 | | |
305 | 305 | | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
306 | 311 | | |
307 | 312 | | |
308 | 313 | | |
| |||
0 commit comments