-
Notifications
You must be signed in to change notification settings - Fork 366
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
cannot stop client if no connection established #337
Comments
So the first connect request isn't successfull or is still running (from your step1)? Can you provide a small example code (eventually commented)? That would clear some questions and missunderstandings. |
if you have questions use the discussions feature of this repo (your post is not related to the topic...) if you open a new discussion please provide consoleoutput and stacktrace, just posting your code is not enough |
@AndreasHeine Sorry, I will correct it. |
@joristork The asyncua thread doesn't hang, it was never told to stop. The exception is raised in the |
Pretty sure it's just a case of 'forgot to check if the task exists that I'm trying to cancel'. My PR allowed me to gracefully close the clients without first establishing a connection. |
Thank you @dan-sel and @Randelung , I will test your suggestions and feed back. |
I solved / worked around this by simply checking that my client is connected before calling the |
My criterion for checking it is connected: if (
hasattr(self._client, "uaclient")
and hasattr(self._client.uaclient, "protocol")
and self._client.uaclient.protocol
and (self._client.uaclient.protocol.state == UASocketProtocol.OPEN)
): |
Steps to reproduce:
client.connect()
client.disconnect()
The client will raise an
AttributeError
.If one catches this, the asyncua thread hangs.
The text was updated successfully, but these errors were encountered: