1,151 questions
1
vote
1
answer
790
views
Why is Nginx truncating the gRPC streaming response?
I've asked this question before but decided to delete that old question and reformulate it along with a minimum reproducible example. The issue is that when I deploy my gunicorn webserver on nginx, my ...
2
votes
1
answer
2k
views
Querying Django ORM inside celery task: SynchronousOnlyOperation: You cannot call this from an async context - use a thread or sync_to_async
We're using celery jobs alongside Django and within different celery tasks there are several occasions where the celery task is reading and writing to the database through Django's ORM.
Every once in ...
4
votes
2
answers
5k
views
How to call async method from greenlet (playwright)
My framework (Locust, https://github.com/locustio/locust) is based on gevent and greenlets. But I would like to leverage Playwright (https://playwright.dev/python/), which is built on asyncio.
Naively ...
0
votes
1
answer
139
views
pybottle gunicorn gevent not sharing global dict
from gevent import monkey
monkey.patch_all()
import bottle
app = bottle.Bottle()
COUNT = 0
@app.route('/inc', method='GET')
def count():
global COUNT
COUNT += 1
return COUNT
def main():...
0
votes
1
answer
134
views
Set ping_timeout with ssl on Flask-ScoketIO
I´m trying to run flask-socketIO + Gevent with this config:
App.py
if __name__ == "__main__":
socketio.run(
flask_app,
host='127.0.0.1',
port=5000,
...
18
votes
1
answer
19k
views
Gunicorn With Gevent, Performance Gain
Gunicorn Worker Class
Gunicorn has worker_class setting. Some possible values are
sync
gthread
gevent
Definitions from Luis Sena's nice blog
sync
This is the default worker class. Each process will ...
0
votes
1
answer
274
views
How to group failed APIs in Report with different parameters while using FastHttp in Locust
My API is like /api/v1/users/checkuser?PhoneNo
I am creating requests for random phone nos. When I am using HttpUser(Requests) it shows grouped results whenever API failed for any number. But when is ...
0
votes
1
answer
97
views
Custom Scheduler thread after launching is being run parallelly by main thread and workers of gunicorn
We have a scheduler service which gets spawned at the beginning of the program.
We moved our code base from python2 to python 3.
We are monkey patching with gevent before calling the scheduler thread.
...
0
votes
2
answers
1k
views
How does gevent ensure that the same thread-local variables are not shared between multiple coroutines
I have a Python 2 django project, which was started with gunicorn, and write a lot of threading.currentThread().xxxxxx ='some value' in the code.
Because the coroutine reuses the same thread, I am ...
5
votes
0
answers
2k
views
Gunicorn config.py file with 2 workers and 2 threads handles just 2 requests in parallel
There is no answer in the original github issue:
https://github.com/tiangolo/meinheld-gunicorn-flask-docker/issues/48
In the simple setup below I am expecting the gunicorn to process at least 4 ...
0
votes
1
answer
250
views
Python, pyinstaller raised an error as follows
when I ran the application, it raised error as follows.
My python version is 3.8.10 and pyinstaller version is 4.4.
How to deal with it?
Traceback (most recent call last):
File "run.py", ...
5
votes
1
answer
1k
views
Share django transaction across threads
I've a problem where one API implemented in a django (3.2) web app running with gunicorn (gevent) has to fetch different prices from multiple APIs and store those prices in the database (Postgres 13) ...
0
votes
1
answer
230
views
How to run gevent pool for "For Loop"?
for row in data:
data2 = collections.OrderedDict()
data2["ID"] = row[0]
data2["Bank Reconciliation Status"] = row[1]
...
0
votes
0
answers
1k
views
AttributeError: 'module' object has no attribute 'poll'
Trying to use gevent.select.poll for monitoring something under /sys. The below code works fine when using native Python. When i use gevent and do
from gevent import monkey
monkey.patch_all()
from ...
0
votes
0
answers
642
views
gevent.hub.LoopExit: This operation would block forever
Trying to use select.select in Python to monitor something under /proc/. Initially, it threw
r, w, x = select.select([],[],[fd])
AttributeError: 'function' object has no attribute 'select'
...
1
vote
1
answer
1k
views
Unable to run Flask app with gevent installed
I have a Flask application that won't run when gevent is installed.
Here is my app.py file:
from app import create_app, socketio
app = create_app()
if __name__ == '__main__':
socketio.run(app)
...
1
vote
0
answers
1k
views
gevent monkey patching with flask run fails in debug mode
I was trying to use grequests to make concurrent HTTP calls. To be able to test it on local, where I run flask dev server, I was trying to monkey patch gevent, where I'm facing some issues.
Here's my ...
2
votes
0
answers
221
views
Python Bigquery to_dataframe function is blocked when gunicorn is run with worker class gevent
When I run my flask app with worker-class=gevent on gunicorn, the server blocks.
gunicorn command
gunicorn app:app --workers=5 --worker-class=gevent --threads=5 --timeout=1800 --log-level=DEBUG
...
3
votes
0
answers
384
views
Revoking Celery Tasks Gevent Pool
I have been trying to revoke some Celery tasks by using
app.control.revoke(task_id)
As I am currently using gevent pool, I do understand that you would not be able to revoke a task that is currently ...
1
vote
0
answers
624
views
django async ORM sync_to_async executor swap out concurrent.futures.ThreadPoolExecutor when using gevent
This is just a long way of asking: "How does sync_to_async work with blocking IO, and gevent/psycogreen"?
For example:
from myapp.models import SomeModel
from asgiref.sync import ...
0
votes
1
answer
152
views
Python: gevent and libfaketime
At work I am transitioning a system from an older version of Python, and as a part of that I need to upgrade gevent to version 21.1.2.
Some of our tests use libfaketime.fake_time and time.sleep in the ...
0
votes
1
answer
591
views
Flask + gevent.pywsgi.WSGIServer + failed with SSLError + namecheap
So I have this web application running with Python's Flask and I use gevent.pywsgi.WSGIServer in order to make my application ready for production. My website is accessible from the Internet with all ...
4
votes
1
answer
820
views
How to make stdin/stdout redirection of pdb, in the context of a remote shell?
I am writing a web shell, using ptpython, gevent and Flask on the server side and xtermjs and websockets on the client side.
I would like the normal breakpoint() function of Python to work, using pdb.
...
0
votes
0
answers
161
views
Stop() gevent webserver is never called
I am not able to stop my Gevent webserver because my stop() function is never called.
My Gevent webserver (serve_forever()) is running in a single QThread thread.
My main application is (...
0
votes
1
answer
391
views
gevent queue does not raise Empty when queue.get invoked inside greenlets (other than the main greenlet)?
I am very new to gevent and my question might even be very naive, but the when I run following code I get queue empty exception.
case 1 makes sense
import gevent
from gevent import monkey
monkey....
0
votes
1
answer
2k
views
Bypassing SSL certificate verification using Flask, gunicorn, gevent
I am getting CERTIFICATE_VERIFY_FAILED errors because when I make a openurl request with urllib, it is checking the https certificates, and as my endpoint is using a self signed certificate (using our ...
0
votes
2
answers
1k
views
Issue Installing Locustio(0.7.5) Package
macOS == 10.15.7 || Django Project || Python 3.6.7
When I'm trying to install locustio version 0.7.5 package from pip it's giving error.I have tried the fixes mentioned in all the versions of answer ...
1
vote
0
answers
447
views
Python logging not showing up in gunicorn using gevent worker class
I have created a flask app whose main endpoint can be pinged to start a long-running function which may last up to a few hours. When this endpoint is hit, I use flask-executor, which is a wrapper for ...
0
votes
4
answers
771
views
Catching errors being thrown within module
I'm using gevent's WSGIServer's serve_forever() method with my own certificate.
Something like this:
http_server = WSGIServer(arguments)
http_server.serve_forever()
Obviously, since the certificate ...
1
vote
2
answers
4k
views
Can't fix error "RuntimeError: You need to use the gevent-websocket server." and "OSError: write error"
I am writing a website for Flask. I use a bunch of uWSGI + NGINX + Flask-Socketio. I use gevent as an asynchronous module. Errors occur during operation:
RuntimeError: You need to use the gevent-...
1
vote
1
answer
2k
views
Flask + Gevent, monkey.patch_all() breaks flask
I need to run monkey.patch_all() as I have a Flask server in my application in combination with the ValvePython library (I get errors about cannot switch to a different thread otherwise) however I'm ...
0
votes
0
answers
107
views
Why does fetch_profile_card return nothing when using Dota2 Python API?
I'm using the dota2 python library to gather data from the Dota2 game client. Using the initial example I use the provided function:
@dota.on('ready')
def fetch_profile_card():
jobid = dota....
1
vote
1
answer
1k
views
Libev related error when installing gevent
I am trying to install the Python package gevent with pip3 install gevent; the OS is Amazon Linux 2. The installation starts, but then at some point it stops with this error:
subprocess....
1
vote
1
answer
412
views
SQLAlchemy / gevent / cx_Oracle pool size stays at 1
I cannot get SQLAlchemy v. 1.3.22 with gevent 21.1.2 and cx_Oracle 8.1.0 to issue more than one query at a time despite the fact that I use a pool size of 50.
I am not sure which of the libraries it ...
0
votes
0
answers
251
views
zerorpc client will stuck after calling an Not exist server timeout for more 1,000 times
i user zerorpc to build my rpc program, but i found an interest phenomenon,
code
import zerorpc
c = zerorpc.Client(timeout=0.1)
c.connect("tcp://192.168.33.12:4242")
count = 0
while True:
...
2
votes
1
answer
1k
views
Gevent monkey patching - OverflowError
I tried to run my Flask project with gevent on Python3.7 on Raspberry Pi with gevent.monkey.patch_all() on the first line. But it ended up with this error:
Traceback (most recent call last):
File &...
1
vote
1
answer
362
views
Flask SocketIO + Gevent - buffering events from external processes
I want to send socket from asynchronous class in my Flask project. But when I send it, it takes enormous time before it arrives to JavaScript. I am sending it as:
socket_io.emit("event_name",...
0
votes
0
answers
121
views
why does this error appear when I start the flaskserver with gunicorin and gevent?
I'm trying to run a socketio flask server and ran into the issue above. I can't figure out where the overflow happens, despite the error message tells me. Help?!
app.py:
from flask import Flask, ...
12
votes
1
answer
2k
views
SynchronousOnlyOperation from celery task using gevent execution pool
Given celery running with these options:
celery -A openwisp2 worker -l info --pool=gevent --concurrency=15 -Ofair
Given this celery task from openwisp-monitoring:
@shared_task
def perform_check(uuid):...
0
votes
0
answers
269
views
How to get the return values from gevent Group calls?
In python I am using gevent to make parallel requests. The code without gevent would look like this:
for request in requests:
url = request["url"]
response = self.get(url)
and with ...
1
vote
1
answer
12k
views
I can't install eventlet/gevent/greenlet
I'm using Flask-SocketIO for a project of mine, and it's causing some issues, i.e. the client isn't able to connect to the server. I figured this may be due to it using the flask default development ...
0
votes
1
answer
331
views
Flask + Gevent PyWSGI + MySQL Connector: Sometime got hung when get_connection from pool
I'm developing a Flask server with Gevent PyWSGI and MySQL Connector as DB Driver. After monkey_patch to make it serving multiple requests concurrently, I found sometimes my server got hung with 2 or ...
0
votes
1
answer
723
views
How to Make grpc monkey-patched code open v4 socket only. Its opening a v6 socket by default
I am a beginner in python and have been facing a problem. I am trying to create v4 only grpc server sockets based on the expectation that my code will need to run in ipv6 disabled environments.
My ...
0
votes
1
answer
290
views
Does gevent monkey patched Queue.put yield (context switch)?
import gevent.monkey
gevent.monkey.patch_all()
import gevent
from queue import Queue
import random
import time
def getter(q):
while True:
print('getting')
v = q.get()
print(...
0
votes
1
answer
405
views
Gevent take first result to complete
I currently have some code which makes requests to a primary primary set of databases. Each request could take more than the timeout. I want to read the result of the one to finish first and decide ...
16
votes
3
answers
15k
views
Greenlet runtime error and deployed app in docker keeps booting all the workers
RuntimeWarning: greenlet.greenlet size changed, may indicate binary
incompatibility. Expected 144 from C header, got 152 from PyObject
And all the workers are being booted.
2020-09-28T14:09:41....
0
votes
1
answer
206
views
How to send a message or abort to an http error page if the web socket connection is not established?
The example below is taken from their documentation and modified slightly. Why doesn't it abort when the web socket connection is not established?
#!/usr/bin/python
import json
from bottle import ...
0
votes
1
answer
506
views
Started Flask app using gunicorn + gevent, Listening at: http://127.0.0.1:8000, but no response
I use gunicorn and gevent to start my flask app on my local with this command -
gunicorn api:app -k gevent --worker-connections 1000
It says -
[2020-09-24 11:06:32 +0000] [6] [INFO] Starting gunicorn ...
0
votes
1
answer
421
views
ConcurrentObjectUseError in gevent when using kombu
I'm using kombu in my code, and sometimes I get the following exception from kombu's producer's publish method. I think it is reproduced more in stress conditions, so probably a multithreading issue, ...
5
votes
1
answer
522
views
How can I control memory with Celery running on gevent?
We run Celery with gevent, and though memory consumption starts out great, over time, the memory usage grows. Assuming we're not able to track down why the memory bloats or leaks, is there a good way ...