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

Filipe David Manana fdmanana@REDACTED
Mon Aug 15 04:18:39 CEST 2011


On Sun, Aug 14, 2011 at 6:45 PM, Patrick Baggett
<baggett.patrick@REDACTED> wrote:
> A typecast? That shouldn't affect code generation like that. Are you sure
> you didn't just need to do a clean build or something?

Yep. I did clean builds, by wiping out the directory and extracting
the source tarballs, both with r14b03 and r14b01. Also tried with a
GCC version without LLVM (the default one in my environment has LLVM,
while the gcc-4.2 doesn't).

With that cast correction, I no longer get the sigbus signal.
I'm surprised too.

>
> On Sun, Aug 14, 2011 at 7:58 PM, Filipe David Manana <fdmanana@REDACTED>
> wrote:
>>
>> 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."
>> _______________________________________________
>> erlang-bugs mailing list
>> erlang-bugs@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-bugs
>
>
> _______________________________________________
> erlang-bugs mailing list
> erlang-bugs@REDACTED
> http://erlang.org/mailman/listinfo/erlang-bugs
>
>



-- 
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