<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>14170</bug_id>
          
          <creation_ts>2020-12-30 08:54:57 +0000</creation_ts>
          <short_desc>glib-2.0 codegen ptest failure</short_desc>
          <delta_ts>2021-04-20 18:02:12 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>10</classification_id>
          <classification>QA/Testing</classification>
          <product>Package Testing (ptest)</product>
          <component>ptest</component>
          <version>3.3</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard>AB-INT</status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>3.4 M1</target_milestone>
          <dependson>14220</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Naveen Saini">naveen.kumar.saini</reporter>
          <assigned_to name="Yi Fan Yu">yf3yu</assigned_to>
          <cc>alexandre.belloni</cc>
    
    <cc>anibal</cc>
    
    <cc>Jagadheesan_Duraisamy</cc>
    
    <cc>randy.macleod</cc>
    
    <cc>ross.burton</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>88832</commentid>
    <comment_count>0</comment_count>
    <who name="Naveen Saini">naveen.kumar.saini</who>
    <bug_when>2020-12-30 08:54:57 +0000</bug_when>
    <thetext>AssertionError: Failed ptests:
{&apos;glib-2.0&apos;: [&apos;glib/codegen.py.test&apos;]}

https://autobuilder.yoctoproject.org/typhoon/#/builders/83/builds/1711

Failure observed in both glib-2.0 v2.66.2 and v2.66.4 versions.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>88883</commentid>
    <comment_count>1</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2021-01-07 15:55:02 +0000</bug_when>
    <thetext>Ross has fixed a number of glib ptest so he may provide advice.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>88905</commentid>
    <comment_count>2</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2021-01-11 12:49:33 +0000</bug_when>
    <thetext>Now seen on the arm host too.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89028</commentid>
    <comment_count>3</comment_count>
    <who name="Alexandre Belloni">alexandre.belloni</who>
    <bug_when>2021-01-26 17:11:51 +0000</bug_when>
    <thetext>https://autobuilder.yoctoproject.org/typhoon/#/builders/81/builds/1716</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89085</commentid>
    <comment_count>4</comment_count>
    <who name="Yi Fan Yu">yf3yu</who>
    <bug_when>2021-01-29 15:35:08 +0000</bug_when>
    <thetext>was able to reproduce 
standard build of core-image-sato-sdk
although it has flaky/intermittent behaviour
Run 3 times, fails once
```
ERROR: Exit status is 512
DURATION: 3
END: /usr/lib/glib-2.0/ptest
2021-01-29T15:32
STOP: ptest-runner
```</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89088</commentid>
    <comment_count>5</comment_count>
    <who name="Yi Fan Yu">yf3yu</who>
    <bug_when>2021-01-29 17:36:01 +0000</bug_when>
    <thetext>was able to narrow it down to
__main__.TestCodegen.test_reproducible failing</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89110</commentid>
    <comment_count>6</comment_count>
    <who name="Yi Fan Yu">yf3yu</who>
    <bug_when>2021-02-01 20:45:28 +0000</bug_when>
    <thetext>I think this is an issue with the amount of output generated by this particular test.


if i pipe the output of the ptest-runner into a file
`ptest-runner &gt; test.log`, the test passes

however,
if i do `ptest-runner`, the test fails saying exit status 512.

i think this is related to `TestCodegen.test_reproducible` generating around 6000 lines of just boiler plate code.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89117</commentid>
    <comment_count>7</comment_count>
    <who name="Yi Fan Yu">yf3yu</who>
    <bug_when>2021-02-02 16:44:30 +0000</bug_when>
    <thetext>root cause is in `ptest-runner`. it seems to have trouble dealing with large amount of data coming from the child process.

this does not happen if you do `ptest-runner &gt; filename`

to reproduce this type of issue:

use `ptest-runner` to run the following script

echo -e {1..100000}\\n 


ptrace shows this before failing (child process probably crashed)
```
read(3, 0x7ffc8e9a08c0, 1024)           = -1 EAGAIN (Resource temporarily unavailable)
wait4(21170, [{WIFEXITED(s) &amp;&amp; WEXITSTATUS(s) == 1}], WNOHANG, NULL) = 21170
poll([{fd=3, events=POLLIN}, {fd=5, events=POLLIN}], 2, 200) = 0 (Timeout)
write(1, &quot;\n&quot;, 1
)                       = 1                                    
write(1, &quot;ERROR: Exit status is 256\n&quot;, 26ERROR: Exit status is 256

```</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89119</commentid>
    <comment_count>8</comment_count>
    <who name="Yi Fan Yu">yf3yu</who>
    <bug_when>2021-02-02 17:35:16 +0000</bug_when>
    <thetext>2 proposed fix for this:

1. remove unecessary print statements from glib


2. change `ptest-runner` to do blocking IO on pipes. this will make sure the child process stalls if the pipe is full.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89121</commentid>
    <comment_count>9</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2021-02-03 00:53:46 +0000</bug_when>
    <thetext>option 2 of fixing ptest-runner would be better so that we don&apos;t have to find and tweak other programs that behave the same way.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89129</commentid>
    <comment_count>10</comment_count>
    <who name="Yi Fan Yu">yf3yu</who>
    <bug_when>2021-02-03 19:37:56 +0000</bug_when>
    <thetext>ok the root_root cause of the issue is a 

*read from a non-blocking pipe, but
*write to a blocking stdout

so when the data becomes too large, it would block the write and the pipe will be full.

The child process writing to the non-blocking pipe will sometimes crash because it gets an error EAGAIN. It doesn&apos;t handle it well because it thinks it is writing to blocking stdout

```
/home/yyu1/ptest-runner2/lol/ptest/run-ptest: line 10: echo: write error: Resource temporarily unavailable
```</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89147</commentid>
    <comment_count>11</comment_count>
    <who name="Yi Fan Yu">yf3yu</who>
    <bug_when>2021-02-04 20:44:53 +0000</bug_when>
    <thetext>although not mentioned in the patch, i did submit the change to upstream
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1929</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89249</commentid>
    <comment_count>12</comment_count>
    <who name="Yi Fan Yu">yf3yu</who>
    <bug_when>2021-02-12 15:23:43 +0000</bug_when>
    <thetext>glib rejected the change. see previous link for a response.

one interesting suggestion is to have testrunner ignore certain outputs since all output glib creates follow the tap convention of commenting out these debugging outputs with &apos;#&apos;

so run-ptest for glibc could specifically ignore with grep -v &apos;^#&apos;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89254</commentid>
    <comment_count>13</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2021-02-12 19:35:58 +0000</bug_when>
    <thetext>Note that a work-around for this bug is already in oe-core master:

http://cgit.openembedded.org/openembedded-core/commit/?id=afc9ba7d546f3f2e60fb6f46f740dc925542df16

We&apos;re waiting on a fix from Anibal for ptest-runner to revert the work-around.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89716</commentid>
    <comment_count>14</comment_count>
    <who name="Aníbal Limón">anibal</who>
    <bug_when>2021-03-23 17:45:45 +0000</bug_when>
    <thetext>(In reply to comment #13)
&gt; Note that a work-around for this bug is already in oe-core master:
&gt; 
&gt; http://cgit.openembedded.org/openembedded-core/commit/
&gt; ?id=afc9ba7d546f3f2e60fb6f46f740dc925542df16
&gt; 
&gt; We&apos;re waiting on a fix from Anibal for ptest-runner to revert the
&gt; work-around.

I have the patches [1] and tested  with glib-2.0 ptest but fails after 958 secs on qemuarm64 in glib-threading tests, that will require to implement per test timeouts because only global timeout is supported default to 300 secs can be override by -t.

The idea is to add a special file under ptest folder like for example in glib-2.0,

/usr/lib/glib-2.0/ptest/timeout

If that file exists in the ptest use the timeout from there if not use global one.


[1] https://github.com/alimon/ptest-runner2/tree/ptest_fixes</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89883</commentid>
    <comment_count>15</comment_count>
    <who name="Yi Fan Yu">yf3yu</who>
    <bug_when>2021-04-07 14:24:21 +0000</bug_when>
    <thetext>(In reply to comment #14)
&gt; I have the patches [1] and tested  with glib-2.0 ptest but fails after 958
&gt; secs on qemuarm64 in glib-threading tests, that will require to implement
&gt; per test timeouts because only global timeout is supported default to 300
&gt; secs can be override by -t.

I think if we do the &quot;reset timeout timer as long as there is output&quot;, we are fine for glib-2.0

preparing a patch to revert the workaround.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>90028</commentid>
    <comment_count>16</comment_count>
    <who name="Yi Fan Yu">yf3yu</who>
    <bug_when>2021-04-20 18:01:48 +0000</bug_when>
    <thetext>https://git.openembedded.org/openembedded-core/commit/?id=e7be3901e43645796e195348924739d03495a079

reverted the workaround.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>90029</commentid>
    <comment_count>17</comment_count>
    <who name="Yi Fan Yu">yf3yu</who>
    <bug_when>2021-04-20 18:02:12 +0000</bug_when>
    <thetext>https://git.openembedded.org/openembedded-core/commit/?id=e7be3901e43645796e195348924739d03495a079

reverted the workaround.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>