Skip to contentSkip to conversation

[1.46][PATCH] server/process: Disable gc around critical section

bitbake Steve Sakoman 1 participant 1 message Apr 18, 2022 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

From: Richard Purdie <[email protected]>

The python gc can trigger whilst we're holding the event stream lock and when cleaning up objects, they can trigger warnings. This translates into a new event which would then need the lock and we can deadlock.

Disable gc whilst we hold that lock to avoid this unfortunate and problematic situation.

(cherry picked from commit 96a6303949cefd469bcf5ed250ff512271354357)
---
 lib/bb/server/process.py | 3 +++
 1 file changed, 3 insertions(+)
lib/bb/server/process.py +3 -0
index 3c9ed706..4bdb84ae 100644
@@ -25,6 +25,7 @@ import subprocess
 import errno
 import re
 import datetime
+import gc
 import bb.server.xmlrpcserver
 from bb import daemonize
 from multiprocessing import queues
@@ -671,8 +672,10 @@ class ConnectionWriter(object):
 
     def send(self, obj):
         obj = multiprocessing.reduction.ForkingPickler.dumps(obj)
+        gc.disable()
         with self.wlock:
             self.writer.send_bytes(obj)
+        gc.enable()
 
     def fileno(self):
         return self.writer.fileno()
Signature · 1 line
2.25.1