[oe-commits] [bitbake] branch master-next updated: bitbake: Extra server startup debugging

git at git.openembedded.org git at git.openembedded.org
Fri Nov 30 17:25:52 UTC 2018


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository bitbake.

The following commit(s) were added to refs/heads/master-next by this push:
     new 19eed50  bitbake: Extra server startup debugging
19eed50 is described below

commit 19eed50ecc54244199487365afe240ddf2575862
Author: Richard Purdie <richard.purdie at linuxfoundation.org>
AuthorDate: Fri Nov 30 17:02:02 2018 +0000

    bitbake: Extra server startup debugging
    
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 lib/bb/daemonize.py      | 12 ++++++++++++
 lib/bb/server/process.py | 24 ++++++++++++++++++++++--
 2 files changed, 34 insertions(+), 2 deletions(-)

diff --git a/lib/bb/daemonize.py b/lib/bb/daemonize.py
index c937675..cae7a42 100644
--- a/lib/bb/daemonize.py
+++ b/lib/bb/daemonize.py
@@ -68,6 +68,9 @@ def createDaemon(function, logfile):
     with open('/dev/null', 'r') as si:
         os.dup2(si.fileno(), sys.stdin.fileno())
 
+    with open(logfile + "A", 'a+') as f:
+        f.write("Here D\n")
+
     try:
         so = open(logfile, 'a+')
         os.dup2(so.fileno(), sys.stdout.fileno())
@@ -79,11 +82,20 @@ def createDaemon(function, logfile):
     # and there aren't two seperate buffers
     sys.stderr = sys.stdout
 
+    with open(logfile + "A", 'a+') as f:
+        f.write("Here E\n")
+
     try:
         function()
     except Exception as e:
+        with open(logfile + "A", 'a+') as f:
+            f.write("Here F %s\n" % str(e))
+
         traceback.print_exc()
     finally:
+        with open(logfile + "A", 'a+') as f:
+            f.write("Here G\n")
+
         bb.event.print_ui_queue()
         # os._exit() doesn't flush open files like os.exit() does. Manually flush
         # stdout and stderr so that any logging output will be seen, particularly
diff --git a/lib/bb/server/process.py b/lib/bb/server/process.py
index fd1ba47..7489084 100644
--- a/lib/bb/server/process.py
+++ b/lib/bb/server/process.py
@@ -381,6 +381,7 @@ class BitBakeServer(object):
 
         # Place the log in the builddirectory alongside the lock file
         logfile = os.path.join(os.path.dirname(self.bitbake_lock.name), "bitbake-cookerdaemon.log")
+        self.logfile = logfile
 
         self.sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
         # AF_UNIX has path length issues so chdir here to workaround
@@ -394,13 +395,21 @@ class BitBakeServer(object):
 
         os.set_inheritable(self.sock.fileno(), True)
         startdatetime = datetime.datetime.now()
+        with open(logfile + "A", 'a+') as f:
+            f.write("Here A\n")
         bb.daemonize.createDaemon(self._startServer, logfile)
+        with open(logfile + "A", 'a+') as f:
+            f.write("Here B\n")
         self.sock.close()
         self.bitbake_lock.close()
         os.close(self.readypipein)
 
         ready = ConnectionReader(self.readypipe)
-        r = ready.poll(30)
+        r = ready.poll(5)
+        r = False
+        if not r:
+            bb.note("Bitbake server didn't start within 5 seconds, waiting for 30")
+            r = ready.poll(30)
         if r:
             try:
                 r = ready.get()
@@ -438,12 +447,23 @@ class BitBakeServer(object):
                         bb.error("Server didn't start, last 60 loglines (%s):\n%s" % (logfile, "".join(lastlines)))
             else:
                 bb.error("%s doesn't exist" % logfile)
-
+            if os.path.exists(logfile + "A"):
+                lastlines = []
+                with open(logfile + "A", "r") as f:
+                    for line in f:
+                        lastlines.append(line)
+                        if len(lastlines) > 60:
+                            lastlines = lastlines[-60:]
+                if lastlines:
+                        bb.error("Second log, last 60 loglines (%s):\n%s" % (logfile + "A", "".join(lastlines)))
             raise SystemExit(1)
 
         ready.close()
 
     def _startServer(self):
+        with open(self.logfile + "A", 'a+') as f:
+            f.write("Here H\n")
+
         print(self.start_log_format % (os.getpid(), datetime.datetime.now().strftime(self.start_log_datetime_format)))
         server = ProcessServer(self.bitbake_lock, self.sock, self.sockname)
         self.configuration.setServerRegIdleCallback(server.register_idle_function)

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list