Describe the bug
Python 3.7 pycurl is failing to build in the latest nix unstable
To Reproduce
Steps to reproduce the behavior:
tests/multi_timer_test.py:79: AssertionError
```
Expected behavior
The build works without issues
Build Log
https://gist.github.com/mdedetrich/9029f67393b104ba7fed465e4796ac4a
Metadata
- system: `"x86_64-linux"`
- host os: `Linux 5.4.6, NixOS, 20.03pre206632.b0bbacb5213 (Markhor)`
- multi-user?: `yes`
- sandbox: `yes`
- version: `nix-env (Nix) 2.3.1`
- channels(root): `"nixos-20.03pre208261.9beb0d1ac2e, nixpkgs-unstable-20.03pre207249.7e8454fb856"`
- channels(mdedetrich): `"nixpkgs-20.03pre207249.7e8454fb856"`
- nixpkgs: `/home/mdedetrich/.nix-defexpr/channels/nixpkgs`
Maintainer information:
attribute: python3.7-pycurl
I tried building the same derivation three times, having 2 failures and 1 successful build. The failures are different from the one in the given build log.
Command: nix-build --check -A python37Packages.pycurl --show-trace on latest master
Success logs: https://gist.github.com/307c2014934bcc0f7a18bbb659737e3d
Failure logs: https://gist.github.com/757aa7adc164de126c87ade80894b899
I think that pycurl tests are a bit... "flaky", so to say. (read "non-deterministic")
I tried running it 3 times and didn't get it to work, let me try a few more times. Might it be the case that on some machines its failing reliably?
This is the latest run with even more tests failing https://gist.github.com/mdedetrich/715eb116c172fda32497affe1eff5c68. Something seems to be quite wrong the tests, i.e. they seem to be seriously flaky.
Update on this, I did manage to get it to eventually pass the tests but it took 20 times. Maybe we should report these flaky tests to upstream?
I opened https://github.com/NixOS/nixpkgs/pull/78043 to disable the tests, which will fix this
@Infinisil @jonringer This issue still exists despite your fix https://github.com/NixOS/nixpkgs/commit/95e3e3e0a8486bd63a66cc1c4229a9965a6dfd36. I got it today on 20.03.
The reason is probably that memory_mgmt_test.py is not the only one that can trigger it, there is also a multi_memory_mgmt_test.py:
Full build errors:
tests/xferinfo_cb_test.py ... [100%]
=================================== FAILURES ===================================
_______________________ MultiSocketTest.test_multi_timer _______________________
self = <tests.multi_timer_test.MultiSocketTest testMethod=test_multi_timer>
def test_multi_timer(self):
urls = [
'http://%s:8380/success' % localhost,
'http://%s:8381/success' % localhost,
'http://%s:8382/success' % localhost,
]
timers = []
# timer callback
def timer(msecs):
#print('Timer callback msecs:', msecs)
timers.append(msecs)
# init
m = pycurl.CurlMulti()
m.setopt(pycurl.M_TIMERFUNCTION, timer)
m.handles = []
for url in urls:
c = util.DefaultCurl()
# save info in standard Python attributes
c.url = url
c.body = util.BytesIO()
c.http_code = -1
m.handles.append(c)
# pycurl API calls
c.setopt(c.URL, c.url)
c.setopt(c.WRITEFUNCTION, c.body.write)
m.add_handle(c)
# get data
num_handles = len(m.handles)
while num_handles:
while 1:
ret, num_handles = m.perform()
if ret != pycurl.E_CALL_MULTI_PERFORM:
break
# currently no more I/O is pending, could do something in the meantime
# (display a progress bar, etc.)
m.select(1.0)
for c in m.handles:
# save info in standard Python attributes
c.http_code = c.getinfo(c.HTTP_CODE)
# print result
for c in m.handles:
self.assertEqual('success', c.body.getvalue().decode())
self.assertEqual(200, c.http_code)
assert len(timers) > 0
# libcurl 7.23.0 produces a 0 timer
> assert timers[0] >= 0
E AssertionError: assert -1 >= 0
tests/multi_timer_test.py:79: AssertionError
=============================== warnings summary ===============================
/nix/store/i33dbdihhvxcpjg4s19zi683rxsng73f-python3.7-nose-1.3.7/lib/python3.7/site-packages/nose/importer.py:12
/nix/store/i33dbdihhvxcpjg4s19zi683rxsng73f-python3.7-nose-1.3.7/lib/python3.7/site-packages/nose/importer.py:12: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
from imp import find_module, load_module, acquire_lock, release_lock
tests/setopt_lifecycle_test.py:19
/build/pycurl-7.43.0.3/tests/setopt_lifecycle_test.py:19: PytestCollectionWarning: cannot collect test class 'TestString' because it has a __new__ constructor (from: tests/setopt_lifecycle_test.py)
class TestString(str):
tests/setopt_test.py::SetoptTest::test_set_httpheader_none
/build/pycurl-7.43.0.3/tests/setopt_test.py:75: DeprecationWarning: Please use assertEqual instead.
self.assertEquals(util.b('foo'), io.getvalue())
tests/setopt_test.py::SetoptTest::test_set_httpheader_none
/build/pycurl-7.43.0.3/tests/setopt_test.py:81: DeprecationWarning: Please use assertEqual instead.
self.assertEquals(util.b(''), io.getvalue())
tests/setopt_test.py::SetoptTest::test_unset_httpheader
/build/pycurl-7.43.0.3/tests/setopt_test.py:61: DeprecationWarning: Please use assertEqual instead.
self.assertEquals(util.b('foo'), io.getvalue())
tests/setopt_test.py::SetoptTest::test_unset_httpheader
/build/pycurl-7.43.0.3/tests/setopt_test.py:67: DeprecationWarning: Please use assertEqual instead.
self.assertEquals(util.b(''), io.getvalue())
-- Docs: https://docs.pytest.org/en/latest/warnings.html
===Flaky Test Report===
test_curl_ref passed 1 out of the required 1 times. Success!
test_opensocketfunction_collection failed (2 runs remaining out of 3).
<class 'AssertionError'>
False is not true
[<TracebackEntry /build/pycurl-7.43.0.3/tests/multi_memory_mgmt_test.py:18>, <TracebackEntry /build/pycurl-7.43.0.3/tests/multi_memory_mgmt_test.py:42>]
test_opensocketfunction_collection passed 1 out of the required 1 times. Success!
test_seekfunction_collection passed 1 out of the required 1 times. Success!
test_multi_socket_select passed 1 out of the required 1 times. Success!
test_pause_via_call passed 1 out of the required 1 times. Success!
test_pause_via_return passed 1 out of the required 1 times. Success!
test_post_byte_buffer passed 1 out of the required 1 times. Success!
test_post_fields_with_ampersand passed 1 out of the required 1 times. Success!
test_post_file passed 1 out of the required 1 times. Success!
test_post_list_of_list_of_lists passed 1 out of the required 1 times. Success!
test_post_list_of_tuple_of_tuples passed 1 out of the required 1 times. Success!
test_post_multiple_fields passed 1 out of the required 1 times. Success!
test_post_single_field passed 1 out of the required 1 times. Success!
test_post_tuple_of_lists_of_tuples passed 1 out of the required 1 times. Success!
test_post_tuple_of_tuple_of_lists passed 1 out of the required 1 times. Success!
test_post_tuple_of_tuples_of_tuples passed 1 out of the required 1 times. Success!
test_post_unicode_buffer passed 1 out of the required 1 times. Success!
test_post_with_null_byte passed 1 out of the required 1 times. Success!
===End Flaky Test Report===
===== 1 failed, 348 passed, 7 skipped, 9 deselected, 6 warnings in 24.52s ======
/nix/store/a8ns51yifkzjwnhcp019jdk1nw1g5xd5-openssl-1.1.1g-man/share/man/man3/BN_add_word.3ssl
/nix/store/a8ns51yifkzjwnhcp019jdk1nw1g5xd5-openssl-1.1.1g-man/share/man/man3/BN_sub_word.3ssl -> /nix/store/a8ns51yifkzjwnhcp019jdk1nw1g5xd5-openssl-1.1.1g-man/share/man/man3/BN_add_word.3ssl
/nix/store/a8ns51yifkzjwnhcp019jdk1nw1g5xd5-openssl-1.1.1g-man/share/man/man3/BN_mul_word.3ssl -> /nix/store/a8ns51yifkzjwnhcp019jdk1nw1g5xd5-openssl-1.1.1g-man/share/man/man3/BN_add_word.3ssl
/nix/store/a8ns51yifkzjwnhcp019jdk1nw1g5xd5-openssl-1.1.1g-man/share/man/man3/BN_div_word.3ssl -> /nix/store/a8ns51yifkzjwnhcp019jdk1nw1g5xd5-openssl-1.1.1g-man/share/man/man3/BN_add_word.3ssl
/nix/store/a8ns51yifkzjwnhcp019jdk1nw1g5xd5-openssl-1.1.1g-man/share/man/man3/BN_mod_word.3ssl -> /nix/store/a8ns51yifkzjwnhcp019jdk1nw1g5xd5-openssl-1.1.1g-man/share/man/man3/BN_add_word.3ssl
part1part2
builder for '/nix/store/3x4ap3vhiqxy3slpfhzjdk8yf1lgxqdr-python3.7-pycurl-7.43.0.3.drv' failed with exit code 1
building '/nix/store/9bwzk241j16lmdxivkz86zfm5j6vwijd-quran-de.r50979.tar.xz.drv'...
cannot build derivation '/nix/store/vq78sxmf3a3vvffgx4ddgi4f32vw2pa6-system-config-printer-1.5.12.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/4sma4iidcq785sp3gs6lrhkxgk6l9ncr-dbus-1.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/bfkmi6ams2hwydrc4nnb3jf28b3w7ci2-hwdb.bin.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/sa085h7cg821qjs7pz98agz1av4wgdi6-system-generators.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/rbrr8vyd2qpfnahvbddxyviv2rykw72x-system-shutdown.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/j5jbjvhk00wb7p8hm5ifvxdqrc467f7g-system-units.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/9gn625nphz7aynacvrygn5w2j8sq2cpp-udev-rules.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/jwfqpglsjmg3d0377la736gnm8i3l7cf-user-units.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/d86h8wflc37y3z45z27rhjz6p3rf257q-etc.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/5i1n4fa6y25f4bj3l6kd1sn04npl7q8m-nixos-system-t25-20.03.git.58f884cd3d8.drv': 1 dependencies couldn't be built
error: build of '/nix/store/5i1n4fa6y25f4bj3l6kd1sn04npl7q8m-nixos-system-t25-20.03.git.58f884cd3d8.drv' failed
PR at #89544
And another one multi_timer_test.py:
=================================== FAILURES ===================================
_______________________ MultiSocketTest.test_multi_timer _______________________
self = <tests.multi_timer_test.MultiSocketTest testMethod=test_multi_timer>
def test_multi_timer(self):
urls = [
'http://%s:8380/success' % localhost,
'http://%s:8381/success' % localhost,
'http://%s:8382/success' % localhost,
]
timers = []
# timer callback
def timer(msecs):
#print('Timer callback msecs:', msecs)
timers.append(msecs)
# init
m = pycurl.CurlMulti()
m.setopt(pycurl.M_TIMERFUNCTION, timer)
m.handles = []
for url in urls:
c = util.DefaultCurl()
# save info in standard Python attributes
c.url = url
c.body = util.BytesIO()
c.http_code = -1
m.handles.append(c)
# pycurl API calls
c.setopt(c.URL, c.url)
c.setopt(c.WRITEFUNCTION, c.body.write)
m.add_handle(c)
# get data
num_handles = len(m.handles)
while num_handles:
while 1:
ret, num_handles = m.perform()
if ret != pycurl.E_CALL_MULTI_PERFORM:
break
# currently no more I/O is pending, could do something in the meantime
# (display a progress bar, etc.)
m.select(1.0)
for c in m.handles:
# save info in standard Python attributes
c.http_code = c.getinfo(c.HTTP_CODE)
# print result
for c in m.handles:
self.assertEqual('success', c.body.getvalue().decode())
self.assertEqual(200, c.http_code)
assert len(timers) > 0
# libcurl 7.23.0 produces a 0 timer
> assert timers[0] >= 0
E AssertionError: assert -1 >= 0
tests/multi_timer_test.py:79: AssertionError
PR: #90481