-
-
Notifications
You must be signed in to change notification settings - Fork 90
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
Catch "Protocol wrong type for socket" on OSX also for non-blocking sockets #31
Conversation
…ockets This was originally fixed for regular sockets in cherrypy/cherrypy#1392 But it seems it can also occur during the sending on non-blocking sockets https://forums.sabnzbd.org/viewtopic.php?f=2&t=22728&p=112251 This is on our build-in CP 8.1.2, but since the code seems identical it can occur in any CP version.
socket_errors_nonblocking = plat_specific_errors( | ||
'EAGAIN', 'EWOULDBLOCK', 'WSAEWOULDBLOCK') | ||
|
||
if sys.platform == 'darwin': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why just OS X?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's osx specific, just like the previous fix. It's all in the article that's linked from the previous fix: cherrypy/cherrypy@2ad0cb2
Summary: socket isn't ready yet, Apple made there own error code. Only happens from time to time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still it's not added to non-blocking error codes in that patch. Why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no clue, probably because the original author didn't experience it with non blocking ones. But as you can see from the linked issue on our forum, it does happen for non blocking ones.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense
socket_errors_nonblocking = plat_specific_errors( | ||
'EAGAIN', 'EWOULDBLOCK', 'WSAEWOULDBLOCK') | ||
|
||
if sys.platform == 'darwin': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense
I'm the author of the original PR - I don't really remember, but I don't think it was deliberate that I didn't add it to the non-blocking ones. I probably just saw |
Well, anyway it's going to be released in v5.5.1 |
@webknjaz It seems this patch did not actually work, users are still reporting it.
It seems to be of the general |
@Safihre That stacktrace looks like you're still using an old CherryPy with wsgiserver integrated, and not cheroot. |
Yes but it has the same patches. Does not matter for the issue here. |
@Safihre Since you're vendoring CherryPy you might've messed up with patching it. |
If you didn't spread cherrypy into 15 different (sub)dependencies, we could stay up to date with the latest patches instead of this. |
Well, you still can: just use git submodules and keep patches in forks. |
@Safihre In [1]: import cheroot.errors
In [2]: cheroot.errors.plat_specific_errors('EPROTOTYPE')
Out[2]: [91] |
FWIW I'm already only depending on cheroot without CherryPy, so I appreciate the separation 😉 @Safihre do you have a way to check whether you can reproduce this with a vanilla, up-to-date cheroot? |
My patch seems to work as it's supposed to. >>> cherrypy.wsgiserver.plat_specific_errors('EPROTOTYPE')
[41]
>>> cheroot.errors.plat_specific_errors('EPROTOTYPE')
[41] Very strange. Maybe something gets altered during the packaging process using @The-Compiler @webknjaz
To
We ship our software to over 100.000+ users. While for the packaged Windows/macOS we can use In the end it's all open-source and who am I to complain really? |
Alright, I think it's better to create a separate issue with your findings once you investigate your packaging and maybe find smth interesting. Meanwhile I still feel that there is more flexible way to vendor cherrypy with its dependencies. Maybe you could even use installation bundles or run simple |
This was originally fixed for regular sockets in cherrypy/cherrypy#1392
But it seems it can also occur during the sending on non-blocking sockets https://forums.sabnzbd.org/viewtopic.php?f=2&t=22728&p=112251
This is on our build-in CP 8.1.2, but since the code seems identical it can occur in any CP version.
Code section is now here: https://github.com/cherrypy/cheroot/blob/master/cheroot/makefile.py#L55-L63