Description of problem: When I try to upload a 2.8 GiB SRPM over an O2 Fiber connection from my flat, the copr-cli process is terminated with traceback showing a division by zero in python-progress. Version-Release number of selected component (if applicable): copr-cli-1.100-1.fc35.noarch python3-progress-1.5-10.fc35.noarch Steps to Reproduce: 1. copr-cli --config=/home/kdudka/.config/copr-kdudka build --nowait covscan src/cov-sa202206-2022.6.0-4.fc35.src.rpm Actual results: Uploading package src/cov-sa202206-2022.6.0-4.fc35.src.rpm |# | 145.2 MB 5.0 kB/s eta 6 days, 11:28:19 Traceback (most recent call last): File "/usr/bin/copr-cli", line 33, in <module> sys.exit(load_entry_point('copr-cli==1.100', 'console_scripts', 'copr-cli')()) File "/usr/lib/python3.10/site-packages/copr_cli/main.py", line 1827, in main getattr(commands, arg.func)(arg) File "/usr/lib/python3.10/site-packages/copr_cli/main.py", line 140, in wrapper return func(self, args) File "/usr/lib/python3.10/site-packages/copr_cli/main.py", line 342, in action_build builds.append(self.process_build(args, build_function, data, bar=bar, progress_callback=progress_callback)) File "/usr/lib/python3.10/site-packages/copr_cli/main.py", line 431, in process_build result = build_function(ownername=username, projectname=projectname, File "/usr/lib/python3.10/site-packages/copr/v3/helpers.py", line 68, in wrapper result = func(*args, **kwargs) File "/usr/lib/python3.10/site-packages/copr/v3/proxies/build.py", line 150, in create_from_file return self._create(endpoint, data, files=files, buildopts=buildopts) File "/usr/lib/python3.10/site-packages/copr/v3/helpers.py", line 68, in wrapper result = func(*args, **kwargs) File "/usr/lib/python3.10/site-packages/copr/v3/proxies/build.py", line 307, in _create response = request.send( File "/usr/lib/python3.10/site-packages/copr/v3/requests.py", line 50, in send response = self._send_request_repeatedly(session, request_params) File "/usr/lib/python3.10/site-packages/copr/v3/requests.py", line 61, in _send_request_repeatedly response = session.request(**request_params) File "/usr/lib/python3.10/site-packages/requests/sessions.py", line 529, in request resp = self.send(prep, **send_kwargs) File "/usr/lib/python3.10/site-packages/requests/sessions.py", line 645, in send r = adapter.send(request, **kwargs) File "/usr/lib/python3.10/site-packages/requests/adapters.py", line 440, in send resp = conn.urlopen( File "/usr/lib/python3.10/site-packages/urllib3/connectionpool.py", line 699, in urlopen httplib_response = self._make_request( File "/usr/lib/python3.10/site-packages/urllib3/connectionpool.py", line 394, in _make_request conn.request(method, url, **httplib_request_kw) File "/usr/lib/python3.10/site-packages/urllib3/connection.py", line 239, in request super(HTTPConnection, self).request(method, url, body=body, headers=headers) File "/usr/lib64/python3.10/http/client.py", line 1282, in request self._send_request(method, url, body, headers, encode_chunked) File "/usr/lib64/python3.10/http/client.py", line 1328, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "/usr/lib64/python3.10/http/client.py", line 1277, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/usr/lib64/python3.10/http/client.py", line 1066, in _send_output for chunk in chunks: File "/usr/lib64/python3.10/http/client.py", line 1021, in _read_readable datablock = readable.read(self.blocksize) File "/usr/lib/python3.10/site-packages/requests_toolbelt/multipart/encoder.py", line 403, in read self.callback(self) File "/usr/lib/python3.10/site-packages/copr_cli/main.py", line 331, in progress_callback bar.next(n=8192) File "/usr/lib/python3.10/site-packages/progress/__init__.py", line 146, in next self.update() File "/usr/lib/python3.10/site-packages/progress/bar.py", line 39, in update suffix = self.suffix % self File "/usr/lib/python3.10/site-packages/progress/__init__.py", line 94, in __getitem__ return getattr(self, key, None) File "/usr/lib/python3.10/site-packages/copr_cli/util.py", line 19, in download_speed if self.avg == 0.0: File "/usr/lib/python3.10/site-packages/progress/__init__.py", line 102, in avg speed = self.window.avg File "/usr/lib/python3.10/site-packages/progress/__init__.py", line 63, in avg return self.counter / (self.last - self.deque[0][0]) ZeroDivisionError: float division by zero
I ended up with the following hotfix in progress/__init__.py: @property def avg(self): x = self.last - self.deque[0][0] if x <= 0.0 and x >= 0.0: return float('inf') else: return self.counter / x
Thank you for the report and patch. The situation is very weird. Unless (a) the connection is _very_ unstable, and the box is _very_ fast, OR (b) the time() on the box goes backward, I'm clueless. This is the proposed fix for both a) and b) situations: https://src.fedoraproject.org/rpms/python-progress/pull-request/5
Thank you for the quick fix! I will retest it when I am back on my home network.
I wanted to verify the fix. Unfortunately, I am not able to trigger the traceback captured in comment #0 right now any more.
FEDORA-2022-55f18fa50e has been submitted as an update to Fedora 37. https://bodhi.fedoraproject.org/updates/FEDORA-2022-55f18fa50e
FEDORA-2022-3f942d3b4f has been submitted as an update to Fedora 35. https://bodhi.fedoraproject.org/updates/FEDORA-2022-3f942d3b4f
FEDORA-EPEL-2022-6f72c19cfc has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2022-6f72c19cfc
FEDORA-EPEL-2022-cb1d0a0321 has been submitted as an update to Fedora EPEL 8. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2022-cb1d0a0321
FEDORA-EPEL-2022-1b7daed183 has been submitted as an update to Fedora EPEL 9. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2022-1b7daed183
FEDORA-2022-210571b2ac has been submitted as an update to Fedora 36. https://bodhi.fedoraproject.org/updates/FEDORA-2022-210571b2ac
> I wanted to verify the fix. Unfortunately, I am not able to trigger the > traceback captured in comment #0 right now any more. No problem, the issue you faced before was weird, and unlikely. Thank you for the attempt at least! The PR is correct anyway, I believe. So I merged and built. Please reopen if you face the same issue again.
FEDORA-2022-55f18fa50e has been pushed to the Fedora 37 stable repository. If problem still persists, please make note of it in this bug report.
FEDORA-2022-3f942d3b4f has been pushed to the Fedora 35 testing repository. Soon you'll be able to install the update with the following command: `sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2022-3f942d3b4f` You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2022-3f942d3b4f See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.
FEDORA-2022-210571b2ac has been pushed to the Fedora 36 testing repository. Soon you'll be able to install the update with the following command: `sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2022-210571b2ac` You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2022-210571b2ac See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.
FEDORA-EPEL-2022-1b7daed183 has been pushed to the Fedora EPEL 9 testing repository. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2022-1b7daed183 See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.
FEDORA-EPEL-2022-cb1d0a0321 has been pushed to the Fedora EPEL 8 testing repository. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2022-cb1d0a0321 See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.
FEDORA-EPEL-2022-6f72c19cfc has been pushed to the Fedora EPEL 7 testing repository. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2022-6f72c19cfc See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.
FEDORA-EPEL-2022-1b7daed183 has been pushed to the Fedora EPEL 9 stable repository. If problem still persists, please make note of it in this bug report.
FEDORA-2022-210571b2ac has been pushed to the Fedora 36 stable repository. If problem still persists, please make note of it in this bug report.
FEDORA-2022-3f942d3b4f has been pushed to the Fedora 35 stable repository. If problem still persists, please make note of it in this bug report.
FEDORA-EPEL-2022-cb1d0a0321 has been pushed to the Fedora EPEL 8 stable repository. If problem still persists, please make note of it in this bug report.
FEDORA-EPEL-2022-6f72c19cfc has been pushed to the Fedora EPEL 7 stable repository. If problem still persists, please make note of it in this bug report.