-
-
Notifications
You must be signed in to change notification settings - Fork 15
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
Wrong processing of messages split into multiple buffers #1
Comments
Hey! Thank you for this issue. I will have a look at it as soon as possible. Best |
Actually it does through yahdlc itself. This last one uses an internal static variable to keep track of the frame decoding process.
Can you show me an example of python4yahdlc leaking memory?
In addition, this test case is here to test that partial frame decoding works fine. |
@jeppefrandsen, could you please give me your feedback about this issue? Thank you in advance. |
Given that I haven't had any news on this issue in a while, I close it but feel free to reopen it if needed. |
Hi, @SkypLabs. I started to open a new issue, but then saw the reference to this one. I may be running into the same issue, and am seeing it when testing python4yahdlc in either a multi-threaded environment or in an interactive prompt. This is all with Python 3.6. I wrote a short script to test:
If I run this, I get the expected result: If, however, I execute this line by line in the interactive shell (tried regular and ipython), I get a corrupted result:
We also are seeing this in production-intent code that monitors a serial port in a thread, using more or less your receive_data_frame.py example. We'll try to track down the issue more here. Another interesting note is that if I rewrite the interactive example a bit, it works fine:
Output is correct for every split:
Thanks, |
Hey @podom. Thank you for your message. I will reopen this issue and have a look at your problem in details. I will come back to you as soon as I get a chance. |
Hey @podom. Sorry I've been very busy, I didn't have the time to investigate in your issue. Have you made any progress on your side? I will try to manage to work on it quite soon. |
Hey!
As far as I can see,
python4yahdlc
doesn't use a continuous buffer, like yahdlc recommends, but still persists its state. This makes it dump raw memory sometimes and doesn't allow for proper partial frames. You either need to store incoming data buffer somewhere and pull / discard bytes as they go (which would make it support partial frames), or callyahdlc_get_data_reset
/yahdlc_get_data_reset_with_state
after every call toyahdlc_get_data
. (to just use yahdlc for HDLC frames parsing and just properly discard partial frames/buffers)Best regards,
Piotr.
The text was updated successfully, but these errors were encountered: