Bug 7965

Summary: localhostbecontroller needs to wait for ToasterUI, not for the server to start
Product: [Build System, Metadata & Runtime] Toaster Reporter: Alexandru Damian <alexandru.damian>
Component: toasterAssignee: Ed Bartosh <eduard.bartosh>
Status: VERIFIED FIXED QA Contact: Cristina Agurida <cristina-danielax.agurida>
Severity: major    
Priority: Medium+ CC: alexandru.c.georgescu, alexandru.damian, belen.barros.pena, cristiana.voicu, cristina-danielax.agurida, eduard.bartosh, jessica.zhang
Version: 1.9   
Target Milestone: 1.9 M2   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Alexandru Damian 2015-07-07 16:48:13 UTC
The patch:

bitbake: toaster: Fix build execution regression

bringing in

-                    if line.startswith("NOTE: ToasterUI waiting for events"):
+                    if line.startswith("Bitbake server started on demand"):

changes the logic for the build launcher from waiting for the ToasterUI to start (and the logging to happen in the database) to waiting for the server to start.

This can lead to a race condition and subtle errors in data logging.

I am not sure what was the bug that required this change, but this is not the right fix.

Please revert this patch, and apply a correct fix, after opening up a Bugzilla entry for the original bug.
Comment 1 Ed Bartosh 2015-07-08 15:43:41 UTC
It was quick bad straightforward fix for the recent master breakage.
The reason for it is that there was no message "NOTE: ToasterUI waiting for events" in the log.

I'll try to fix it properly.
Comment 2 Ed Bartosh 2015-07-09 13:18:14 UTC
I reproduced that issue after reverting my patch. Here is it:
2015-07-09 16:14:25,993 DEBUG localhostbecontroller: Waiting bitbake server to start
2015-07-09 16:14:26,510 DEBUG localhostbecontroller: Waiting bitbake server to start
2015-07-09 16:14:27,022 DEBUG localhostbecontroller: Waiting bitbake server to start
2015-07-09 16:14:27,529 DEBUG localhostbecontroller: Waiting bitbake server to start
2015-07-09 16:14:28,035 DEBUG localhostbecontroller: Waiting bitbake server to start
2015-07-09 16:14:28,539 DEBUG localhostbecontroller: Waiting bitbake server to start
2015-07-09 16:14:29,041 DEBUG localhostbecontroller: Waiting bitbake server to start
2015-07-09 16:14:29,574 DEBUG localhostbecontroller: Waiting bitbake server to start
2015-07-09 16:14:30,075 DEBUG localhostbecontroller: Waiting bitbake server to start
2015-07-09 16:14:30,578 DEBUG localhostbecontroller: Waiting bitbake server to start
Traceback (most recent call last):
  File "/home/ed/git/yocto/poky/bitbake/lib/toaster/bldcontrol/management/commands/runbuilds.py", line 59, in schedule
    bec.triggerBuild(br.brbitbake_set.all(), br.brlayer_set.all(), br.brvariable_set.all(), br.brtarget_set.all())
  File "/home/ed/git/yocto/poky/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py", line 329, in triggerBuild
    bbctrl = self.getBBController()
  File "/home/ed/git/yocto/poky/bitbake/lib/toaster/bldcontrol/bbcontroller.py", line 166, in getBBController
    self.startBBServer()
  File "/home/ed/git/yocto/poky/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py", line 158, in startBBServer
    raise BuildSetupException("localhostbecontroller: Bitbake server did not start in 5 seconds, aborting (Error: '%s' '%s')" % (toaster_ui_log, toaster_server_log))
BuildSetupException: localhostbecontroller: Bitbake server did not start in 5 seconds, aborting (Error: '

If you have any ideas how to fix this please let me know. I'll continue investigating it myself but it would be nice to have some hints anyway.
Comment 3 Ed Bartosh 2015-07-10 14:50:30 UTC
Submitted for review with couple of other changes: https://lists.yoctoproject.org/pipermail/toaster/2015-July/002307.html
Comment 5 Ed Bartosh 2015-07-28 16:01:13 UTC
Fix is now in ed/toaster/20150728:
https://lists.yoctoproject.org/pipermail/toaster/2015-July/002404.html

please, review and merge
Comment 6 Ed Bartosh 2015-08-03 09:06:08 UTC
The fix has been merged to upstream master: http://cgit.openembedded.org/bitbake/commit/?id=f1d8e0ff7233f17cff3a56db10d2443b392b407d
Comment 7 Cristina Agurida 2015-08-19 09:12:21 UTC
Verified on master: c75cefe8a382a63f625123c156137782db118f64