[erlang-bugs] SIGBUS on init:restart()

Filipe David Manana fdmanana@REDACTED
Mon Aug 15 02:58:13 CEST 2011


Found out the issue. It turned out to be a bad cast in linked in
driver from CouchDB:

diff --git a/src/couchdb/priv/icu_driver/couch_icu_driver.c
b/src/couchdb/priv/icu_driver/couch_icu_driver.c
index 9f20e99..edfd84a 100644
--- a/src/couchdb/priv/icu_driver/couch_icu_driver.c
+++ b/src/couchdb/priv/icu_driver/couch_icu_driver.c
@@ -45,7 +45,7 @@ static void couch_drv_stop(ErlDrvData data)
     if (pData->collNoCase) {
         ucol_close(pData->collNoCase);
     }
-    driver_free((char*)pData);
+    driver_free((void*)pData);
 }

 static ErlDrvData couch_drv_start(ErlDrvPort port, char *buff)



On Sun, Aug 14, 2011 at 3:18 PM, Filipe David Manana
<fdmanana@REDACTED> wrote:
> If I compile OTP R14B03 (also tried R14B01, and got same issue) for
> 64bits mode in Mac OS X Lion, when calling init:restart() in my
> application I get a SIGBUS signal, which causes the VM to terminate
> (it happens very often, but not always) with the error message "Bus
> error: 10".
>
> Here's some information from gdb which might be useful:
>
> http://friendpaste.com/AL9GKX2pNdyb3NIEYWxcR
>
> Ignoring the SIGBUS signal prevents the crash, but this is likely
> masking some bug:
>
> diff --git a/erts/emulator/sys/unix/sys.c b/erts/emulator/sys/unix/sys.c
> index bafbbb0..86c3f57 100644
> --- a/erts/emulator/sys/unix/sys.c
> +++ b/erts/emulator/sys/unix/sys.c
> @@ -3031,6 +3031,9 @@ erts_sys_main_thread(void)
>        fd_set readfds;
>        int res;
>
> +    signal(SIGPIPE, SIG_IGN);
> +    signal(SIGBUS, SIG_IGN);
> +
>        FD_ZERO(&readfds);
>        FD_SET(erts_darwin_main_thread_pipe[0], &readfds);
>        res = select(erts_darwin_main_thread_pipe[0] + 1, &readfds,
> NULL, NULL, NULL);
>
>
> OTP was configured like this:
>
> $ CFLAGS="-O0" ./configure --enable-darwin-64bit --prefix=/opt/r14b03
>
> Without the --enable-darwin-64bit option, the issue doesn't happen.
>
> Is this a known issue or can it be application-specific? How to debug
> it further?
>
> This issue doesn't seem to happen on Linux and Mac OS X snowleopard systems.
>
> thanks
>
>
> --
> Filipe David Manana,
> fdmanana@REDACTED, fdmanana@REDACTED
>
> "Reasonable men adapt themselves to the world.
>  Unreasonable men adapt the world to themselves.
>  That's why all progress depends on unreasonable men."
>



-- 
Filipe David Manana,
fdmanana@REDACTED, fdmanana@REDACTED

"Reasonable men adapt themselves to the world.
 Unreasonable men adapt the world to themselves.
 That's why all progress depends on unreasonable men."



More information about the erlang-bugs mailing list