Skip to content

Commit

Permalink
Merge pull request #2813 from tdadela/fix_worker_disconnection_deadlo…
Browse files Browse the repository at this point in the history
…ck_urlib3_gevent

Avoid deadlock in gevent/urllib3 connection pool (fixes worker heartbeat timeouts)
  • Loading branch information
cyberw authored Jul 22, 2024
2 parents c4b6571 + 593fb54 commit 49002b6
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions locust/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,17 @@
# dont show a massive callstack if trio is not installed
os._exit(1)

from gevent import monkey

if not os.getenv("LOCUST_SKIP_MONKEY_PATCH", None):
from gevent import monkey, queue

monkey.patch_all()

if not os.getenv("LOCUST_SKIP_URLLIB3_PATCH", None):
import urllib3

urllib3.connectionpool.ConnectionPool.QueueCls = queue.LifoQueue
# https://github.com/locustio/locust/issues/2812

from ._version import version as __version__
from .contrib.fasthttp import FastHttpUser
from .debug import run_single_user
Expand Down

0 comments on commit 49002b6

Please sign in to comment.