<?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>13257</bug_id>
          
          <creation_ts>2019-04-02 01:49:32 +0000</creation_ts>
          <short_desc>[2.7 M3 rc1] python3 ptest facing timeout issue</short_desc>
          <delta_ts>2019-05-09 15:23:06 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>11</classification_id>
          <classification>Runtime</classification>
          <product>General Runtime</product>
          <component>General Runtime</component>
          <version>2.7</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></status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>2.7 M4</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="yeoh ee peng">ee.peng.yeoh</reporter>
          <assigned_to name="Ross Burton">ross.burton</assigned_to>
          <cc>alex.kanavin</cc>
    
    <cc>bruce.ashfield</cc>
    
    <cc>richard.purdie</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>Don&apos;t know</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>83398</commentid>
    <comment_count>0</comment_count>
    <who name="yeoh ee peng">ee.peng.yeoh</who>
    <bug_when>2019-04-02 01:49:32 +0000</bug_when>
    <thetext>Using qemux86 to boot core-image-sato-sdk-ptest_qemux86-64, python3 ptest facing timeout issue. 
Refer to report at:
https://autobuilder.yocto.io/pub/releases/yocto-2.7_M3.rc1/testresults/testresult-report.txt</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83449</commentid>
    <comment_count>1</comment_count>
    <who name="Alexander Kanavin">alex.kanavin</who>
    <bug_when>2019-04-04 16:42:47 +0000</bug_when>
    <thetext>After applying this patch to ptest-runner:
https://lists.yoctoproject.org/pipermail/yocto/2019-April/044725.html

the timeout issue that still remains is that httplib test of python3 takes more than 5 minutes to execute (5 minutes is ptest-runner&apos;s default that we probably should increase):
0:06:39 load avg: 0.76 [177/416/1] test_http_cookies
0:06:39 load avg: 0.76 [178/416/1] test_httplib

ERROR: Exit status is 9
DURATION: 701
TIMEOUT: /usr/lib/python3/ptest
END: /usr/lib/python3/ptest
2019-04-04T16:40
STOP: /home/root/ptest-runner</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83451</commentid>
    <comment_count>2</comment_count>
    <who name="Alexander Kanavin">alex.kanavin</who>
    <bug_when>2019-04-04 17:25:28 +0000</bug_when>
    <thetext>It seems that httplib is genuinely stuck. With additional verbosity it stops here:

PASS: test_readinto_head (test.test_httplib.BasicTest)
PASS: test_readline_bound_content_length (test.test_httplib.BasicTest)
PASS: test_readlines_content_length (test.test_httplib.BasicTest)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83465</commentid>
    <comment_count>3</comment_count>
    <who name="Alexander Kanavin">alex.kanavin</who>
    <bug_when>2019-04-06 09:55:33 +0000</bug_when>
    <thetext>After a bit of bisecting, I can confirm that this commit is introducing the issue :(

a7ba3a7a3e134fd9bfd5c700c2f34edcdf3a689b is the first bad commit
commit a7ba3a7a3e134fd9bfd5c700c2f34edcdf3a689b
Author: Bruce Ashfield &lt;bruce.ashfield@gmail.com&gt;
Date:   Tue Mar 5 21:26:45 2019 -0500

    poky/kernel: make default 5.0
    
    (From meta-yocto rev: a1b111f742ac781cf35769e52cac29125569cb9b)
    
    Signed-off-by: Bruce Ashfield &lt;bruce.ashfield@gmail.com&gt;
    Signed-off-by: Richard Purdie &lt;richard.purdie@linuxfoundation.org&gt;


How to reproduce:

root@qemux86-64:~# python3 -m test test_httplib
Run tests sequentially
0:00:00 load avg: 0.00 [1/1] test_httplib

(blocks forever here, in roughly 9 attempts out of 10)

^CWarning -- threading._dangling was modified by test_httplib
  Before: &lt;_weakrefset.WeakSet object at 0x7f44a1a8a8d0&gt;
  After:  &lt;_weakrefset.WeakSet object at 0x7f44a1a8a6a0&gt; 

== Tests result: INTERRUPTED ==

Test suite interrupted by signal SIGINT.
1 test omitted:
    test_httplib

Total duration: 926 ms
Tests result: INTERRUPTED
^CException ignored in: &lt;module &apos;threading&apos; from &apos;/usr/lib/python3.7/threading.py&apos;&gt;
Traceback (most recent call last):
  File &quot;/usr/lib/python3.7/threading.py&quot;, line 1273, in _shutdown
    t.join()
  File &quot;/usr/lib/python3.7/threading.py&quot;, line 1032, in join
    self._wait_for_tstate_lock()
  File &quot;/usr/lib/python3.7/threading.py&quot;, line 1048, in _wait_for_tstate_lock
    elif lock.acquire(block, timeout):
KeyboardInterrupt</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83466</commentid>
    <comment_count>4</comment_count>
    <who name="Alexander Kanavin">alex.kanavin</who>
    <bug_when>2019-04-06 10:01:34 +0000</bug_when>
    <thetext>The specific issue with the unit test is that it&apos;s closing a socket connection, but it has no effect: netstat still shows the connection as ESTABLISHED on 5.0 kernel.

root@qemux86-64:~# python3 -m test test_httplib -v
== CPython 3.7.2 (default, Apr 5 2019, 15:17:15) [GCC 8.3.0]
== Linux-5.0.0-yocto-standard-x86_64-with-glibc2.2.5 little-endian
== cwd: /var/volatile/tmp/test_python_288
== CPU count: 1
== encodings: locale=UTF-8, FS=utf-8
...
test_response_fileno (test.test_httplib.BasicTest) ... 

^^^^ blocks forever.

On 4.18 kernel:

root@qemux86-64:~# python3 -m test test_httplib -v
== CPython 3.7.2 (default, Apr 5 2019, 15:17:15) [GCC 8.3.0]
== Linux-4.18.27-yocto-standard-x86_64-with-glibc2.2.5 little-endian
== cwd: /var/volatile/tmp/test_python_309
== CPU count: 1
== encodings: locale=UTF-8, FS=utf-8
....
test_response_fileno (test.test_httplib.BasicTest) ... ok
....</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83468</commentid>
    <comment_count>5</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2019-04-06 23:18:35 +0000</bug_when>
    <thetext>I couldn&apos;t reproduce this with 4.19, I could with 5.0. I tried reverting https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=3c82a21f4320c8d54cf6456b27c8d49e5ffb722e and I think that stopped the hangs. I&apos;d need more test runs to be 100% sure. Adding Bruce to cc.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83469</commentid>
    <comment_count>6</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2019-04-06 23:46:41 +0000</bug_when>
    <thetext>Having mentioned the commit, it all started working. Will look into it more tomorrow</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83470</commentid>
    <comment_count>7</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2019-04-07 10:02:10 +0000</bug_when>
    <thetext>Can&apos;t get it to fail at all now! :(</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83471</commentid>
    <comment_count>8</comment_count>
    <who name="Alexander Kanavin">alex.kanavin</who>
    <bug_when>2019-04-07 10:17:59 +0000</bug_when>
    <thetext>For me, the failures weren’t 100%, more like 9 out of 10.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83472</commentid>
    <comment_count>9</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2019-04-07 12:59:54 +0000</bug_when>
    <thetext>Found a more reliable way to brute force reproduce it:

meta/lib/oeqa/runtime/cases/python.py:

+    def test_python3_httplib(self):
+        for _ in range(50):
+            cmd = &quot;python3 -m test test_httplib -v&quot;
+            status, output = self.target.run(cmd)
+            msg = &apos;Exit status was not 0. Output: %s&apos; % output
+            self.assertEqual(status, 0, msg=msg)


Confirmed that reverting the commit I mentioned doesn&apos;t fix it. Also confirmed its not fixed by v5.0.7</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83473</commentid>
    <comment_count>10</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2019-04-07 13:30:33 +0000</bug_when>
    <thetext>v4.20.17 doesn&apos;t have the issue
v5.1-rc3 does
v5.0-rc3 does
v5.0-rc1 does</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83474</commentid>
    <comment_count>11</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2019-04-07 20:56:23 +0000</bug_when>
    <thetext>Bisect suggests the commit which introduces the problem is:

commit 4f693b55c3d2d2239b8a0094b518a1e533cf75d5 (HEAD, refs/bisect/bad)
Author: Eric Dumazet &lt;edumazet@google.com&gt;
Date:   Tue Nov 27 14:42:03 2018 -0800

    tcp: implement coalescing on backlog queue
    
    In case GRO is not as efficient as it should be or disabled,
    we might have a user thread trapped in __release_sock() while
    softirq handler flood packets up to the point we have to drop.
    
    This patch balances work done from user thread and softirq,
    to give more chances to __release_sock() to complete its work
    before new packets are added the the backlog.
    
    This also helps if we receive many ACK packets, since GRO
    does not aggregate them.
    
    This patch brings ~60% throughput increase on a receiver
    without GRO, but the spectacular gain is really on
    1000x release_sock() latency reduction I have measured.
    
    Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
    Cc: Neal Cardwell &lt;ncardwell@google.com&gt;
    Cc: Yuchung Cheng &lt;ycheng@google.com&gt;
    Acked-by: Neal Cardwell &lt;ncardwell@google.com&gt;
    Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83475</commentid>
    <comment_count>12</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2019-04-07 22:03:34 +0000</bug_when>
    <thetext>I&apos;ve asked for advice https://lore.kernel.org/netdev/85aabf9d4f41b6c57629e736993233f80a037e59.camel@linuxfoundation.org/T/#u</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83477</commentid>
    <comment_count>13</comment_count>
    <who name="Bruce Ashfield">bruce.ashfield</who>
    <bug_when>2019-04-08 02:53:20 +0000</bug_when>
    <thetext>I can&apos;t say that I understand why that is triggering the hang completely either, but is clearly mucking in the right part of the kernel to be the suspect commit.

I&apos;m following your upstream question as well.

We can of course easily revert that commit in the linux-yocto 5.x branches, but as we all know, this really doesn&apos;t look oe/yocto/test specific, so getting a root cause from -netdev would be ideal, since this will just be waiting for us on all future kernel versions.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83769</commentid>
    <comment_count>14</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2019-05-09 15:23:06 +0000</bug_when>
    <thetext>Root caused, worked around in python3, fixed in the kernel, and work around removed.  All sorted as of 21bfbef23e1f4c90070017e19f70e488e6ff64be.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>