public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Andrew Fish" <afish@apple.com>
To: edk2-devel-groups-io <devel@edk2.groups.io>
Subject: How to debug a BaseTools build Python hang?
Date: Fri, 25 Jun 2021 13:05:03 -0700	[thread overview]
Message-ID: <17E30409-0F4C-49AA-B094-960F824FDE04@apple.com> (raw)

I’m hitting an issue with deadlocks on our fork of the edk2 build system. It only happens on our builders (30+ cores), and I can’t repo locally. We realized we had fixed the number of threads, and when we removed that from our build config we started seeing this issue. 

The build is deadlocking during the `…` so that implies during the autogen phase. I hooked up a signal handler so I could catch `kill != 9` and dump the Python threads. 
I see these threads:
MainThread:  seems stuck at the  self.AutoGenMgr.join() in StartAutoGen(). 
Thread-1: looks like a logging thread. 
Thread-2: looks like the thread printing …
2 x QueueFeederThread: I’m not sure if these are workers for Python or kicked off by the build? 

I’m looking for some advice on how to debug the deadlock. I’ve tried sampling via kill -2 etc. and my exception handler but I don’t seem to be able to see the work happening on Python threads….

Thread: QueueFeederThread(123145563672576)
  /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py:774 function __bootstrap
    self.__bootstrap_inner()
  /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py:801 function __bootstrap_inner
    self.run()
  /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py:754 function run
    self.__target(*self.__args, **self.__kwargs)
  /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/queues.py:252 function _feed
    nwait()
  /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py:340 function wait
    waiter.acquire()

Thread: Thread-2(123145555259392)
  /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py:774 function __bootstrap
    self.__bootstrap_inner()
  /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py:801 function __bootstrap_inner
    self.run()
  /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py:754 function run
    self.__target(*self.__args, **self.__kwargs)
 ./BaseTools/Source/Python/Common/Misc.py:907 function _ProgressThreadEntry
    time.sleep(self._CheckInterval)

Thread: MainThread(4614635008)
 ./BaseTools/Source/Python/build/build.py:2754 function <module>
    r = Main()
 ./BaseTools/Source/Python/build/build.py:2643 function Main
    MyBuild.Launch()
 ./BaseTools/Source/Python/build/build.py:2438 function Launch
    self._MultiThreadBuildPlatform()
 ./BaseTools/Source/Python/build/build.py:2246 function _MultiThreadBuildPlatform
    Wa, self.BuildModules = self.PerformAutoGen(BuildTarget,ToolChain)
 ./BaseTools/Source/Python/build/build.py:2185 function PerformAutoGen
    autogen_rt, errorcode = self.StartAutoGen(mqueue, Pa.DataPipe, self.SkipAutoGen, PcdMaList, cqueue)
 ./BaseTools/Source/Python/build/build.py:889 function StartAutoGen
    self.AutoGenMgr.join()
  /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py:940 function join
    self.__block.wait()
  /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py:340 function wait
    waiter.acquire()
 ./BaseTools/Source/Python/build/build.py:2737 function AppleDumpAllThreadStacks
    for filename, lineno, name, line in traceback.extract_stack(stack):

Thread: Thread-1(123145546846208)
  /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py:774 function __bootstrap
    self.__bootstrap_inner()
  /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py:801 function __bootstrap_inner
    self.run()
 ./BaseTools/Source/Python/AutoGen/AutoGenWorker.py:85 function run
    log_message = self.log_q.get()
  /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/queues.py:117 function get
    res = self._recv()

Thread: QueueFeederThread(123145551052800)
  /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py:774 function __bootstrap
    self.__bootstrap_inner()
  /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py:801 function __bootstrap_inner
    self.run()
  /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py:754 function run
    self.__target(*self.__args, **self.__kwargs)
  /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/queues.py:252 function _feed
    nwait()
  /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py:340 function wait
    waiter.acquire()

Thanks,

Andrew Fish


                 reply	other threads:[~2021-06-25 20:05 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=17E30409-0F4C-49AA-B094-960F824FDE04@apple.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox