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

When raising ZMQError: Permission denied it would be helpful if context were given #1287

Open
bowlofeggs opened this issue May 7, 2019 · 2 comments

Comments

@bowlofeggs
Copy link

Greetings!

I recently received this traceback:

Traceback (most recent call last):                                                                  
  File "/usr/lib/python3.7/site-packages/moksha/hub/hub.py", line 455, in __init_producers 
    producer_obj = producer_class(self)                                                             
  File "/usr/lib/python3.7/site-packages/moksha/hub/monitoring.py", line 47, in __init__            
    self.socket.bind(endpoint)    
  File "zmq/backend/cython/socket.pyx", line 547, in zmq.backend.cython.socket.Socket.bind 
  File "zmq/backend/cython/checkrc.pxd", line 25, in zmq.backend.cython.checkrc._check_rc 
zmq.error.ZMQError: Permission denied

It turned out that it was unable to create /var/run/fedmsg/monitoring-fedmsg-hub.socket, but it would have made debugging easier for me if it had told me that along with the ZMQError.

Could we make it so that the error includes info about what it was getting permission denied on? Something like this would have been helpful:

zmq.error.ZMQError: Permission denied: Unable to bind to /var/run/fedmsg/monitoring-fedmsg-hub.socket

Thanks!

@minrk
Copy link
Member

minrk commented May 8, 2019

That would indeed be great! It might be difficult, though, because we don't have path information in the underlying error. All we have is that it was EPERM.

To do this, I think we'd need to special-case error handing in bind/connect and re-raise a new error:

# pseudo-ish code
try:
   ...
except ZMError as e:
    if EPERM and url.startswith('ipc://'):
        raise ZMQError(EPERM, message=message_with_url)

@minrk
Copy link
Member

minrk commented Jul 9, 2019

#1301 does this with ENOENT, EPERM could be added as well.

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

2 participants