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

FIX: handling KeyboardInterrupt: lower level closes the socket automa… #33

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

raczben
Copy link

@raczben raczben commented Sep 5, 2018

If a KeyboardInterrupt was raised during the raw read and write operation the link is set to None, because lower layers handle and closes the connection.

@alexforencich
Copy link
Contributor

alexforencich commented Sep 6, 2018

The link needs to be properly closed, you can't just close the socket. There are a number of instruments (namely Tektronix scopes) that don't implement VXI-11 correctly and don't actually release the link resources when the socket is closed. After a few rounds of this, the instrument needs to be rebooted before new VXI-11 connections can be made.

@raczben
Copy link
Author

raczben commented Sep 9, 2018

I use TEK MSO 3054, with WIN-7.

After a few rounds of this, the instrument needs to be rebooted before new VXI-11 connections can be made.

I got the same situation. The TEK scopes can handle 16 connection. If I have 16 disclosed connection, I have to reboot the scope. (No other reset can help this issue.)

BUT

If a KeyboardInterrupt was raised during the raw read/write operation, the OS closes the socket immediately. So you cannot send any (closing) command on that socket, because it no more exist, and because of this, if you tryto send further commands it hangs up the script. So the link should be set to None, because it points a dead link.

What's more! Using my fix I don't have to reboot the scope, if I press Ctrl+C (ie. I raise a KeyboardInterrupt) during scope operation. So it seems to me, that lower layer closes the link properly. The link can be set to None, without any further stuff.

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.

2 participants