You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by tv...@apache.org on 2021/03/20 13:42:13 UTC

[buildstream] branch tristan/fix-concurrent-blocking-activity created (now 0e4107b)

This is an automated email from the ASF dual-hosted git repository.

tvb pushed a change to branch tristan/fix-concurrent-blocking-activity
in repository https://gitbox.apache.org/repos/asf/buildstream.git.


      at 0e4107b  plugin.py: Avoid import errors on certain platforms

This branch includes the following new commits:

     new 0e4107b  plugin.py: Avoid import errors on certain platforms

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


[buildstream] 01/01: plugin.py: Avoid import errors on certain platforms

Posted by tv...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tvb pushed a commit to branch tristan/fix-concurrent-blocking-activity
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 0e4107bbf81a269fb03ec597085d058088065899
Author: Tristan van Berkom <tr...@codethink.co.uk>
AuthorDate: Sat Mar 20 22:40:12 2021 +0900

    plugin.py: Avoid import errors on certain platforms
    
    In some cases (on Debian with python 3.9 it has been seen) when multiple
    threads enter the Plugin.blocking_activity() context manager simultaneously,
    we get ImportErrors from the multiprocessing submodules complaining that
    we are importing symbols from partially initialized submodules (hinting at
    possible circular imports).
    
    Ensuring that these submodules have been initialized up front circumvents
    these edge case stack trace bugs from occurring.
---
 src/buildstream/plugin.py | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/buildstream/plugin.py b/src/buildstream/plugin.py
index f980056..6b3a9f9 100644
--- a/src/buildstream/plugin.py
+++ b/src/buildstream/plugin.py
@@ -110,7 +110,21 @@ Class Reference
 """
 
 import itertools
+
+#
+# In some cases (on Debian with python 3.9 it has been seen) when multiple threads
+# enter the Plugin.blocking_activity() context manager simultaneously, we get ImportErrors
+# from the multiprocessing submodules complaining that we are importing symbols from
+# partially initialized submodules (hinting at possible circular imports).
+#
+# Ensuring that these submodules have been initialized up front circumvents these edge
+# case stack trace bugs from occurring.
+#
 import multiprocessing
+import multiprocessing.queues
+import multiprocessing.synchronize
+import multiprocessing.popen_forkserver
+
 import os
 import pickle
 import queue