[erlang-questions] How to track down intermittent segfaults in a threaded NIF

Scott Ribe scott_ribe@REDACTED
Tue May 29 14:20:45 CEST 2018


What's most likely going on is that your NIF is corrupting memory that the scheduler uses. These kinds of corruptions are difficult to track down, because the crash can happen long after the bug.

You should be running with all memory debugging aids turned on--this can get you a crash closer to the actual bug, if you're lucky maybe even at the bug.

https://developer.apple.com/library/content/documentation/Performance/Conceptual/ManagingMemory/Articles/MallocDebug.html

https://developer.apple.com/library/content/technotes/tn2124/_index.html

--
Scott Ribe
scott_ribe@REDACTED
https://www.linkedin.com/in/scottribe/



> On May 29, 2018, at 3:04 AM, Igor Clark <igor.clark@REDACTED> wrote:
> 
> Thanks Sergej - that's where I got the thread reports I pasted in below, from e.g. 'beam.smp_2018-05-28-212735_Igor-Clarks-iMac.crash'.
> 
> Each log says the only crashed thread was a scheduler thread, for example "8_scheduler" running "process_main" in the case of the first one below. This is how I tracked down a bunch of errors in my own code, but the only ones that still happen are in the scheduler, according to the Console crash logs.
> 
> The thing is, it seems really unlikely that a VM running my NIF code would just happen to be crashing in the scheduler rather than my code(!) - so that's what I'm trying to work out, how to find out what's actually going on, given that the log tells me the crashed thread is running "process_main" or 'lists_member_2'.
> 
> Any suggestions welcome!
> 
> Cheers,
> Igor
> 
> On 29/05/2018 04:16, Sergej Jurečko wrote:




More information about the erlang-questions mailing list