question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ZMQ.poll cpu 100%

See original GitHub issue
"Thread-2" Id=14 RUNNABLE
    at sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:86)
    -  locked sun.nio.ch.Util$2@7433a0f1
    -  locked java.util.Collections$UnmodifiableSet@698b69d0
    -  locked sun.nio.ch.EPollSelectorImpl@3fd00cd2
    at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:98)
    at zmq.ZMQ.poll(ZMQ.java:705)
    at zmq.ZMQ.poll(ZMQ.java:618)

This is my code

PollItem[] items = new PollItem[ZmqConfig.ZMQ_POLLITEM_SIZE];
items[ZmqConfig.ZMQ_FRONTEND_POLLIN] = new PollItem(frontend.base(), zmq.ZMQ.ZMQ_POLLIN);
items[ZmqConfig.ZMQ_BACKEND_POLLIN] = new PollItem(backend.base(), zmq.ZMQ.ZMQ_POLLIN);
PollItem[] itemsout = new PollItem[ZmqConfig.ZMQ_POLLITEM_SIZE];

itemsout[ZmqConfig.ZMQ_FRONTEND_POLLOUT] = new PollItem(frontend.base(), zmq.ZMQ.ZMQ_POLLOUT);
itemsout[ZmqConfig.ZMQ_BACKEND_POLLOUT] = new PollItem(backend.base(), zmq.ZMQ.ZMQ_POLLOUT);

Selector selector = ctx.createSelector();

while (!Thread.currentThread().isInterrupted()) {
  //  Wait while there are either requests or replies to process.
  zmq.ZMQ.poll(selector, items, ZmqConfig.ZMQ_MSG_POLLIN_TIMEOUT);

  if (frontend != backend) {
    zmq.ZMQ.poll(selector, itemsout, ZmqConfig.ZMQ_MSG_POLLOUT_TIMEOUT);
  }

The result is that the application was blocked in the zmq.ZMQ.poll and the cpu is 100%.It is likely that the application was hang and could not accept any request.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
fredoboulocommented, Oct 28, 2018

Hi @lsk569937453 did you try with the lastest SNAPSHOT? Fixes where committed in that area after the 0.4.3 release.

0reactions
daveyarwoodcommented, Apr 21, 2020

I’m going to assume that the issue has been fixed, given what @fredoboulo said above and the fact that this issue was created 1-1/2 years ago.

Feel free to open if the issue persists in the latest release version.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Does ZeroMQ Poll function use excessive CPU on .NET?
I verified on my own system that passing 500 to poll will cause CPU utilization between 90 and 100%. Setting the value to...
Read more >
100% CPU usage with zeromq Push socket with 0 listeners
I am currently in the process of implementing a communication pipeline between several processes using ZeroMQ, all using the Push/Pull mechanism ...
Read more >
Re: [zeromq-dev] ZMQ I/O threads CPU usage
In practice this is a step function I would say. It's enough a 10-20 nsec difference to jump from 10-15% to 100% cpu...
Read more >
Does ZeroMQ Poll function use excessive CPU on .NET?
I verified on my own system that passing 500 to poll will cause CPU utilization between 90 and 100%. Setting the value to...
Read more >
zmq_ctx_set(3) - 0MQ Api
This setting is an easier way to get the same result. When ZMQ_BLOCKY is set to false, all new sockets are given a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found