Commit d01ff2a
committed
fix(tools): add thread-safe lock to MCPManager singleton
The MCPManager singleton uses __new__ without a mutex lock.
In a multi-threaded environment, two threads can simultaneously
evaluate 'cls._instance is None' before either creates the
instance, resulting in two instances being created and breaking
the singleton pattern.
Add threading.Lock() to ensure thread-safe singleton creation.
Fixes #8121 parent 31a4d36 commit d01ff2a
1 file changed
+4
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
33 | 34 | | |
34 | 35 | | |
35 | | - | |
36 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
37 | 39 | | |
38 | 40 | | |
39 | 41 | | |
| |||
0 commit comments