-
-
Notifications
You must be signed in to change notification settings - Fork 892
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
Watchdog installed breaks development server #2102
Comments
This package does not provide a web server. This is an inconpatibility between watchdog and your chosen web server. If you are using the Flask development web server, note that it also has a code reloading feature, the issue might by these two reloading features interfering with each other. I suggest you try running your application with debug mode disabled if you are using watchdog for code reloads. Maybe that solves your problem. |
Maybe I wasn't clear. The server I'm running is the one provided by this package, I'm running:
The docs of that function states The Flask development server works fine. Flask automatically uses watchdog if it's installed. The issue lies in the incompatibility between the SocketIO web server and watchdog. |
I don't think you understand the extent of what this package does. As I said above, there is no web server here. All this package does is add routes on top of the web server you use for your Flask application. The |
Oh, I see. So all this package does is add the /socket.io route to the flask application. Thank you for the explanation! I thought this was meant to be run as a separate server. I wonder why my Flask development server, which I run with Thank you again, I'll try to dig more. |
Do you have gevent or eventlet installed? If you have, then you are not using the flask web server, so the issue is with one of these other web servers. |
I do have gevent installed. Does that mean the incompatibility is between gevent and watchdog? |
@rstcruzo the fact that watchdog-gevent exists is a pretty good indication that these two packages do not like each other when used on their own. Note that if you are using gevent, then you are not using the Flask development web server, you are using the gevent web server. Maybe you did not realize this, but this could be part of the confusion. Any reason you need gevent in your project? You can try not using it. Flask-SocketIO works well with standard threads, and this would eliminate any incompatibilities with watchdog. If you uninstall gevent (and eventlet if you have it installed) then Flask-SocketIO will automatically decide to use threads for its concurrency needs. |
Now that I'm using I want to use gevent because it is said to be more efficient; greenlets are lighter than threads. To my understanding, If I use Werkerzug in development mode and gevent in production, I should be fine, as watchdog isn't used in production. Or am I missing something? |
I suppose you can, assuming nothing else conflicts with gevent. |
@miguelgrinberg Quick question: is gevent-websocket needed anymore? I see you removed it from python-socketio here, but I still see a warning "WebSocket transport not available. Install gevent-websocket for improved performance." when it's not installed. The warning seems to be coming from here |
No, gevent-websocket is not needed because in recent versions the simple-websocket package provides the same functionality. The warning in this package is outdated, I will remove it. |
Describe the bug
When I start the socketio server in development mode (config["DEBUG"] = True) and watchdog is installed, no client can't connect to it. I don't see any errors on server side but every client reports Connection Refused.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The client can connect successfully
Logs
No error logs on server side.
On client side:
Additional context
I can't just uninstall watchdog because I'm also using dramatiq which uses it for autoreloading the code.
The text was updated successfully, but these errors were encountered: