Skip to content
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

How to handle ZMQError raised from cython? #783

Closed
Kentzo opened this issue Jan 8, 2016 · 10 comments
Closed

How to handle ZMQError raised from cython? #783

Kentzo opened this issue Jan 8, 2016 · 10 comments

Comments

@Kentzo
Copy link
Contributor

Kentzo commented Jan 8, 2016

I have the following block:

try:
    sock.send_multipart([identifier, b'', payload], zmq.DONTWAIT)
except zmq.ZMQError as e:
    LOG.warning("...")

However, when the following exception happened, it was not handled by the except statement:

  File "zmq/sugar/socket.py", line 329, in send_multipart
  File "zmq/backend/cython/socket.pyx", line 619, in zmq.backend.cython.socket.Socket.send (zmq\backend\cython\socket.c:6169)
  File "zmq/backend/cython/socket.pyx", line 666, in zmq.backend.cython.socket.Socket.send (zmq\backend\cython\socket.c:5931)
  File "zmq/backend/cython/socket.pyx", line 201, in zmq.backend.cython.socket._send_copy (zmq\backend\cython\socket.c:2400)
  File "zmq/backend/cython/checkrc.pxd", line 25, in zmq.backend.cython.checkrc._check_rc (zmq\backend\cython\socket.c:7055)
zmq.backend.cython.zmq.error.ZMQError: Unknown error
@minrk
Copy link
Member

minrk commented Jan 8, 2016

Can you provide more detail, and perhaps a complete test case that reproduces the error? What OS? What Python, pyzmq, libzmq versions? Normally, ZMQErrors are raised and catchable just fine, which is done all over the test suite.

@Kentzo
Copy link
Contributor Author

Kentzo commented Jan 8, 2016

I don't know how to reproduce, error is "unknown". I only have crashlog.

I would have more details if my except would be executed. Instead this exception is propagated to a higher except that catches everything.

Could it be that class is duplicated for cython and therefore unrecognized by my except?

Windows 8, Python 3.5, pyzmq 14.7.0, libzmq 4.1.4

Best Regards
Ilya Kulakov

On 8 янв. 2016 г., at 21:18, Min RK notifications@github.com wrote:

Can you provide more detail, and perhaps a complete test case that reproduces the error? What OS? What Python, pyzmq, libzmq versions? Normally, ZMQErrors are raised and catchable just fine, which is done all over the test suite.


Reply to this email directly or view it on GitHub.

@minrk
Copy link
Member

minrk commented Jan 8, 2016

Is your code Cython as well? Can you provide the rest of the traceback?

The suspicious piece for me is the string zmq.backend.cython.zmq.error.ZMQError. There is no module zmq.backend.cython.zmq.error, so I'm guessing Cython is doing something a bit wrong.

@Kentzo
Copy link
Contributor Author

Kentzo commented Jan 8, 2016

Our code is Python. It is packaged with pyqtdeploy (frozen and put into binary). However it's not supposed to anyhow affect names.

If you have in mind a test case that would make _checkrc to fail with an Unknown error, I'm happy to reproduce it under debugger.

@minrk
Copy link
Member

minrk commented Jan 8, 2016

I don't have any such test cases because that, too, shouldn't happen.

@Kentzo
Copy link
Contributor Author

Kentzo commented Jan 9, 2016

At least could you somehow ensure that raised exception is of right type?

Best Regards
Ilya Kulakov

On 9 янв. 2016 г., at 3:47, Min RK notifications@github.com wrote:

I don't have any such test cases because that, too, shouldn't happen.


Reply to this email directly or view it on GitHub.

@minrk
Copy link
Member

minrk commented Jan 9, 2016

I believe I already do, which is why I'm confused. The error message you show indicates that an Exception class that does not exist is being raised. I cannot produce a test case because I do not understand how to cause the behavior you are seeing.

@Kentzo
Copy link
Contributor Author

Kentzo commented Oct 30, 2017

I did not encounter this error ever again.

@Peque
Copy link
Contributor

Peque commented Jul 1, 2019

@Kentzo Did you stop encountering this error after an OS upgrade? (Windows 8 to Windows 10) or after a PyZMQ upgrade?

@Kentzo
Copy link
Contributor Author

Kentzo commented Jul 3, 2019

@Peque PyZMQ upgrade.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants