Segfault when running a very specific set of tests

Issue #617 closed
Former user created an issue

Sorry for the vague description, but I haven't been able to track down exactly what causes this...

The issue can be seen in this CI run (final test, just before the coverage report), with the relevant command here.

What appears to cause it is this function definition.

I figured this out through trial and error by rolling back commits and removing various lines. It seems that whenever that function and its parent function are both defined, coverage.py will segfault when running exactly that test. Moving the inner function to a different scope or renaming it seems not to change this.

None of that code actually runs in the test case, and it seems to only be an issue when the parent function is defined.

For the time being we have simply replaced that function with a non-recursive implementation, but it still seemed like a good idea to report this issue... Any idea what might be happening, or what could be done to further debug this?

Comments (7)

  1. Tristan Maat

    Continuing from this account because I didn't have one when creating the issue...

    Unfortunately I haven't found a way to reproduce it outside of that very specific test case. Another member of the group working on that project recently ran into this as well - we might get something more tangible from there, though we haven't really been able to pinpoint what causes it in that case yet.

    This is a bit of a cry for help, to be frank, if you can think of something that might help reproduce this please do tell :)

  2. Ned Batchelder repo owner

    Can I run the test suite? Debugging a segfault is a pain. If it's happening in my C code, I use print statements to narrow down where it is. If it's not happening in my C code, then ¯\_(ツ)_/¯

  3. Tristan Maat

    I'd gladly set up a branch that only runs the relevant test with a locally installed pycoverage and let you hack away on it if that would be useful :)

  4. Ned Batchelder repo owner

    If you can give me very specific instructions ("Clone this repo at this commit, install these prerequisites, run this command"), then I can try to debug it. It might take a while before I get around to it, though.

  5. Tristan Maat

    Hm, I'm really sorry, but I can't manage to reproduce this issue outside of gitlab CI runners... Even when running it in docker using the exact same image.

    Whatever is causing it does not happen when running coverage==4.2, so at least we have a way around it for now.

  6. Log in to comment