-
Notifications
You must be signed in to change notification settings - Fork 202
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
Malformed data being sent on Windows #60
Comments
Hi @martinzak-zaber, thanks for the bug report, and sorry for the long delay. May you provide an example program to help to reproduce the issue? Writing in a tight loop may and reading from another goroutine may be sufficient to trigger the issue? I guess you already tried to remove the |
Hello @cmaglie, I, unfortunately, don't have the testing program anymore. It was also a part of a bigger project. But I do recall that we were running an intense stress test. Basically writing and reading from the port at the same time many times. It was slightly unusual because our protocol is request/response so most of the time there is no overlap between writing and reading. We had to be bashing it with multiple requests at the same time. In our fork, We have removed the Feel free to check out our merge requests: https://github.com/martinzak-zaber/go-serial/pulls These are all the fixes and changes we have made for our fork. Thank you again for creating the library! |
Remove unnecessary code, originally for checking for disconnects when using non-overlapped I/O. getOverlappedEvent() returns all required error codes. Calling getCommState()/setCommState() every second in some applications contributes to other downstream issues. For examples: bugst#60 (comment) arduino/arduino-ide#375
The old code is no more needed when using overlapped I/O, getOverlappedEvent() returns all required error codes. Calling getCommState()/setCommState() every second in some applications contributes to other downstream issues. For examples: bugst#60 (comment) arduino/arduino-ide#375
Hi @cmaglie, FWIW - the link cited in this comment seems to be gone, but the fixes described seem to be here - if you are looking for them:
|
I am sorry, we have moved the library under company GitHub. Thank you again to the authors of the library. |
Thank you everyone for the feedback and the fix, I've finally managed to reproduce the bug and confirm the solution. 👍🏼 |
Hello,
We have been using this library for some time and we have encountered an issue which is very difficult to reproduce and debug. The problem is caused by the Read function in the windows implementation:
If there is no traffic on the port this function calls setCommState every 1 second. If there is also an ongoing Write operation at the same time, the transmitted data gets malformed and the other side receives gibberish. The race condition requires very precise timing to be reproduced. We are very confident that the issue is not caused by our code.
As this library is used by your customers I thought this may be quite critical information for you. We have spent around two days hunting this down. Feel free to contact me for more details.
Thank you for implementing this awesome library.
The text was updated successfully, but these errors were encountered: