-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Fix static _handler pickling error. #1842
Conversation
238889f
to
cdba792
Compare
Moves the subfunction _handler out to a module-level function, and parameterizes it with functools.partial(). Fixes the case when picking a sanic app which has a registered static route handler. This is usually encountered when attempting to use multiprocessing or auto_reload on OSX or Windows. Fixes sanic-org#1774
cdba792
to
aacbd02
Compare
Codecov Report
@@ Coverage Diff @@
## master #1842 +/- ##
=======================================
Coverage 92.17% 92.17%
=======================================
Files 23 23
Lines 2312 2314 +2
Branches 424 424
=======================================
+ Hits 2131 2133 +2
Misses 141 141
Partials 40 40
Continue to review full report at Codecov.
|
This fixes static files but unfortunately there are also problems with route decorators:
This can be tried on UNIX by changing sanic/server.py:930 to
|
Ah, ok. I was testing on Linux and not seeing that problem. Thanks for the tip @Tronic |
This can probably be still merged, as it does fix the static _handler pickle error, and adds a new test for that problem. |
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.
Fixes a problem and adds a test for it.
Further changes to be done in other PRs (don't pickle app, or fix the route decorators as well, or enable fork mode multiprocessing with 19.12LTS on MacOS py38). Windows cannot use fork mode but also has multiple worker support completely disabled for now.
I was hoping to get this change into the (belated) 20.03 release. Looks like it didn't make it. Still says one more review is required? |
Oh, when I saw the 20.3 PR go through yesterday, I thought we had done the 20.3 release. We should merge this now and it might still make the release. |
@Tronic I've made a fix for the websocket_handler pickle error, I will open a PR with that shortly. However I still cannot reproduce the route decorator pickling error. Are you able to share some code which reproduces the pickling error with route decorators? |
This can me merged? |
Yes, it's finished and approved and is ready to be merged. |
Moves the subfunction _handler out to a module-level function, and parameterizes it with functools.partial().
Fixes the case when picking a sanic app which has a registered static route handler. This is usually encountered when attempting to use multiprocessing or auto_reload on OSX or Windows.
Fixes #1774