question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

I tried running things with pypy and got crashes. They are weird and this is the minimal I got:

import fiona
import json

with fiona.open("ne_10m_admin_0_countries.shp") as source:
    countries = list(source)

with open("randomfilenameiuiubiqubeiquequze", "w") as sink:
    for country in countries:
        sink.write(json.dumps(country)+"\n")

The shapefile is from the latest http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/cultural/ne_10m_admin_0_countries.zip

Running this with pypy3 I get three different tracebacks, seemingly on random.

RPython traceback: File “rpython_jit_metainterp_1.c”, line 41233, in assembler_call_helper_65 File “rpython_jit_metainterp_8.c”, line 21619, in AbstractResumeGuardDescr_handle_fail File “rpython_jit_metainterp_8.c”, line 30933, in AbstractResumeGuardDescr__trace_and_compile_from File “rpython_jit_metainterp_8.c”, line 38152, in MetaInterp_handle_guard_failure File “rpython_jit_metainterp_8.c”, line 41192, in MetaInterp__handle_guard_failure File “rpython_jit_metainterp_1.c”, line 5322, in MetaInterp__interpret File “rpython_jit_metainterp_2.c”, line 22084, in MIFrame_run_one_step File “rpython_jit_metainterp_4.c”, line 13161, in handler_ref_return_1 File “rpython_jit_metainterp_4.c”, line 61659, in MetaInterp_finishframe *** Invalid usage of a dying CPython object ***

cpyext, the emulation layer, detected that while it is calling an object’s tp_dealloc, the C code calls back a function that tries to recreate the PyPy version of the object. Usually it means that tp_dealloc calls some general PyXxx() API. It is a dangerous and potentially buggy thing to do: even in CPython the PyXxx() function could, in theory, cause a reference to the object to be taken and stored somewhere, for an amount of time exceeding tp_dealloc itself. Afterwards, the object will be freed, making that reference point to garbage.

PyPy could contain some workaround to still work if you are lucky, but it is not done so far; better fix the bug in the CPython extension. Aborted (core dumped)

or

RPython traceback: File “rpython_jit_metainterp_2.c”, line 50548, in handle_jitexception_68 *** Invalid usage of a dying CPython object *** (…)

or

RPython traceback: File “pypy_module_pypyjit.c”, line 183, in portal_12 File “pypy_interpreter_2.c”, line 40731, in handle_bytecode__AccessDirect_None File “pypy_interpreter_2.c”, line 51912, in dispatch_bytecode__AccessDirect_None *** Invalid usage of a dying CPython object *** (…)

Fiona Fiona-1.7.11.post1-cp36-cp36m-manylinux1_x86_64.whl pypy3 says: Python 3.5.3 (3f6eaa010fce78cc7973bdc1dfdb95970f08fed2, Feb 12 2018, 22:20:44) [PyPy 5.10.1 with GCC 7.3.0] on linux gdal 2.2.3 Archlinux

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
rbuffatcommented, Mar 16, 2018

@sgillies The counter argument would be, that somebody has some rather large computations, that he wants to speed up with pypy, and then export the results with fiona. But I think this will be a rather limited use case.

1reaction
micahcochrancommented, Mar 13, 2018

If you are only using a shapefile, you might try pyshp, which is python-only code. Currently, it isn’t tests for pypy, but it might not be too hard to get it to working.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Crash under PyPy 7.0.0 · Issue #780 · psf/black - GitHub
The file appears to have been reformatted anyway. PyPy 7.1 has the same issue. The text was updated successfully, but these errors were ......
Read more >
crash - PyPI
The CrateDB Shell (aka Crash) is an interactive command-line interface (CLI) tool for interacting with CrateDB. Screenshot. A screenshot of Crash ...
Read more >
PPC64 JIT: pip crashes with stack overflow - PyPy - Heptapod
Haven't got to the bottom of it, yet. Bit of a heisenbug, haven't been able to find out what the regex is that...
Read more >
Simple program (2 for loops) crashes in PyPy while working ...
This is a simple program written to solve CodeJam's recycled numbers (I know it can be improved). It works with CPython, but crashes...
Read more >
PyPy 2.0.1 - Bohr Smørrebrød
The fixes are mainly about fatal errors or crashes in our stdlib. See below for more details. What is PyPy?¶. PyPy is a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found