-
Notifications
You must be signed in to change notification settings - Fork 1
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
High CPU #2
Comments
This probably has to do with the fact that we can't detect when a client goes away. |
Actual problem is constant polling probably because of the readable callback on the zmq sockets. |
it's a tclzmq issue. The following script has high cpu:
|
It is an issue by design, as internal to tclzmq, the ZMQ events are married with the Tcl event loop using (as you write) constant polling. tclzmq would need to adopt another integration technique (e.g., using ZMQ_USE_FD plus Tcl_CreateFileHandler), but this would lead to platform-specific pieces of implementation (e.g., on Win, Tcl has no Tcl_CreateFileHandler!). However, in absence of readable/ writeable handlers, polling should be paused ... maybe, as a workaround, use a default handler with some sleep time to cool down the polling? |
Using Tcl event handlers with after and manually polling works fine. I am thinking about adding a switch to disable the event source integration |
This is fixed by a combination of: |
I am tempted to build a minimal zmq client in Tcl only for Tcljupyter use which would use socket readable handlers |
I used to solve this by using |
I had the same thought, once, but it would require programming against Windows APIs directly (as I said, there is no Tcl file-handler abstraction under Win), I did not want to jump into this rabbit hole. |
Why would a readable event handler on the zmq sockets not work? No platform API in sight. |
Oh, you mean, create a Tcl channel type for ZMQ sockets? Well, right now, ZMQ sockets are no Tcl channels ... the reason being, probably, that ZMQ sockets are not sockets in the purest sense, you will have to extract the sibling sockets for each ZMQ socket ... and this will bring platform APIs in sight. If you don't, from what I found out back then, you will end up using polling again just under the hood of a Tcl channel ... but maybe I am just wrong? |
No just a plain Tcl server socket. This obviously will only support |
Cleanest way would be to do a blocking poll on all sockets in a separate thread and remove the event sourcing. And wrap this in a higher level API. |
After killing the jupyter notebook the kernels seem to keep running and taking a constant 1-3% of CPU power.
The text was updated successfully, but these errors were encountered: