Opened 9 years ago

Closed 9 years ago

#4456 closed bug (fixed)

Missing atexit symbol

Reported by: mitar Owned by:
Priority: normal Milestone: 7.2.1
Component: GHCi Version: 6.13
Keywords: Cc: mmitar@…
Operating System: Linux Architecture: x86_64 (amd64)
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


GHCi is missing atexit symbol so modules with FFI functions which use atexit fail to load.

This has been already reported:

Change History (4)

comment:1 Changed 9 years ago by igloo

Milestone: 7.0.2

Thanks for the report.

comment:2 Changed 9 years ago by mitar

OK. Later on I found more. In FFI code (when compiled with GHC) you should really not use atexit (if you do not use some mutex or something). I was getting segment faults because I used atexit to cleanup. But at the same time I called cleanup from Haskell when program was exiting. The result was (because I didn't have any special mutex around cleanup code) that cleanup was getting called twice (and it seems even at the same time). Probably because I called cleanup from one Haskell thread and atexit was called from main program thread. So there is some interaction going on. Hm, now that I think I see that the problem was probably because I didn't wait for all threads to finish (one of them was doing FFI cleanup) before main thread exited. So this is probably why it happened that that cleanup function was called twice.

comment:3 Changed 9 years ago by igloo


comment:4 Changed 9 years ago by simonmar

Resolution: fixed
Status: newclosed

I added it to the linker's symbol table. I think atexit resides in a static C library and so can't be resolved by dlsym() at runtime.

Tue Mar 29 08:56:28 PDT 2011  Simon Marlow <>
  * add atexit (#4456)
Note: See TracTickets for help on using tickets.