Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 803515

Summary: dev-python/requests fails tests on alpha, riscv
Product: Gentoo Linux Reporter: Marek Szuba <marecki>
Component: Current packagesAssignee: Python Gentoo Team <python>
Status: RESOLVED FIXED    
Severity: normal CC: mattst88, mgorny, riscv, sam
Priority: Normal Keywords: TESTFAILURE
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://github.com/psf/requests/pull/5890
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: build.log
environment
emerge --info

Description Marek Szuba archtester gentoo-dev 2021-07-23 13:05:58 UTC
The logs come from 2.26.0 but having just tried, I see exactly the same with 2.25.1-r2. Looks like pytest cannot spin up listeners on this arch for some reason.
Comment 1 Marek Szuba archtester gentoo-dev 2021-07-23 13:06:58 UTC
Created attachment 726040 [details]
build.log
Comment 2 Marek Szuba archtester gentoo-dev 2021-07-23 13:07:34 UTC
Created attachment 726043 [details]
environment
Comment 3 Marek Szuba archtester gentoo-dev 2021-07-23 13:07:54 UTC
Created attachment 726046 [details]
emerge --info
Comment 4 Matt Turner gentoo-dev 2021-07-25 02:40:37 UTC
I saw this too when testing on alpha.
Comment 5 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2021-07-25 06:58:53 UTC
Could you try them locally via tox from the git repo?  i.e.:

  git clone https://github.com/psf/requests
  cd requests
  tox -e py39
Comment 6 Marek Szuba archtester gentoo-dev 2021-07-26 10:35:32 UTC
(In reply to Michał Górny from comment #5)

> Could you try them locally via tox from the git repo?

Tried it on riscv a moment ago. Same failures.
Comment 7 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2021-07-28 08:07:49 UTC
So I've been able to build a minimal reproducer for it:

  import select
  import socket

  sock = socket.socket()
  sock.bind(('localhost', 0))
  sock.listen(0)
  print(sock.getsockname())
  print(select.select([sock], [], [], 20))

Then try to wget it.  On amd64 select() reports the incoming connection, on alpha it just waits until timeout.

Not sure if it's platform-specific select() behavior or CPython bug.  Will make a C reproducer to confirm.
Comment 8 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2021-07-28 08:31:53 UTC
Ok, so the immediate cause is `listen(0)`.  Apparently on other platforms Linux takes the backlog arg only as advisory but on alpha it takes it literally.  So in this case upstream is creating a server that can't accept any connections...  Will submit a fix shortly.
Comment 9 Larry the Git Cow gentoo-dev 2021-07-28 09:08:04 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c8005f10a737943a4e7a7d06ffd78fb71b2d09b4

commit c8005f10a737943a4e7a7d06ffd78fb71b2d09b4
Author:     Michał Górny <mgorny@gentoo.org>
AuthorDate: 2021-07-28 08:56:04 +0000
Commit:     Michał Górny <mgorny@gentoo.org>
CommitDate: 2021-07-28 09:07:59 +0000

    dev-python/requests: Fix test failures due to listen(0)
    
    Fix test failures on platforms (alpha, riscv) that literally interpret
    listen(0) as 'zero connections allowed'.
    
    Closes: https://bugs.gentoo.org/803515
    Signed-off-by: Michał Górny <mgorny@gentoo.org>

 .../requests/files/requests-2.26.0-test.patch      | 30 ++++++++++++++++++++++
 dev-python/requests/requests-2.26.0.ebuild         |  4 +++
 2 files changed, 34 insertions(+)