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

View File

@@ -28,6 +28,7 @@ import re
import datetime
import pickle
import traceback
import gc
import bb.server.xmlrpcserver
from bb import daemonize
from multiprocessing import queues
@@ -739,8 +740,10 @@ class ConnectionWriter(object):
self.event = self
def _send(self, obj):
gc.disable()
with self.wlock:
self.writer.send_bytes(obj)
gc.enable()
def send(self, obj):
obj = multiprocessing.reduction.ForkingPickler.dumps(obj)