micropython / micropython/micropython-lib
umqtt subscribe to topic with 23 bytes fails
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.9k
- Forks
- 1.1k
- Avg merge
- 7d 6h
- Merged PRs (30d)
- 3
Description
Hi,
I can't subscribe to topic longer than 122 bytes. Publishing works fine!
I kindly ask you to verify and hopefully fix it
Thanks a lot
Danny
OK - working:
#122 bytes
mqtt.subscribe(b"/234567890/234567890/234567890/234567890/234567890/234567890/234567890/234567890/234567890/234567890/234567890/234567890/2")
but one more character:
#123 bytes
mqtt.subscribe(b"/234567890/234567890/234567890/234567890/234567890/234567890/234567890/234567890/234567890/234567890/234567890/234567890/23")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "test.py", line 169, in <module>
File "umqtt_simple.py", line 154, in subscribe
File "umqtt_simple.py", line 173, in wait_msg
OSError: -1
this might be related to #163 which also deals with 127 bytes
it might be related to https://github.com/micropython/micropython-lib/blob/f20d89c6aad9443a696561ca2a01f7ef0c8fb302/umqtt.simple/umqtt/simple.py#L148 as this is hitting the 128...
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading umqtt_simple.py around subscribe at line 154 and wait_msg at line 173, then compare the referenced umqtt.simple implementation near line 148. Reproduce the boundary with the supplied 122-byte and 123-byte topics and trace the resulting OSError. Done means subscription succeeds at the reported boundary and the behavior is covered by a regression check.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- embedded-iot, networking
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100