Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crashing with Double free or corruption... #184

Open
pat227 opened this issue Feb 21, 2020 · 5 comments
Open

Crashing with Double free or corruption... #184

pat227 opened this issue Feb 21, 2020 · 5 comments

Comments

@pat227
Copy link

pat227 commented Feb 21, 2020

Below is a backtrace. I can also provide the memory map if that would be of any help. I have an instance of ocsigenserver running a small eliom project and it consistently crashes after a short while constantly. This is very disappointing and I have never seen anything like this. This is running on ocaml 4.06.1, eliom 6.7.0, js_of_ocaml 3.4.0, lwt 4.2.1, and ocsigenserver 2.14.0.

Could it be that I have caused this failing behavior through use of lwt? Or somehow? Or is this a bug in ocsigenserver?

*** Error in `/home/admin/.opam/4.06.1/bin/ocamlrun': double free or corruption (fasttop): 0x00007fdf78009860 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x70bfb)[0x7fdfa4730bfb]
/lib/x86_64-linux-gnu/libc.so.6(+0x76fc6)[0x7fdfa4736fc6]
/lib/x86_64-linux-gnu/libc.so.6(+0x7780e)[0x7fdfa473780e]
/home/admin/.opam/4.06.1/bin/ocamlrun(caml_empty_minor_heap+0x126)[0x5605e5373a56]
/home/admin/.opam/4.06.1/bin/ocamlrun(caml_gc_dispatch+0x4b)[0x5605e5373eab]
/home/admin/.opam/4.06.1/bin/ocamlrun(caml_interprete+0x22a4)[0x5605e538dd34]
/home/admin/.opam/4.06.1/bin/ocamlrun(caml_callbackN_exn+0xb9)[0x5605e5385bc9]
/home/admin/.opam/4.06.1/bin/ocamlrun(caml_callback_exn+0x18)[0x5605e5385c28]
/home/admin/.opam/4.06.1/lib/ocaml/stublibs/dllthreads.so(+0x2b09)[0x7fdfa3a42b09]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x74a4)[0x7fdfa4a664a4]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x3f)[0x7fdfa47a8d0f]

@vouillon
Copy link
Member

This looks like a bug in a C binding. Are you using any other library?

@pat227
Copy link
Author

pat227 commented Feb 24, 2020 via email

@vouillon
Copy link
Member

It's hard to debug this kind of issue since the crash happens during garbage collection, well after the buggy code has been executed.
You may be able to narrow down the issue by forcing garbage collections by inserting calls to Gc.minor () in your code.
Core.Unix and Lwt are rather solid. I would not expect a bug there.

@pat227
Copy link
Author

pat227 commented Feb 24, 2020 via email

@pat227
Copy link
Author

pat227 commented May 19, 2021

It's been over a year but I wanted to leave an update: I discovered that sprinkling GC.full_major () liberally throughout just one of my dependencies ( a module that utilizes Postgresql ) appears to have fixed this issue. I added the garbage collection calls almost only within functions where I actually utilize Postgresql, such as new Postgresql.connection, #exec, #status, etc. I cannot imagine I am the only person who sees this. I must be abusing the Postgresql package somehow but I don't see how. This workaround is ugly and merely discovered through guessing. I have no idea where the problem lies or what it is, but instead I know I can ward it off with lots of garbage collection. I may have some time in the future to narrow it down, removing some of those collections, and possibly use only minor collection, to see if anything makes a difference and where.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants