Client with 100% CPU usage
Having a simple client example, subscribing to a single item, I have a CPU usage of 100%.
Maybe I am doing something wrong, or is that expected? I am mainly using the code of simple-client.
I dug a bit into this, and couldn't find any difference to the simple-client example, which did work just fine.
I then ran an update on all dependencies (cargo update), and the problem was gone. The lock file had some old dependencies, which seem to have causes this.
:shrug: … sorry for the noise.
So I did run into this again, even with newer dependencies. I dug a bit deeper, and noticed that it is repeatedly returning "none" in the following code:
https://github.com/locka99/opcua/blob/3b052d0f8a7c5fcb99f164ebb31c22d61c8a1d2d/lib/src/server/comms/tcp_transport.rs#L451-L453
Do my understanding, "none" would mean that the socket got closed. So I guess that should be treated as such, and shutdown reader and writer.
So it looks like that this comes from a previous session, when connecting using connect_to_endpoint, where is does retrieve the remote endpoints. The connection gets closed, but the reader loop never gets cleaned up, endlessly polling the closed socket.
Adding a break to the situation, shutting down the writer in the process, seems to fix this issue.
@svanharmelen You might want to watch out for this too.
Thanks for the ping!
This should be fixed in my pr : https://github.com/locka99/opcua/pull/201
@ctron : could you test it ?
You can specify in your dependencies
opcua = { git = "https://github.com/lovasoa/opcua", branch = "fix-zombie-tasks" }
@lovasoa Sure, I will give it a try. I might however do this next Monday.