Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

help umsgpack find message boundaries #11

Closed
wants to merge 1 commit into from

Conversation

bluecmd
Copy link
Contributor

@bluecmd bluecmd commented Sep 30, 2020

Sometimes umsgpack seems to get confused when the bytestream
is not correctly aligned.

Fixes #7

Sometimes umsgpack seems to get confused when the bytestream
is not correctly aligned.
@olofk
Copy link
Owner

olofk commented Sep 30, 2020

I'm a bit confused. Do you need both msgpack and umsgpack for this? Can we find a way to only rely on one of them?

@bluecmd
Copy link
Contributor Author

bluecmd commented Sep 30, 2020

Ah, maybe that's because I kept running with MSGPACK_PUREPYTHON=1 to get the error message. Let me try a bit without that option.

EDIT: No, even without that the following happens:

[riki]$ python3 sw/corecount.py /dev/ttyS6
Traceback (most recent call last):
  File "sw/corecount.py", line 53, in <module>
    curses.wrapper(main)
  File "/usr/lib/python3.6/curses/__init__.py", line 94, in wrapper
    return func(stdscr, *args, **kwds)
  File "sw/corecount.py", line 42, in main
    u = umsgpack.unpackb(d)
  File "/home/bluecmd/.local/lib/python3.6/site-packages/umsgpack.py", line 19, in unpackb
    return msgpack.unpackb(buf, **kwargs)
  File "msgpack/_unpacker.pyx", line 208, in msgpack._unpacker.unpackb
msgpack.exceptions.ExtraData: unpack(b) received extra data.

As you can see umsgpack raises an exception that is defined in msgpack. So either we have to catch all exceptions, or import msgpack to refer to this one specifically as I see it. Unless we know specifically what to do to not feed it invalid data in the first place, but that's beyond my knowledge.

@olofk
Copy link
Owner

olofk commented Feb 10, 2021

So I decided to take #17 and now this commit conflicts. I still think it would be great to have this as well, since there are still problems with message boundraries. Do you want to rebase it on top of the current HEAD?

@bluecmd
Copy link
Contributor Author

bluecmd commented Feb 10, 2021

I can probably do this some time in the future, I am right now moving house and all my FPGA stuff is packed down so I don't think I can test this fully if I were to remake the change for msgpack.

@olofk
Copy link
Owner

olofk commented Feb 10, 2021

Ah cool. I'll see if I can easily rebase it here or just reimplement it otherwise. Good luck with the move

@bluecmd bluecmd closed this Jan 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't launch corecount.py correctly
2 participants