1,151 questions
1
vote
0
answers
731
views
Error on flask application (Invalid HTTP method)
I have a web application that uses flask and gevent. When I run the application everything works fine regarding the endpoints, however after some time (It can be days) the following error appears:
[...
0
votes
2
answers
972
views
Python - SQL transaction errors in multithreading (pymssql library)
The following code is generating transaction errors.
The COMMIT TRANSACTION request has no corresponding BEGIN TRANSACTION.
The larger the gevent pool, the more frequent the errors.
What I do is:
...
1
vote
1
answer
2k
views
How many websocket clients can flask-socketio handle when in Gunicorn with gevent?
I am considering the following setup:
A "normal" flask app
A socketio app
Flask SocketIO
gevent with Gunicorn, using GeventWebSocketWorker worker class
a single gunicorn worker
If you're ...
0
votes
1
answer
116
views
How can gevent.sleep() be canceled?
I have a greenlet that does some I/O and figures out how long to sleep until it should be awakened to continue. Say some external event should cause the sleeping greenlet to immediately awaken and ...
0
votes
0
answers
373
views
Bigchaindb 2.2.2 error installing while building gevent
Error compiling Cython file:
------------------------------------------------------------
...
cdef load_traceback
cdef Waiter
cdef wait
cdef iwait
cdef ...
1
vote
0
answers
465
views
Problem with running Socket IO through gunicorn on Fly.io
I am trying to host my flask website on fly.io. My website uses the flask_socketio library and needs a 2 ended connection with the client and server, so this is the gunicorn command I use in the ...
3
votes
0
answers
394
views
Python Gunicorn with Gevent workers very slow than pure flask for time.localtime
I have a controller that's very slow when running in Gunicorn/Gevent (21sec) over pure Flask (5s)
Upon profiling there are 300K calls to Python's built-in method time.localtime. Here's a simplified ...
1
vote
1
answer
324
views
How to receive data from python Thread in a greenlet without blocking all greenlets?
We have an existing codebase that is heavily Thread based which we're trying to expose through flask-socketio. I can't find a mechanism to have a greenlet wait for data from a Thread without blocking ...
0
votes
0
answers
47
views
Python Gevent is iterating over characters and not the full url
I'm new to gevent and i have a script which download images and read the urls from a excel file.
I would like to speed up the process and that's where i found gevent
But when i try to run my script it ...
2
votes
2
answers
4k
views
gunicorn worker (gevent) failed to boot using python 3.11
We are using alpine 3.16.2, python 3.11.0 and pip 22.3 along with bunch of other libraries (django, google, etc.) installing via pip
gunicorn==20.1.0
gevent==22.10.2
greenlet==2.0.1
gunicorn worker (...
2
votes
2
answers
840
views
PyTest exits with TypeError: 'NoneType' object is not callable when collecting test cases
When running pytest --collect-only, PyTest collects the correct tests, but terminates with this:
Traceback (most recent call last):
File "/data/anaconda/envs/env/lib/python3.9/logging/__init__....
1
vote
0
answers
1k
views
How to resolve "coroutine 'Launcher.killChrome' was never awaited" error?
I am trying to automate searching on a website. I am using requests_html in headless mode for it.
I have written the following code in iPython. This works fine if k <= 20, otherwise it just hangs ...
3
votes
0
answers
786
views
Django IO bound performance drop with gunicorn + gevent
I have been working on an IO bound (only simple queries to database for getting info or updating it) application written in Django. As application is mostly db and redis queries, I decided to use ...
1
vote
0
answers
435
views
Celery worker connection with Rabittmq met broken pipe error IN Gevent Mode
This does not happen with our dev environment, tasks there run on a much smaller db, so issuing much less db queries and external requests, I imagine this issue might have something to do with task ...
2
votes
1
answer
7k
views
MonkeyPatchWarning: Monkey-patching ssl after ssl has already been imported may lead to errors
Background
I've got a Django app that is heavily iobound, so per docs I've read, I'm trying to get gunincorn working with gevent for the best performance.
Error
dev1 | Patching Started
...
3
votes
0
answers
158
views
Is there a way to see which libraries are being monkey patched when running celery with eventlet pool in a Django application?
I am currently running a Django project that offloads work to celery background workers.
For CPU-bound tasks the fork pool is working great running like so:
celery -A myApp worker -l INFO -E -n worker ...
0
votes
1
answer
656
views
Python unit testing: How to stop gevent.monkey.patch_all() affecting asyncio tests?
We have a python test suite that tests code that uses gevent.monkey.patch_all(). The tests run fine.
In the same code base we have an alternative entrypoint that uses asyncio. There are also tests for ...
0
votes
0
answers
1k
views
Mac M1 - ERROR: Could not find a version that satisfies the requirement gevent==21.8.0
Trying to install gevent in virtual env from a requirements.txt using pip-sync but getting this error.
Collecting gevent==21.8.0
Using cached gevent-21.8.0.tar.gz (6.2 MB)
Installing build ...
7
votes
1
answer
1k
views
gevent 21.12.0 installation failing in mac os monterey
I am trying to install gevent 21.12.0 on Mac OS Monterey (version 12.6) with python 3.9.6 and pip 21.3.1. But it is failing with the below error. Any suggestion?
(venv) debrajmanna@debrajmanna-...
1
vote
0
answers
254
views
gunicorn increasing response time
The current flask setup is as follows, this is not the exact code, just a brief overview example
src/app.py
from gevent.pywsgi import WSGIServer
app = Flask(
__name__,
template_folder="../...
0
votes
1
answer
420
views
Does Kafka to support bidirectional?
I have two servers where bidirectional communication needs to be happened.
For kafka I have 2 topics 2 producers and 2 consumers. Trying to communicate server 1 to 2 with 1topic and 1 consumer and 1 ...
0
votes
0
answers
721
views
whats the maximum number of requests gevent wsgi server handle
What is the maximum number of requests gevent wsgi can handle. I have a flask application which is served via gevent wsgi server. I am unaware how many requests gevent wsgi will handle per second.
I ...
0
votes
0
answers
74
views
Terminate a gevent lib Greenlet when encountering a long running regex parse
This doesn't address my question: How to timeout function in python, timeout less than a second
In the comments, it states the issue I'm having:
According to the signal documentation, this won't work: ...
0
votes
0
answers
121
views
The gevent library is used to implement the coroutine, but the execution is slower
There are five categories, and each category contains multiple TXT files. I need to count the number of occurrences of each word in each file. I want to improve the efficiency of the program through ...
1
vote
0
answers
411
views
Celery task is delayed when another task runs, how do I make sure multi-threading here?
We have a celery worker and a beat scheduler running in production, in a dedicated Kubernetes POD.
We used gevent and run celery with concurrency set to 200.
celery -A app worker -l info --pool=gevent ...
1
vote
0
answers
872
views
gunicorn server with gevent worker start workers sequentially when cpu bound process is used
I am using gunicorn with gevent worker. When I start server and init has some cpu bound process than it's showing linear growth in time to start the app even though I have 16 core and my system is ...
2
votes
0
answers
2k
views
How to make async call inside a sync operation in locust for WebSocket Testing?
This is my WebSocket library similar to https://github.com/SvenskaSpel/locust-plugins/blob/master/locust_plugins/users/socketio.py
class WebsocketClient:
abstract = True
message_regex = re.compile(r&...
1
vote
0
answers
652
views
Why does gevent give "Too many open files" error during load testing?
I have a setup consisting of nginx, gunicorn, and django. All these run through docker containers. In django, when a request comes, I save image files that are sent through request.
Since my code is ...
1
vote
1
answer
1k
views
Enabling gevent debugging in Google Colab
I want to used the grequests library in a Google Colab notebook, however upon importing it (and patching it using gevent.monkey), the program spits out a random amount of the following warning:
It ...
2
votes
0
answers
1k
views
How to prevent monkey patch when gunicorn is loaded?
I am using gunicorn with two gevent workers for deploying a flask application.
So, i manually monkey patch before the gunicorn loaded like this.
from gevent import monkey
monkey.patch_all(subprocess=...
0
votes
1
answer
2k
views
ModuleNotFoundError: No module named ' '
I am attempting to run python manage.py runserver and I am getting a
ModuleNotFoundError: No module named ' '
The entirety of the output can be seen here:
(venv) danieljohnson@MACHPXNV2CL2Y project % ...
1
vote
0
answers
86
views
How to Increase Flask RestAPI Concurrent Request Performance
I'm using "gunicorn" and "gevent" to serve flask APIs with 4 workers. When I do AB (apache-benchmark) test to a single API response time per request is 60ms. However, when I call ...
0
votes
1
answer
699
views
Sending keyboard typed data to Webpage using flask SSE
I am trying to send Keyboard typed data to a webpage using Flask SSE following this tutorial. I could send the data. But the problem is that I could send the data only when the cursor is focused on ...
5
votes
4
answers
9k
views
Gevent cant be installed on M1 mac using poetry
I tried to install many dependencies for a virtual environment using poetry. When it gets to gevent (20.9.0) it gets the following
import error:
ImportError: dlopen(/private/var/folders/21/...
2
votes
0
answers
1k
views
ThreadPoolExecutor is not monkey-patched to the Gevent's one
I want to execute some long-lived tasks asynchronously by submitting them into a thread pool.
However, gevent's monkey patching does not do the trick for from concurrent.futures import ...
7
votes
1
answer
7k
views
What is the mechanism between max_requests and max_requests_jitter in gunicorn
According to the official guide
https://docs.gunicorn.org/en/latest/settings.html#settings
a worker will restart when it has handled max_requests requests.
But when max_requests_jitter is set, a ...
0
votes
0
answers
564
views
Why gevent's join() of one greenlet runs all other greenlets?
Consider following example:
import gevent
def anna():
while True:
print('anna')
gevent.sleep(0)
def bob():
while True:
print('bob')
gevent.sleep(0)
task1 = ...
0
votes
1
answer
181
views
combination of using Google Bigtable and Cloud Pubsub occasionally hangs
I've made a web API application using Gunicorn(Gevent) + Flask chain.
When It received a data, it read rows from 5 different tables in Bigtable with singleton pattern then do a cpu bound task.
After ...
9
votes
1
answer
6k
views
How to set gunicorn worker number in a kubernetes' pod
I'm running a flask application with gunicorn and gevent worker class. In my own test environment, I follow the official guide multiprocessing.cpu_count() * 2 + 1 to set worker number.
If I want to ...
0
votes
1
answer
873
views
Using Gevent inside locust task increases exponentially
I have a web server whose REST API I want to load test. I use locust==2.5.1, python==3.8.2.
Locust Config:
Users:3
Spawn Rate: 3
from locust import HttpUser, task, between, constant_throughput
...
1
vote
2
answers
2k
views
Can't install gevent on termux, anyone can help me?
~ $ pip install gevent
Collecting gevent
Using cached gevent-21.12.0.tar.gz (6.2 MB)
Installing build dependencies ... done Getting requirements to build wheel ... done
Preparing ...
1
vote
1
answer
2k
views
How to deploy flask with socketio to heroku and have it upgrade to websockets
Locally, it works. Socketio upgrades to websocket instead of resorting to polling.
This is obvious from the logs:
...
FYnWEW0ufWGO7ExdAAAA: Received request to upgrade to websocket
...
0
votes
1
answer
194
views
Gevent infinite queue consumer?
I am trying to have a consumer on a separate thread that never dies. The consumer can get arbitrary number of tasks to execute.
I have been fiddling with asyncio and gevent but haven't managed to get ...
0
votes
1
answer
219
views
Why Use gevent.joinall() Instead of pool.imap_unordered() to Run Greenlets?
The title says it all. It seems better and faster to use one of the methods belonging to gevent.Pool to run greenlets in parallel (sort-of) in a pool, as opposed to gevent.joinall(). What are the ...
1
vote
0
answers
1k
views
How is the reusing of TCP connection of `requests.Session` (keep-alive connection) handled by `gevent`?
We know that requests.Session keeps a single TCP connection alive for multiple HTTP requests/responses sent through it. But what happens when requests is patched by gevent.monkey?
Since we can ...
1
vote
1
answer
850
views
Why Use Gevent Pool to Manage Greenlet Connections in a Server?
I am working with a Python server which spawns a greenlet for each connection to the server. Currently, the server doesn't make use of a greenlet pool. While it was my hunch that using a pool would ...
0
votes
0
answers
400
views
Can not understand why `redis + gevent + multithreading` performence is so pool
Question
I am trying to use gevent to improve my programe to interact with redis, but when use gevent + redis-py in multi threading scenario, i found that the performence is so pool. When i comment ...
12
votes
2
answers
27k
views
ERROR: Could not build wheels for gevent, which is required to install pyproject.toml-based projects
I am using python 3.9.
I tried to install a python package :
pip.exe install gdbgui==0.13.2.0
But it gives me an error
ERROR: Failed building wheel for gevent
Failed to build gevent
ERROR: Could not ...
0
votes
1
answer
937
views
WSGIServer not working with https and python3
We got a old package write in python2, and working on upgrade it to python3. It's a web app and we are using the WSGIServer.
from gevent import pywsgi
from geventwebsocket.handler import ...
1
vote
0
answers
1k
views
Failed to build gevent
When trying to install gevent on Windows using
pip install gevent-websocket
It fails to build wheel for gevent..
In file included from deps\libuv\src\win/internal.h:29,
from deps\...