Summary
Runtime crashes on C callbacks
Metadata
- Id: 955717c142952591cbfa0390eb654a103ec1a1ec
- Trac id: 1337
- Type: defect
- Reporter: cosarara
- Owner:
- Cc:
- Status: closed
- Component: core libraries
- Estimated difficulty: hard
- Resolution: fixed
- Priority: major
- Milestone: 4.12.0
- Version: 4.11.0
- Changetime: 2016-12-29 22:45:25 UTC
- Created: 2016-12-20 16:03:44 UTC
- Keywords: stack corruption
Attachments
- 955717c142952591cbfa0390eb654a103ec1a1ec/attachments/test.scm
- 955717c142952591cbfa0390eb654a103ec1a1ec/attachments/gdb.txt
- 955717c142952591cbfa0390eb654a103ec1a1ec/attachments/valgind.log
- 955717c142952591cbfa0390eb654a103ec1a1ec/attachments/easier.scm
Description
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.
Changes and comments
[2016-12-20 16:04:17 UTC] cosarara attached test.scm (description=Test code)
[2016-12-20 16:10:58 UTC] cosarara attached valgind.log (description=Ran it on valgrind to see if anything weird popped up)
[2016-12-20 16:16:28 UTC] sjamaan set keywords to stack corruption
[2016-12-20 16:16:28 UTC] sjamaan set difficulty to hard
[2016-12-20 16:16:28 UTC] sjamaan changed component from unknown to core libraries
[2016-12-20 16:16:28 UTC] sjamaan changed description
[2016-12-20 16:16:28 UTC] sjamaan changed milestone from someday to 4.12.0
[2016-12-20 16:25:01 UTC] cosarara attached easier.scm (description=removed glib dependency)
[2016-12-21 10:12:10 UTC] cosarara changed summary
[2016-12-21 23:51:47 UTC] wasamasa attached gdb.txt (description=full gdb backtrace)
[2016-12-29 22:45:25 UTC] sjamaan changed status from new to closed
[2016-12-29 22:45:25 UTC] sjamaan set resolution to fixed
[2016-12-29 22:45:25 UTC] sjamaan wrote:
This should be fixed with dc5bd1e / 73c083a. Please reopen if it still doesn't work.