Difficulty getting StackletThread to work in my own project (figured out what was wrong myself)

Create issue
Issue #2214 resolved
Henri Tuhola created an issue

I have quite of problem in my interpreter: https://github.com/cheery/lever/

Adding these pieces (the gc.collect was uncommented) brought along segmentation faults, memory corruption and sometimes an error message "gc roots not found!" https://github.com/cheery/lever/blob/master/runtime/stdlib/gc.py https://github.com/cheery/lever/blob/master/runtime/eventloop.py

I think it may be in how I've implemented the greenlets in the language, or that I haven't done something, or then it's a bug in rpython. Here's the greenlet code btw: https://github.com/cheery/lever/blob/master/runtime/green.py

Could you help me out here? I've tried to scope down the issue and at least need a way to diagnose what's wrong here.

Comments (6)

  1. Henri Tuhola reporter

    Noticed that the thing I got to crash was actually easy to fix, but the fix didn't translate into my code. I started cutting out things from my code while maintaining the issues.


    The key thing here is that after the switch inside it does this:

    amount of returned args 139951950470232

    You may still cut off things from here, but I feel I'm sort of done for now. Got to do something else meanwhile.

  2. Henri Tuhola reporter

    I found out that my command to enable continuations did not reach rpython/memory/gctransform, where it sets root_walker.stacklet_support = True

    So there appears to be at least configuration issue in RPython&lever, which apparently isn't present in pypy configuration.

    I went to adjust the config and it started working. I'm not sure it's the correct way but I aped it from pypy. It looks like you need to get translation config that take place during translation into the driver.options, which is the first argument to the target(driver, args)

  3. Armin Rigo

    Indeed, you must pass the config object from translation to StackletThread(). You must not pass a random config object that you constructed yourself.

    Fixed in beb301687f9b by removing the need for the "config" parameter (we now have other means of internally fetching the translation-time config).

  4. Log in to comment