Skip to content

Conversation

feeph
Copy link
Owner

@feeph feeph commented Jul 20, 2024

The code did not perform a retry in case a spurious I/O error occured and failed from time to time. The logic to perform a retry was already there, but it did not handle this situation properly and returned to early.

Symptom:

>       return read_device_registers(i2c_bus, reads, max_tries, timeout_ms).pop()
E       IndexError: pop from empty list

.venv/lib/python3.11/site-packages/feeph/i2c/__init__.py:42: IndexError
------------------- Captured log call -------------------
WARNING  i2c:__init__.py:88 [feeph.i2c] Failed to read register 0x03 (1/3): [Errno 121] Remote I/O error

The code did not perform a retry in case a spurious I/O error occured and
failed from time to time. The logic to perform a retry was already there,
but it did not handle this situation properly and returned to early.

Symptom:
```
<...>

>       return read_device_registers(i2c_bus, reads, max_tries, timeout_ms).pop()
E       IndexError: pop from empty list

.venv/lib/python3.11/site-packages/feeph/i2c/__init__.py:42: IndexError
------------------- Captured log call -------------------
WARNING  i2c:__init__.py:88 [feeph.i2c] Failed to read register 0x03 (1/3): [Errno 121] Remote I/O error
```
@feeph feeph added the bug Something isn't working label Jul 20, 2024
@feeph feeph self-assigned this Jul 20, 2024
@feeph feeph merged commit 254f9b3 into master Jul 20, 2024
@feeph feeph deleted the fix-remote-io-error branch July 20, 2024 12:47
feeph added a commit that referenced this pull request Jul 20, 2024
##
[0.4.1](v0.4.0...v0.4.1)
(2024-07-20)


### Bug Fixes

* fix the retry-on-error logic
([#17](#17))
([254f9b3](254f9b3))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant