1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-09 17:39:31 +00:00

bitbake: server/process: Disable gc around critical section

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.

(Bitbake rev: 96a6303949cefd469bcf5ed250ff512271354357)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie
2022-04-02 09:46:22 +01:00
parent 70d6360602
commit 496cbc01ca
+3
View File
@@ -28,6 +28,7 @@ import re
import datetime import datetime
import pickle import pickle
import traceback import traceback
import gc
import bb.server.xmlrpcserver import bb.server.xmlrpcserver
from bb import daemonize from bb import daemonize
from multiprocessing import queues from multiprocessing import queues
@@ -739,8 +740,10 @@ class ConnectionWriter(object):
self.event = self self.event = self
def _send(self, obj): def _send(self, obj):
gc.disable()
with self.wlock: with self.wlock:
self.writer.send_bytes(obj) self.writer.send_bytes(obj)
gc.enable()
def send(self, obj): def send(self, obj):
obj = multiprocessing.reduction.ForkingPickler.dumps(obj) obj = multiprocessing.reduction.ForkingPickler.dumps(obj)