[pypy-issue] Issue #2089: Crash in PyPy 2.6.0 (linux64) with gevent 1.1b1 (pypy/pypy)

Jay Oster issues-reply at bitbucket.org
Tue Jul 21 05:18:13 CEST 2015


New issue 2089: Crash in PyPy 2.6.0 (linux64) with gevent 1.1b1
https://bitbucket.org/pypy/pypy/issues/2089/crash-in-pypy-260-linux64-with-gevent-11b1

Jay Oster:

Minimal test case to reproduce: https://gist.github.com/parasyte/b3e0f80b81a9c7b291d3

Requires gevent 1.1b1:

```
#!bash

$ pip install --upgrade pip setuptools
$ pip install gevent==1.1b1
```

Occurs on pypy-2.6.0-linux64 (not on OSX). Earlier versions of PyPy are not affected.

While building this minimal test case, I determined that the crash is dependent on stack depth, which the `depth` function exploits with recursion.

`gevent.monkey.patch_builtins()` is new to 1.1b1, and patches `__import__` to operate atomically with a reentrant lock. This may be a gevent bug (I will file a ticket for their tracker as well.)

I've seen two different stack traces from RPython with this test case, just keep running it until and you'll eventually see both.

```
Fatal error in cpyext, CPython compatibility layer, calling PyObject_GetItem
Either report a bug or consider not using this particular extension
<OperationError object at 0x7f482cd96940>
RPython traceback:
  File "pypy_module_pypyjit_interp_jit.c", line 340, in portal_5
  File "pypy_interpreter_pyopcode.c", line 3578, in handle_bytecode__AccessDirect_None
  File "pypy_interpreter_pyopcode.c", line 5853, in dispatch_bytecode__AccessDirect_None
Segmentation fault (core dumped)
```

And this one less frequently:

```
Fatal error in cpyext, CPython compatibility layer, calling PyObject_GetItem
Either report a bug or consider not using this particular extension
<OperationError object at 0x7f4ff4e9df00>
RPython traceback:
  File "pypy_module_cpyext_api_1.c", line 17394, in PyPyObject_GetItem
  File "pypy_module_cpyext_pyobject.c", line 850, in make_ref
  File "pypy_module_cpyext_pyobject.c", line 1854, in create_ref
  File "pypy_module_cpyext_pyobject.c", line 4587, in BaseCpyTypedescr_allocate
  File "pypy_module_cpyext_pyobject.c", line 850, in make_ref
  File "pypy_module_cpyext_pyobject.c", line 1738, in create_ref
  File "pypy_module_cpyext_typeobject.c", line 35294, in type_attach
  File "pypy_objspace_std_objspace.c", line 1038, in getattr
  File "pypy_interpreter_gateway.c", line 846, in BuiltinCode2_fastcall_2
  File "pypy_interpreter_gateway.c", line 2779, in BuiltinCode_handle_exception
Segmentation fault (core dumped)
```




More information about the pypy-issue mailing list