<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Oct 31, 2014 at 4:33 PM, Daniel Goertzen <span dir="ltr"><<a href="mailto:daniel.goertzen@gmail.com" target="_blank">daniel.goertzen@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">I am seeing a segfault that seems to be related to dirty schedulers.  I've reduced the fault to the erlang and C nif module below which executes the same nif with either the io dirty scheduler, the cpu dirty scheduler, or the normal erlang scheduler.<div><br></div><div><div><br></div><div>When I start the emulator and run either dirty nif, I get a segfault. ( see <a href="https://gist.github.com/goertzenator/6237e0200a5f7bf22976" target="_blank">https://gist.github.com/goertzenator/6237e0200a5f7bf22976</a>)</div></div></div></blockquote><div><br></div><div>I found it hard to make sense of what's in that gist due to the formatting, so I took your code and built it myself. When I ran it, it failed in your NIF load function, but it failed in a way that didn't make sense because all your function does is return 0. Then I realized none of your C functions were declared static, which means they are global, and I suspected your load() function was clashing with some other function of the same name. I made all your C functions static, rebuilt, and then ran everything and it seems like it worked:</div><div><br></div><div>> c(dlibusb).</div><div>Reading symbols for shared libraries . done</div><div>{ok,dlibusb}</div><div>2> dlibusb:mytest_cpu().<br></div><div>[ok,ok,ok,ok,ok,ok,ok,ok,ok,ok,ok]</div><div>3> dlibusb:mytest_io().</div><div>[ok,ok,ok,ok,ok,ok,ok,ok,ok,ok,ok]</div><div>4> dlibusb:mytest_none().</div><div>[ok,ok,ok,ok,ok,ok,ok,ok,ok,ok,ok] </div><div><br></div><div>--steve</div></div></div></div>