Bug 10826

Summary: selftest: tests that use runqemu fail on GDC Autobuilders
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Jose Perez C <jose.perez.carranza>
Component: devtools / tool chainAssignee: Aníbal Limón <anibal.limon>
Status: VERIFIED FIXED QA Contact: Benjamin Esquivel <benjamin.esquivel>
Severity: normal    
Priority: High CC: benjamin.esquivel, leonardo.sandoval.gonzalez, meta.mr.watcher, meta.watcher, monserratx.sedeno.bustos, randy.macleod, richard.purdie
Version: 2.3   
Target Milestone: 2.3 M2   
Hardware: x86   
OS: Multiple   
See Also: https://bugzilla.yoctoproject.org/show_bug.cgi?id=10162
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)
Bug Depends on: 10866, 10873    
Bug Blocks:    
Attachments:
Description Flags
selftest failure
none
log of failure in master
none
log of working correctly on morty
none
log excluding test case previously failed
none
Log of failure present when running without test cases using runqemu
none
verification that selftest finishes execution on today's master none

Description Jose Perez C 2016-12-19 22:48:47 UTC
Created attachment 3565 [details]
selftest failure

STEPS TO REPRODUCE: 

1 Clone poky 
2 source environment
3 oe-selftest --run-all 


EXPECTED OUTCOME: 
  All tests cases should be executed correctly 

ACTUAL OUTCOME 
  devtool_deploy_target test case is failing due a timeout and making the rest of the suite fail.


Full log attached

Note: This was only observed at GDC autobuilders 

---------------------------------------------------------------

======================================================================
ERROR [145.536s]: test_devtool_deploy_target (oeqa.selftest.devtool.DevtoolTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/ab/autobuilder/yocto-worker/nightly-oe-selftest-fedora24/build/bitbake/lib/bb/main.py", line 520, in setup_bitbake
    server_connection = server.establishConnection(featureset)
  File "/home/ab/autobuilder/yocto-worker/nightly-oe-selftest-fedora24/build/bitbake/lib/bb/server/process.py", line 287, in establishConnection
    _, error = self.connection.connection.runCommand(["setFeatures", featureset])
  File "/home/ab/autobuilder/yocto-worker/nightly-oe-selftest-fedora24/build/bitbake/lib/bb/server/process.py", line 61, in runCommand
    bb.fatal("Gave up; Too many tries: timeout while attempting to communicate with bitbake server")
  File "/home/ab/autobuilder/yocto-worker/nightly-oe-selftest-fedora24/build/bitbake/lib/bb/__init__.py", line 104, in fatal
    raise BBHandledException()
bb.BBHandledException
Comment 1 Jose Perez C 2016-12-21 14:04:51 UTC
Below warning is displayed before the test are executed, seems like this is why the test is failing 

2016-12-20 18:57:44,460 - selftest.base - WARNING - tearDown commands have failed: bitbake-layers remove-layer */workspace
Comment 2 Paul Eggleton 2016-12-21 19:00:25 UTC
It's more likely that the teardown commands fail because of the error within the test rather than causing it.
Comment 3 Jose Perez C 2016-12-22 17:06:12 UTC
Created attachment 3573 [details]
log of failure in master
Comment 4 Jose Perez C 2016-12-22 17:06:50 UTC
Created attachment 3574 [details]
log of working correctly on morty
Comment 5 Jose Perez C 2016-12-22 17:06:59 UTC
Some additional information:

- I executed devtool module manually on my local machine debain 8 and in a remote server OpenSuse421 and was working correctly 
- When executing devtool module on buildslaves of GDC ABs are working correctly 
- When executing buildset "nightly-oe-selftest" on morty branch on GDC AB is working (commit 7c3a47ed8965c3a3eb90a9a4678d5caedbba6337)
Comment 6 Benjamin Esquivel 2016-12-22 17:54:24 UTC
I have suggested José to run a branch with all the tests but the first one that fails to try to see if this is a one-test that breaks up the rest of the execution.
Comment 7 Jose Perez C 2016-12-22 21:42:26 UTC
I tested a branch excluding "devtool_deploy_target" and the ERROR appears in another test case this was "test_all_users_can_connect_via_ssh_without_password" log is attached.
Comment 8 Jose Perez C 2016-12-22 22:33:57 UTC
Created attachment 3576 [details]
log excluding test case previously failed
Comment 9 Benjamin Esquivel 2016-12-23 17:17:23 UTC
I tried to reproduce this error in my setup and I was not able to see it. I'm looping the tests to see if I get the error later.
Comment 10 Jose Perez C 2016-12-23 20:27:34 UTC
I tested a branch without test that are calling "runqemu" and see the failure again but now in a testcase of tinfoil "test_expand (oeqa.selftest.tinfoil.TinfoilTests)" log attached
Comment 11 Jose Perez C 2016-12-23 20:30:21 UTC
Created attachment 3577 [details]
Log of failure present when running without test cases using runqemu
Comment 12 Leonardo Sandoval Gonzalez 2016-12-28 01:47:20 UTC
On a manual run, I got the following failures & errors. Nothing conclusive yet.

lsandov1@yctb05:~/high/10826> egrep 'FAIL \( |ERROR \(' manual-oe-selftest-ubuntu1404
2016-12-27 07:55:49 -   test_expand (oeqa.selftest.tinfoil.TinfoilTests) ... ERROR (20.541s)
2016-12-27 07:56:09 -   test_getvar (oeqa.selftest.tinfoil.TinfoilTests) ... ERROR (0.230s)
2016-12-27 07:56:10 -   test_getvar_bb_origenv (oeqa.selftest.tinfoil.TinfoilTests) ... ERROR (0.244s)
2016-12-27 07:56:10 -   test_list_recipes (oeqa.selftest.tinfoil.TinfoilTests) ... ERROR (0.190s)
2016-12-27 07:56:10 -   test_parse_recipe (oeqa.selftest.tinfoil.TinfoilTests) ... ERROR (0.188s)
2016-12-27 07:56:10 -   test_parse_recipe_copy_expand (oeqa.selftest.tinfoil.TinfoilTests) ... ERROR (0.248s)
2016-12-27 07:56:10 -   test_parse_recipe_initial_datastore (oeqa.selftest.tinfoil.TinfoilTests) ... ERROR (0.188s)
2016-12-27 07:56:11 -   test_setvariable_clean (oeqa.selftest.tinfoil.TinfoilTests) ... ERROR (0.260s)
2016-12-27 07:56:11 -   test_wait_event (oeqa.selftest.tinfoil.TinfoilTests) ... ERROR (0.182s)
lsandov1@yctb05:~/high/10826> egrep 'FAIL \(|ERROR \(' manual-oe-selftest-ubuntu1404
2016-12-27 05:22:11 -   test_devtool_add_fetch_git (oeqa.selftest.devtool.DevtoolTests) ... FAIL (11.034s)
2016-12-27 05:23:00 -   test_devtool_add_library (oeqa.selftest.devtool.DevtoolTests) ... FAIL (6.005s)
2016-12-27 05:47:52 -   test_devtool_upgrade_git (oeqa.selftest.devtool.DevtoolTests) ... FAIL (21.101s)
2016-12-27 06:36:21 -   test_recipetool_load_plugin (oeqa.selftest.recipetool.RecipetoolTests) ... FAIL (18.475s)
2016-12-27 07:55:49 -   test_expand (oeqa.selftest.tinfoil.TinfoilTests) ... ERROR (20.541s)
2016-12-27 07:56:09 -   test_getvar (oeqa.selftest.tinfoil.TinfoilTests) ... ERROR (0.230s)
2016-12-27 07:56:10 -   test_getvar_bb_origenv (oeqa.selftest.tinfoil.TinfoilTests) ... ERROR (0.244s)
2016-12-27 07:56:10 -   test_list_recipes (oeqa.selftest.tinfoil.TinfoilTests) ... ERROR (0.190s)
2016-12-27 07:56:10 -   test_parse_recipe (oeqa.selftest.tinfoil.TinfoilTests) ... ERROR (0.188s)
2016-12-27 07:56:10 -   test_parse_recipe_copy_expand (oeqa.selftest.tinfoil.TinfoilTests) ... ERROR (0.248s)
2016-12-27 07:56:10 -   test_parse_recipe_initial_datastore (oeqa.selftest.tinfoil.TinfoilTests) ... ERROR (0.188s)
2016-12-27 07:56:11 -   test_setvariable_clean (oeqa.selftest.tinfoil.TinfoilTests) ... ERROR (0.260s)
2016-12-27 07:56:11 -   test_wait_event (oeqa.selftest.tinfoil.TinfoilTests) ... ERROR (0.182s)
2016-12-27 07:56:11 -   test_bmap (oeqa.selftest.wic.Wic) ... FAIL (1.893s)
2016-12-27 07:56:13 -   test_build_artifacts (oeqa.selftest.wic.Wic) ... FAIL (0.896s)
2016-12-27 07:56:14 -   test_build_image_name (oeqa.selftest.wic.Wic) ... FAIL (1.201s)
2016-12-27 07:56:15 -   test_compress_bzip2 (oeqa.selftest.wic.Wic) ... FAIL (1.215s)
2016-12-27 07:56:16 -   test_compress_gzip (oeqa.selftest.wic.Wic) ... FAIL (1.217s)
2016-12-27 07:56:18 -   test_compress_xz (oeqa.selftest.wic.Wic) ... FAIL (1.156s)
2016-12-27 07:56:19 -   test_createhelp (oeqa.selftest.wic.Wic) ... FAIL (1.380s)
2016-12-27 07:56:20 -   test_directdisk_bootloader_config (oeqa.selftest.wic.Wic) ... FAIL (1.236s)
2016-12-27 07:56:21 -   test_gpt_image (oeqa.selftest.wic.Wic) ... FAIL (1.327s)
2016-12-27 07:56:23 -   test_help (oeqa.selftest.wic.Wic) ... FAIL (1.033s)
2016-12-27 07:56:24 -   test_help_kickstart (oeqa.selftest.wic.Wic) ... FAIL (1.211s)
2016-12-27 07:56:25 -   test_help_overview (oeqa.selftest.wic.Wic) ... FAIL (1.187s)
2016-12-27 07:56:26 -   test_help_plugins (oeqa.selftest.wic.Wic) ... FAIL (1.328s)
2016-12-27 07:56:27 -   test_image_env (oeqa.selftest.wic.Wic) ... FAIL (1.215s)
2016-12-27 07:56:29 -   test_iso_image (oeqa.selftest.wic.Wic) ... FAIL (1.211s)
2016-12-27 07:56:30 -   test_listhelp (oeqa.selftest.wic.Wic) ... FAIL (0.920s)
2016-12-27 07:56:31 -   test_mkefidisk (oeqa.selftest.wic.Wic) ... FAIL (1.203s)
2016-12-27 07:56:32 -   test_mkgummidisk (oeqa.selftest.wic.Wic) ... FAIL (1.314s)
2016-12-27 07:56:33 -   test_no_command (oeqa.selftest.wic.Wic) ... FAIL (1.281s)
2016-12-27 07:56:35 -   test_qemux86_directdisk (oeqa.selftest.wic.Wic) ... FAIL (1.328s)
2016-12-27 07:56:36 -   test_rootfs_artifacts (oeqa.selftest.wic.Wic) ... FAIL (1.101s)
2016-12-27 07:56:37 -   test_rootfs_indirect_recipes (oeqa.selftest.wic.Wic) ... FAIL (1.276s)
2016-12-27 07:56:38 -   test_sdimage_bootpart (oeqa.selftest.wic.Wic) ... FAIL (0.887s)
2016-12-27 07:56:39 -   test_systemd_bootdisk (oeqa.selftest.wic.Wic) ... FAIL (0.914s)
2016-12-27 07:56:40 -   test_unsupported_subcommand (oeqa.selftest.wic.Wic) ... FAIL (1.186s)
2016-12-27 07:56:41 -   test_wic_image_type (oeqa.selftest.wic.Wic) ... FAIL (1.300s)
2016-12-27 07:56:43 -   test_wrong_compressor (oeqa.selftest.wic.Wic) ... FAIL (1.107s)
2016-12-27 07:56:44 -   test_efi_gummiboot_images_can_be_built (oeqa.selftest.gummiboot.Gummiboot) ... FAIL (1.517s)
2016-12-27 07:56:45 -   test_wic_command_can_create_efi_gummiboot_installation_images (oeqa.selftest.gummiboot.Gummiboot) ... FAIL (1.244s)
2016-12-27 07:56:46 -   test_efi_systemdboot_images_can_be_built (oeqa.selftest.systemd_boot.Systemdboot) ... FAIL (1.343s)
lsandov1@yctb05:~/high/10826>
Comment 13 Leonardo Sandoval Gonzalez 2016-12-28 02:05:10 UTC
(In reply to comment #12)
> On a manual run, I got the following failures & errors. Nothing conclusive
> yet.

This run was done base on 

commit 573c646d4cc62dcd0c230381df4940bdf314d495
Author: Ross Burton <ross.burton@intel.com>
Date:   Wed Dec 14 19:53:46 2016 +0000

    bitbake: BBHandler: use with instead of open/close

    This is more pythonic and can handle unclosed file warnings better
    than the previous code structure.

which is around 100 behind current HEAD. Also, it had some local commits that I did not noticed. So running again using latest master:

commit dbb247cac5fbf7b037e4955f9793828451723924
Author: Richard Purdie <richard.purdie@linuxfoundation.org>
Date:   Tue Dec 20 19:02:11 2016 +0000

    bitbake: cookerdata: Convert multiconfig to use BB_CURRENT_MC
Comment 14 Leonardo Sandoval Gonzalez 2016-12-28 15:55:38 UTC
With current's master HEAD (dbb247cac5fbf7b037e4955f9793828451723924), the GDC AB fail in the first test

======================================================================
ERROR [439.311s]: test_all_users_can_connect_via_ssh_without_password (oeqa.selftest.imagefeatures.ImageFeatures)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/ab/autobuilder/yocto-worker/nightly-oe-selftest-ubuntu1404/build/bitbake/lib/bb/main.py", line 520, in setup_bitbake
    server_connection = server.establishConnection(featureset)
  File "/home/ab/autobuilder/yocto-worker/nightly-oe-selftest-ubuntu1404/build/bitbake/lib/bb/server/process.py", line 287, in establishConnection
    _, error = self.connection.connection.runCommand(["setFeatures", featureset])
  File "/home/ab/autobuilder/yocto-worker/nightly-oe-selftest-ubuntu1404/build/bitbake/lib/bb/server/process.py", line 61, in runCommand
    bb.fatal("Gave up; Too many tries: timeout while attempting to communicate with bitbake server")
  File "/home/ab/autobuilder/yocto-worker/nightly-oe-selftest-ubuntu1404/build/bitbake/lib/bb/__init__.py", line 104, in fatal
    raise BBHandledException()
bb.BBHandledException



During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/ab/autobuilder/yocto-worker/nightly-oe-selftest-ubuntu1404/build/meta/lib/oeqa/utils/decorators.py", line 109, in wrapped_f
    return func(*args, **kwargs)
  File "/home/ab/autobuilder/yocto-worker/nightly-oe-selftest-ubuntu1404/build/meta/lib/oeqa/selftest/imagefeatures.py", line 59, in test_all_users_can_connect_via_ssh_without_password
    with runqemu("core-image-minimal") as qemu:
  File "/usr/lib/python3.4/contextlib.py", line 59, in __enter__
    return next(self.gen)
  File "/home/ab/autobuilder/yocto-worker/nightly-oe-selftest-ubuntu1404/build/meta/lib/oeqa/utils/commands.py", line 227, in runqemu
    tinfoil.prepare(config_only=False, quiet=True)
  File "/home/ab/autobuilder/yocto-worker/nightly-oe-selftest-ubuntu1404/build/bitbake/lib/bb/tinfoil.py", line 210, in prepare
    extrafeatures)
  File "/home/ab/autobuilder/yocto-worker/nightly-oe-selftest-ubuntu1404/build/bitbake/lib/bb/main.py", line 522, in setup_bitbake
    bb.fatal("Could not connect to server %s: %s" % (configParams.remote_server, str(e)))
  File "/home/ab/autobuilder/yocto-worker/nightly-oe-selftest-ubuntu1404/build/bitbake/lib/bb/__init__.py", line 104, in fatal
    raise BBHandledException()
bb.BBHandledException

----------------------------------------------------------------------
Ran 1 test in 439.393s

From now on, I will try to file a build similar to [1] on the GDC AB infraestructure which is actually what Jose was doing at the beginning.


[1] https://autobuilder.yoctoproject.org/main/builders/nightly-oe-selftest/builds/776
Comment 15 Benjamin Esquivel 2016-12-29 23:25:54 UTC
I'm proposing this bug as M+ based on the following facts:
- there are no manifestations of it out of the GDC AB. First suspect is the GDC AB itself.

  - I ran iterations of a test that fails in the GDC AB in my machine and it hasn't failed.

  - the main AB does not show any error instance of the type.

- It is a M+ because we still don't know why it fails. First suspect is tinfoil-2.

  - previous to the TF2 changes the GDC AB does not show the failure

  - setting breakpoints around the failure area provoke the failure to manifest in different ways, could be a race condition on the bitbake server setup.

  - runqemu is out of the suspect list as everything about the failure is happening after tinfoil.prepare()
Comment 16 Benjamin Esquivel 2016-12-30 00:06:18 UTC
In debugging with Alejandro Hernandez and Saul we found that this bug is reproducible on any machine with a setting of:

PRSERV_HOST = "localhost:0"

At the conf/local.conf or any other conf file. Still need to investigate why the PR server is down in the GDC AB.
Comment 17 Benjamin Esquivel 2016-12-31 00:03:53 UTC
I have reproduced this issue in 2 of my machines, a Fedora 25 and an opensuse 42.1. I have written the procedure in bug 10866. A workaround for the issue is described there.

Another workaround that Alejandro and I tested in the GDC AB is to omit the PRSERV_HOST, all the workers tested (ubuntu, opensuse, fedora and debian) show a pass as expected.
Comment 18 Benjamin Esquivel 2016-12-31 00:04:18 UTC
returning this bug to High waiting for the CCB approval as per the process.
Comment 20 Benjamin Esquivel 2017-01-18 17:41:06 UTC
(In reply to comment #19)
> http://git.yoctoproject.org/cgit.cgi/poky/commit/
> ?id=9f6a1043f68580ed9604e750fd0f993f933bb66e fixes 10866 at least.

I verified this one works. Once bug 10873 is closed, this bug can be closed too.
Comment 21 Benjamin Esquivel 2017-01-19 21:55:32 UTC
Created attachment 3597 [details]
verification that selftest finishes execution on today's master
Comment 22 Benjamin Esquivel 2017-01-19 21:58:07 UTC
See the verification log attached that selftest finishes execution on today's master. Tested in the GDC Autobuilder.