GNOME Bugzilla – Bug 705827
Segmentation fault due to memory leak in ucontext coroutine
Last modified: 2013-09-18 11:23:59 UTC
Created attachment 251333 [details] Test to reproduce bug Ucontext coroutine have problems with stability, gthread coroutine is ok. To reproduce just run following test, in some seconds you will get segfault. Program received signal SIGSEGV, Segmentation fault. 0xf786a228 in ?? () from /lib/libglib-2.0.so.0 (gdb) bt
+ Trace 232375
I'm not seeing any crash from this demo program, but I am seeing it massively leak memory. I suspect it'll eventually crash once it has exhausted all my 24 GB of ram and swap, but i don't fancy waiting to see that :-) The memory leak is something I'll investigate....
Yes, more memory - more time before crash. I found this problem with 512M computer. It looks like something wrong with stack, during run stack grows with no limitation, system continuously increases size, and finally no more memory to continue...
This will be fixed in two patches commit 49fbd957cb686ff3f9c31923ff17a9529edd9c13 Author: Daniel P. Berrange <berrange@redhat.com> Date: Fri Sep 13 12:06:57 2013 +0100 Free coroutine stack when releasing coroutine The coroutine_init function mmap's a stack for the ucontext coroutine, but nothing ever munmaps it. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> commit b3963416e22382a1fa0ef2d4196f421ef6aee56d Author: Daniel P. Berrange <berrange@redhat.com> Date: Fri Sep 13 12:05:55 2013 +0100 Abort if mmap of coroutine stack fails If we fail to mmap the stack, abort the processs rather than returning an error. This is standard practice in glib apps, and the caller was not checking the coroutine_init() return code leading to memory corruption. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> though I've not pushed to git yet.
Fixed in the 0.5.3 release