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

Exception when sending "purge" to a remote serial driver #1396

Open
colin-foster-in-advantage opened this issue May 6, 2024 · 4 comments
Open
Labels

Comments

@colin-foster-in-advantage

When I try to attach to a ShellDriver on a remote serial port, I hit an exception "timeout while waiting for option 'purge'"

The exception comes from this line:

https://github.com/pyserial/pyserial/blame/master/serial/rfc2217.py#L493

I was able to recreate this issue with this code:

from serial.rfc2217 import Serial

def main():
    myConnection = Serial(port="rfc2217://lg-omap:34127", baudrate=115200, timeout=None)


if __name__ == '__main__':
    main()

If I comment out the self.reset_input_buffer() and self.reset_output_buffer() lines, everything works fine and running pytest with "test_shell.py" succeeds.

My exporter is a Raspberry Pi running Ubuntu 24.04 with a USB / Serial adapter.

So my question is: Is there something that might have changed on the exporter side that might cause the purge to timeout? Clearly the pyserial code isn't new, so I suspect the issue is something I've done with my exporter.

Is there any information that I could grab or provide that might shed some light on this?

Also, thank you for providing active support on this project! I look forward to using it much more.

@colin-foster-in-advantage
Copy link
Author

I referenced the pyserial source code, but confirm that both my client and exporter have pyserial-labgrid version 3.5.0.1 installed

@Emantor Emantor added the bug label May 7, 2024
@Emantor
Copy link
Member

Emantor commented May 7, 2024

Yeah, that does look weird. The fixes in our pyserial branch eliminate a lot of port reconfiguration, to investigate this further I'll need to reread RFC2711.

@jluebbe
Copy link
Member

jluebbe commented May 8, 2024

Is there any information that I could grab or provide that might shed some light on this?

You might be able to see some more by looking at the RFC2711 TCP connection with Wireshark. If you can reproduce and compare with the old working behaviour, even better.

Are you using ser2net? Perhaps there is a regression on their side?

@colin-foster-in-advantage
Copy link
Author

Is there any information that I could grab or provide that might shed some light on this?

You might be able to see some more by looking at the RFC2711 TCP connection with Wireshark. If you can reproduce and compare with the old working behaviour, even better.

Yes, I have that reproducing here.

The "with purge failing" option looks to start the same as the "purge ignored" example up until 0x49

image

0x49 sends ff fa 2c 0c 01 ff f0 after which there's a three second timeout before the TCP connection is FIN'd.

When I use the Telnet wirehsark parser, that matches the code in that it is trying to purge RX:

image

Are you using ser2net? Perhaps there is a regression on their side?

I am. And it was the Ubuntu 24.04 package (v4.6.0-1build2). The commit logs seem to support your theory:

8799160 (HEAD -> master, origin/master, origin/HEAD) dataxfer: Remove some debugging cruft
e5c3dfa Add initial EditorConfig support
978cf04 README.rst: fix typos
aa91a83 Return 0 for the -v option
7c3897a Fix showport and showshortport state reporting
6e8439a (tag: v4.6.1) Move to version 4.6.1
7d389f4 tests: Fix write drain tests
3b763a3 tests: Fix the rfc2217 flush test
1a339fd tests: Fix rfc2217 test to not leave ser2net running after crash
a369585 Add support for the updated gensio modemstate/linestate handling
7439c57 Add an rfc2217 flush test
8d71a1a Fix a problem with rfc2217 flush handling
0da2826 Fix the -C description in the help code
97c90c9 Fix the -C option definition
eef0981 Update iss file version
601c87b (tag: v4.6.0) Move to version 4.6.0

I'm willing to bet if I update to the latest (4.6.1+) this issue will go away. I'm regretting my decision to jump to the early OS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants