Ran
|
Files
440
|
Run time
21s
|
Badge
Embed ▾
README BADGES
|
push
travis-ci-com
Fix logging deadlock when trace logging is used (#10635) ### Problem As described in https://github.com/pantsbuild/pants/issues/10617, there is a deadlock between the Python GIL and the mutex used to protect the Rust pantsd logger at https://github.com/pantsbuild/pants/blob/1e1190df5/src/rust/engine/logging/src/logger.rs#L202. The issue is that [a call to `nodes::Snapshot::lift_path_globs`](https://github.com/pantsbuild/pants/blob/3b8b09311/src/rust/engine/src/externs/interface.rs#L1312) may log in the call into the `globset` crate at the trace logging level. Combined with the facts that (1) log formatting also happens under that logging mutex and (2) structs from the `cpython` crate will call back into Python to be formatted, this means that code could attempt to take the GIL again unless the GIL were first dropped. This deadlocks with other code that have the logger mutex and want to take the GIL to format arguments in python. Unfortunately, the GIL is not dropped at that particular call site but is dropped immediately after that call site. ### Solution Move the assignment of `path_globs` inside the closure given to `py.allow_threads` so that the GIL is dropped. This should prevent the deadlock caused by logging from a third party crate that happens to be emitted during the call to `lift_path_globs`. ### Result No deadlock from this particular way of observing the deadlock.
0 of 29130 relevant lines covered (0.0%)
0.0 hits per line
Coverage | ∆ | File | Lines | Relevant | Covered | Missed | Hits/Line |
---|