Opened 8 years ago

Closed 8 years ago

#1337 closed defect (fixed)

Runtime crashes on C callbacks

Reported by: Jaume Delclòs Coll Owned by:
Priority: major Milestone: 4.12.0
Component: core libraries Version: 4.11.0
Keywords: stack corruption Cc:
Estimated difficulty: hard

Description (last modified by sjamaan)

Running scheme code from a foreign-lambda called using a glib callback can make the runtime crash. The bug is not easy to reproduce, since every small change to the code can make it easier or harder to trigger.

I have been able to trigger it only when doing a significant amount of work on the callback, but taking more time to return doesn't necessarily make it easier to trigger, and sometimes multiple calls are needed.

The output when crashing is this:

    test: runtime.c:2797: C_save_and_reclaim: Assertion `av > C_temporary_stack_bottom || av < C_temporary_stack_limit' failed.

I'm running this on the following release (installed from the Arch Linux repos):

    Version 4.11.0 (rev ce980c4)
    linux-unix-gnu-x86-64 [ 64bit manyargs dload ptables ]
    compiled 2016-05-28 on yves.more-magic.net (Linux)

I'll attach my test code, which depends on bind (egg) and glib.

Attachments (4)

test.scm (1.2 KB) - added by Jaume Delclòs Coll 8 years ago.
Test code
valgind.log (2.0 KB) - added by Jaume Delclòs Coll 8 years ago.
Ran it on valgrind to see if anything weird popped up
easier.scm (750 bytes) - added by Jaume Delclòs Coll 8 years ago.
removed glib dependency
gdb.txt (2.4 KB) - added by Vasilij Schneidermann 8 years ago.
full gdb backtrace

Download all attachments as: .zip

Change History (7)

Changed 8 years ago by Jaume Delclòs Coll

Attachment: test.scm added

Test code

Changed 8 years ago by Jaume Delclòs Coll

Attachment: valgind.log added

Ran it on valgrind to see if anything weird popped up

comment:1 Changed 8 years ago by sjamaan

Component: unknowncore libraries
Description: modified (diff)
Estimated difficulty: hard
Keywords: stack corruption added
Milestone: someday4.12.0

Changed 8 years ago by Jaume Delclòs Coll

Attachment: easier.scm added

removed glib dependency

comment:2 Changed 8 years ago by Jaume Delclòs Coll

Summary: Runtime crashes inside glib main loopRuntime crashes on C callbacks

Changed 8 years ago by Vasilij Schneidermann

Attachment: gdb.txt added

full gdb backtrace

comment:3 Changed 8 years ago by sjamaan

Resolution: fixed
Status: newclosed

This should be fixed with dc5bd1e / 73c083a. Please reopen if it still doesn't work.

Note: See TracTickets for help on using tickets.