-
Notifications
You must be signed in to change notification settings - Fork 77
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
utils.ssh.SshConnectionBase issues caused by garbage collection #684
Comments
@douglas-raillard-arm Have you seen this behavior on your setup? |
I haven't seen it at that specific location but in general yes, that makes sense. That's partly why relying on What we should do is :
EDIT: I lied apparently and did hit the exact same problem: |
Actually there might be a 3rd way out to ensure |
@ep1cman Could you give a go at that PR ? It introduces a context manager API for
And the errors should be gone. If it works for you I'll remove the draft status. EDIT: PR is updated to also avoid the problem when the context manager API is not used by using an atexit handler. |
Unfortunately I am unable to currently re-create the race condition with the garbage collector that caused this error |
@ep1cman were you using a version of devlib published before or after March 29th, 1:04 AM GMT ? |
Currently |
Ok, I'd say we can merge #685 and it's likely to fix the issue, but maybe what you experienced came from something not covered, as this PR should have fixed the issue for SshConnection specifically. #685 should fix it for every connection type, and for any other resource held by Does you script use multithreading explicitly ? (i.e. more than just what devlib does internally) |
The code I am developing mixes devlib with something called "labgrid" than fires off its own asyncio loop, multiple sub processes too so it wouldn't surprise me if that's what made the race condition pop up |
Ok maybe it's partially related then, if anything would prevent the atexit handler to execute. According to the Python doc:
I can't really imagine that situation being your case though. In any case, the context manager API should provide a way to deal with that cleanly, and in current devlib codebase, calling |
I am hitting a rather odd issue where at the end of my scripts I am seeing a flood of the following messages:
Both
logger
and_handle_paramiko_exceptions
no longer seem to exist.What I think is happening is that during interpreter shut down these have already been garbage collected, and when it comes time to garbage collect
ConnectionBase
,__del__
is called but ends up being unable to run.The text was updated successfully, but these errors were encountered: