Bug 5059

Summary: ERROR: PRservice 127.0.0.1:33824 not available
Product: [Build System, Metadata & Runtime] BitBake Reporter: Jonathan Liu <net147>
Component: bitbakeAssignee: Richard Purdie <richard.purdie>
Status: VERIFIED FIXED QA Contact:
Severity: critical    
Priority: Undecided CC: jason.wessel, poky.bs.watcher, poky.watcher, razvanx.ionescu
Version: 1.5   
Target Milestone: ---   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Jonathan Liu 2013-08-28 01:10:56 UTC
Doing a clean build (new build directory created) of an image for x86, I get the following:
NOTE: Started PRServer with DBfile: /home/user/git/poky/build/cache/prserv.sql
ite3, IP: 127.0.0.1, PORT: 33824, PID: 1702
ERROR: PRservice 127.0.0.1:33824 not available

Summary: There was 1 ERROR message shown, returning a non-zero exit code.
timed out


conf/local.conf contains the following relevant additional options:
BB_NUMBER_THREADS = "8"
PARALLEL_MAKE = "-j 8"
PRSERV_HOST = "localhost:0"

Using poky master 4fd453ef7cd2e7e2b1d72284440dac574603ed27.
Comment 1 Jonathan Liu 2013-08-28 01:35:33 UTC
I have git bisected the error to http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=da6260f95f4adcca22da9b0d5fb26e93c0a2517f:

commit da6260f95f4adcca22da9b0d5fb26e93c0a2517f
Author: Jason Wessel <jason.wessel@windriver.com>
Date:   Tue Aug 27 15:12:55 2013 -0500

    bitbake: serv.py: Fix hang when spawned dynamically with bitbake
Comment 2 Jason Wessel 2013-08-28 02:11:14 UTC
Is there any data in the cache/prserv.log?

If there is a traceback, that is the problem.
Comment 3 Jason Wessel 2013-08-28 02:14:37 UTC
diff --git a/lib/prserv/serv.py b/lib/prserv/serv.py
index 8a32122..2533782 100644
--- a/lib/prserv/serv.py
+++ b/lib/prserv/serv.py
@@ -146,7 +146,7 @@ class PRServer(SimpleXMLRPCServer):
         # Clear out all log handlers prior to the fork() to avoid calling
         # event handlers not part of the PRserver
         for logger_iter in logging.Logger.manager.loggerDict.keys():
-            logger_iter.handlers = []
+            logging.getLogger(logger_iter).handlers = []
 
         # Ensure logging makes it to the logfile
         streamhandler = logging.StreamHandler()
Comment 4 Jonathan Liu 2013-08-28 02:20:22 UTC
(In reply to comment #2)
> Is there any data in the cache/prserv.log?
> 
> If there is a traceback, that is the problem.

cache/prserve.log contains:
Process ProcessServer-1:
Traceback (most recent call last):
  File "/usr/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
    self.run()
  File "/home/user/git/poky/bitbake/lib/bb/server/process.py", line 96, in run
    bb.cooker.server_main(self.cooker, self.main)
  File "/home/user/git/poky/bitbake/lib/bb/cooker.py", line 1261, in server_main
    cooker.pre_serve()
  File "/home/user/git/poky/bitbake/lib/bb/cooker.py", line 1237, in pre_serve
    self.prhost = prserv.serv.auto_start(self.data)
  File "/home/user/git/poky/bitbake/lib/prserv/serv.py", line 296, in auto_start
    singleton.start()
  File "/home/user/git/poky/bitbake/lib/prserv/serv.py", line 178, in start
    self.prserv.start()
  File "/home/user/git/poky/bitbake/lib/prserv/serv.py", line 101, in start
    pid = self.daemonize()
  File "/home/user/git/poky/bitbake/lib/prserv/serv.py", line 149, in daemonize
    logger_iter.handlers = []
AttributeError: 'str' object has no attribute 'handlers'
Comment 5 Jonathan Liu 2013-08-28 02:21:29 UTC
(In reply to comment #3)
> diff --git a/lib/prserv/serv.py b/lib/prserv/serv.py
> index 8a32122..2533782 100644
> --- a/lib/prserv/serv.py
> +++ b/lib/prserv/serv.py
> @@ -146,7 +146,7 @@ class PRServer(SimpleXMLRPCServer):
>          # Clear out all log handlers prior to the fork() to avoid calling
>          # event handlers not part of the PRserver
>          for logger_iter in logging.Logger.manager.loggerDict.keys():
> -            logger_iter.handlers = []
> +            logging.getLogger(logger_iter).handlers = []
>  
>          # Ensure logging makes it to the logfile
>          streamhandler = logging.StreamHandler()

That patch fixes it.
Comment 7 Razvan Ionescu 2013-10-09 05:57:06 UTC
Verified with: poky:84708a45247fcdd08212b479a0b051281bd41204 .

I have run bitbake many times and each time a different port is open (e.g. localhost:51879, localhost:50064, localhost:50361), PRSERVICE being available everytime.