adafruit / adafruit/Adafruit_CircuitPython_MiniMQTT
Sometimes receiving single zero byte
- Dominant language
- Python
- Stars
- 81
- Forks
- 52
- PR merge metrics
- No merged PRs in 30d
Description
Why does #127 fix #126? As mentioned by @brentru in https://github.com/adafruit/Adafruit_CircuitPython_MiniMQTT/pull/127#issuecomment-1317271214 and following
> @jinglemansweep Hi - thanks for fixing this issue. @dhalbert - I do not think this is a network or a MQTT spec issue, `b"\x00` is rx'd after the call to `res = self._sock_exact_recv(1)`.
>
> Considering some in #126 are having issues with non-native wifi, it's possible (don't know, guessing right now) that the issue is within this library's local implementation of `_sock_exact_recv()` vs the native impl. of `_sock_exact_recv()` (cc @calcut ☝️ )
>
> ```
> # CPython socket module contains a timeout attribute
> if hasattr(self._socket_pool, "timeout"):
> try:
> res = self._sock_exact_recv(1)
> except self._socket_pool.timeout:
> return None
> else: # socketpool, esp32spi
> try:
> res = self._sock_exact_recv(1)
> ```
>
> For now, though, I think this is an OK temporary change and will cause clients to poll faster until we resolve why the socket is rcv'ing a bytearray on some clients.
>
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by comparing issues #126 and #127 and tracing the _sock_exact_recv(1) call described in this issue. Reproduce the single-byte behavior across the native and local socket implementations mentioned, then determine the cause and verify the behavior is resolved for the affected clients.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100