Skip to content

Commit 2855013

Browse files
authored
feat(python): Add troubleshooting for multiprocessing deprecation (#12354)
1 parent d9a2f4a commit 2855013

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

docs/platforms/python/troubleshooting.mdx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,3 +136,27 @@ sentry_sdk.init(
136136

137137
If you need more fine-grained control over the behavior of the socket, check out
138138
<PlatformLink to="/configuration/options/#socket-options">socket-options</PlatformLink>.
139+
140+
## Multiprocessing deprecation after Python 3.12
141+
142+
If you're on Python version 3.12 or greater, you might see the following deprecation warning on Linux environments since the SDK spawns several threads.
143+
144+
```
145+
DeprecationWarning: This process is multi-threaded, use of fork() may lead to deadlocks in the child.
146+
```
147+
148+
To remove this deprecation warning, set the [multiprocessing start method to `spawn` or `forkserver`](https://docs.python.org/3.14/library/multiprocessing.html#contexts-and-start-methods).
149+
Remember to do this only in the `__main__` block.
150+
151+
```python
152+
import sentry_sdk
153+
import multiprocessing
154+
import concurrent.futures
155+
156+
sentry_sdk.init()
157+
158+
if __name__ == "__main__":
159+
multiprocessing.set_start_method("spawn")
160+
pool = concurrent.futures.ProcessPoolExecutor()
161+
pool.submit(sentry_sdk.capture_message, "world")
162+
```

0 commit comments

Comments
 (0)