@@ -9,6 +9,11 @@ See the Spectator [documentation] for an overview of core concepts and details o
9
9
10
10
Supports Python >= 3.5, which is the oldest system Python 3 available on our commonly used OSes.
11
11
12
+ Note that there is a risk of deadlock if you are running Python 3.6 or lower and using
13
+ ` os.fork() ` or using a library that will fork the process
14
+ (see [ this section] ( #concurrent-usage-under-older-python ) for workarounds),
15
+ so ** we recommend using Python >= 3.7**
16
+
12
17
[ Spectator ] : https://github.com/Netflix/spectator/
13
18
[ documentation ] : https://netflix.github.io/atlas-docs/spectator/
14
19
[ usage ] : https://netflix.github.io/atlas-docs/spectator/lang/py/usage/
@@ -54,7 +59,9 @@ from spectator import GlobalRegistry
54
59
55
60
Once the ` GlobalRegistry ` is imported, it is used to create and manage Meters.
56
61
57
- ### Concurrent Usage
62
+ ### Concurrent Usage Under Older Python
63
+
64
+ > :warning : ** Use Python 3.7+ if possible** : But if you can't, here's a workaround to prevent deadlocks
58
65
59
66
There is a known issue in Python where forking a process after a thread is started can lead to
60
67
deadlocks. This is commonly seen when using the ` multiprocessing ` module with default settings.
@@ -84,6 +91,8 @@ WSGI_GUNICORN_PRELOAD = undef
84
91
85
92
#### Task Worker Forking
86
93
94
+ > :warning : ** Use Python 3.7+ if possible** : But if you can't, here's a workaround to prevent deadlocks
95
+
87
96
For other pre-fork worker processing frameworks, such as [ huey] , you need to be careful about how
88
97
and when you start the ` GlobalRegistry ` to avoid deadlocks in the background publish thread. You
89
98
should set the ` SPECTATOR_PY_DISABLE_AUTO_START_GLOBAL ` environment variable to disable automatic
@@ -120,6 +129,8 @@ workers, to help ensure that it is not started when the module is loaded.
120
129
121
130
#### Generic Multiprocessing
122
131
132
+ > :warning : ** Use Python 3.7+ if possible** : But if you can't, here's a workaround to prevent deadlocks
133
+
123
134
In Python 3, you can configure the start method to ` spawn ` for ` multiprocessing ` . This will cause
124
135
the module to do a ` fork() ` followed by an ` execve() ` to start a brand new Python process.
125
136
@@ -130,7 +141,7 @@ from multiprocessing import set_start_method
130
141
set_start_method(" spawn" )
131
142
```
132
143
133
- To configure thid option within a context:
144
+ To configure this option within a context:
134
145
135
146
``` python
136
147
from multiprocessing import get_context
0 commit comments