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

Aborts when iOS abuses EBADF to report a socket has been reclaimed #3046

Closed
acsearle opened this issue Apr 16, 2018 · 3 comments
Closed

Aborts when iOS abuses EBADF to report a socket has been reclaimed #3046

acsearle opened this issue Apr 16, 2018 · 3 comments

Comments

@acsearle
Copy link
Contributor

acsearle commented Apr 16, 2018

Issue description

ZeroMQ intermittently calls abort() on iOS.

iOS abuses EBADF to report that a socket can no longer be used because its resources have been reclaimed while the app was in the background. Apple documents this behaviour here:

https://developer.apple.com/library/content/technotes/tn2277/_index.html#//apple_ref/doc/uid/DTS40010841-CH1-SUBSECTION3

ZeroMQ asserts on the errno value EBADF in multiple locations, interpreting it as an impossible value indicating an internal error, so iOS apps with open sockets will intermittently crash after waking from background.

Environment

  • libzmq version (commit hash if unreleased): 4.2.3
  • OS: iOS 11.2.6

Minimal test code / Steps to reproduce the issue

Repeatedly sleep and wake an iOS device while running an app with an open ZeroMQ socket.

What's the actual result? (include assertion message & call stack if applicable)

"Bad file descriptor (src/tcp_connecter.cpp:403)"
(aborts)

What's the expected result?

On iOS only, treat EBADF like any other "networking problem", and recover by closing and attempting to reconnect.

@sigiesec
Copy link
Member

There is no libzmq version 4.3.2, you probably meant 4.2.3?

@acsearle
Copy link
Contributor Author

Sorry, corrected.

acsearle added a commit to acsearle/libzmq that referenced this issue Apr 17, 2018
acsearle added a commit to acsearle/libzmq that referenced this issue May 16, 2018
bluca added a commit that referenced this issue May 23, 2018
@bluca
Copy link
Member

bluca commented May 23, 2018

Fixed by #3047

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

No branches or pull requests

3 participants