Locust: Immediate crash under python 3.7

Created on 26 Jul 2018  ·  8Comments  ·  Source: locustio/locust

Description of issue / feature request

Locust crashes immediately after launching under python3.7. The errors appear to have something to do with greenlet or gevent.

Expected behavior

It should work normally

Actual behavior

Immediate crash. Output:

> locust -f infrastructure/locust/locustfile.py

<env_path>/lib/python3.7/importlib/_bootstrap.py:219: RuntimeWarning: greenlet.greenlet size changed, may indicate binary incompatibility. Expected 144, got 128
  return f(*args, **kwds)
<env_path>/lib/python3.7/importlib/_bootstrap.py:219: RuntimeWarning: greenlet.greenlet size changed, may indicate binary incompatibility. Expected 144, got 128
  return f(*args, **kwds)
<env_path>/lib/python3.7/importlib/_bootstrap.py:219: RuntimeWarning: greenlet.greenlet size changed, may indicate binary incompatibility. Expected 144, got 128
  return f(*args, **kwds)
<env_path>/lib/python3.7/importlib/_bootstrap.py:219: RuntimeWarning: greenlet.greenlet size changed, may indicate binary incompatibility. Expected 144, got 128
  return f(*args, **kwds)
<env_path>/lib/python3.7/importlib/_bootstrap.py:219: RuntimeWarning: greenlet.greenlet size changed, may indicate binary incompatibility. Expected 144, got 128
  return f(*args, **kwds)
<env_path>/lib/python3.7/importlib/_bootstrap.py:219: RuntimeWarning: greenlet.greenlet size changed, may indicate binary incompatibility. Expected 144, got 128
  return f(*args, **kwds)
<env_path>/lib/python3.7/importlib/_bootstrap.py:219: RuntimeWarning: greenlet.greenlet size changed, may indicate binary incompatibility. Expected 144, got 128
  return f(*args, **kwds)
<env_path>/lib/python3.7/importlib/_bootstrap.py:219: RuntimeWarning: greenlet.greenlet size changed, may indicate binary incompatibility. Expected 144, got 128
  return f(*args, **kwds)
<env_path>/lib/python3.7/importlib/_bootstrap.py:219: RuntimeWarning: greenlet.greenlet size changed, may indicate binary incompatibility. Expected 144, got 128
  return f(*args, **kwds)
[2018-07-26 16:45:01,586] L08125.local/INFO/locust.main: Starting web monitor at *:8089
[2018-07-26 16:45:01,587] L08125.local/ERROR/stderr: Traceback (most recent call last):
[2018-07-26 16:45:01,587] L08125.local/ERROR/stderr: File "<env_path>/bin/locust", line 11, in <module>
[2018-07-26 16:45:01,587] L08125.local/ERROR/stderr:
[2018-07-26 16:45:01,587] L08125.local/ERROR/stderr: sys.exit(main())
[2018-07-26 16:45:01,587] L08125.local/ERROR/stderr:
[2018-07-26 16:45:01,587] L08125.local/ERROR/stderr: File "<env_path>/lib/python3.7/site-packages/locust/main.py", line 430, in main
[2018-07-26 16:45:01,588] L08125.local/ERROR/stderr:
[2018-07-26 16:45:01,588] L08125.local/ERROR/stderr: main_greenlet = gevent.spawn(web.start, locust_classes, options)
[2018-07-26 16:45:01,588] L08125.local/ERROR/stderr:
[2018-07-26 16:45:01,588] L08125.local/ERROR/stderr: File "src/gevent/greenlet.py", line 538, in gevent._greenlet.Greenlet.spawn
[2018-07-26 16:45:01,588] L08125.local/ERROR/stderr: File "src/gevent/greenlet.py", line 213, in gevent._greenlet.Greenlet.__init__
[2018-07-26 16:45:01,588] L08125.local/ERROR/stderr: File "src/gevent/_hub_local.py", line 80, in gevent.__hub_local.get_hub_noargs
[2018-07-26 16:45:01,588] L08125.local/ERROR/stderr: File "<env_path>/lib/python3.7/site-packages/gevent/hub.py", line 390, in __init__
[2018-07-26 16:45:01,589] L08125.local/ERROR/stderr:
[2018-07-26 16:45:01,589] L08125.local/ERROR/stderr: WaitOperationsGreenlet.__init__(self, None, None)
[2018-07-26 16:45:01,589] L08125.local/ERROR/stderr:
[2018-07-26 16:45:01,590] L08125.local/ERROR/stderr: File "src/gevent/_greenlet_primitives.py", line 42, in gevent.__greenlet_primitives.TrackedRawGreenlet.__init__
[2018-07-26 16:45:01,590] L08125.local/ERROR/stderr: SystemError
[2018-07-26 16:45:01,590] L08125.local/ERROR/stderr: :
[2018-07-26 16:45:01,590] L08125.local/ERROR/stderr: Objects/dictobject.c:1439: bad argument to internal function
[2018-07-26 16:45:01,590] L08125.local/ERROR/stderr:

Environment settings (for bug reports)

  • OS: macos Sierra (10.12.6)
  • Python version: 3.7.0
  • Locust version: 0.8.1

Steps to reproduce (for bug reports)

  • Create a virtualenv with python 3.7
  • activate the virtualenv
  • pip install locustio
  • make a locustfile (The quickstart one is fine)
  • run locust -f <path_to_locustfile>

Edit: the package name is locustio, not locust :p

Most helpful comment

Working fine under python 3.7 for me with the pinned gevent (1.3.5) and greenlet (0.4.13) versions

All 8 comments

I'm working around this by running locust in a python:3.6 docker container.

To be fair, https://github.com/locustio/locust#supported-python-versions doesn't list 3.7

http://www.gevent.org/changelog.html#unreleased

1.3.6 (unreleased)
gevent now depends on greenlet 0.4.14 or above. gevent binary wheels for 1.3.5 and below must have greenlet 0.4.13 installed on Python 3.7 or they will crash. Reported by Alexey Stepanov in issue #1260 and pkittenis in issue #1261.

My fresh install of locustio on Py3.7 gave me:

  • gevent [required: >=1.2.2, installed: 1.3.5]

    • greenlet [required: >=0.4.13, installed: 0.4.14]

installing and pinning greenlet==0.4.13 fixed it for me

:+1: I'll give that a try tomorrow!

I had the same issue:

  • Running Docker Python3.7 on Google Cloud Kubernetes.
  • Gunicorn, Greenlet and Gevent newest versions

Issues: Workers were timing out, after some fixing, the Runtime Error.

Fixed:

  • Changed Base Image to Python3.6
  • gunicorn==19.9.0
  • gevent==1.3.4
  • greenlet==0.4.13

Thanks for your help!

Working fine under python 3.7 for me with the pinned gevent (1.3.5) and greenlet (0.4.13) versions

this is working work now.. I just merged #885

I don't see anything in the diff that will fix the specific problem with gevent==1.35 detailed in this issue

fresh installs work under Python 3.7 now because gevent released 1.3.6 to PyPI

so the fix for anyone with this problem is to upgrade to gevent==1.3.6

Was this page helpful?
0 / 5 - 0 ratings