system() call causes core dump

Peter Steele psteele at maxiscale.com
Fri Nov 6 16:52:27 UTC 2009


>I am following this thread since i find it interesting ( playing around with popen & threads at times ).
>
>I am still trying to understand what Kris said. He says it is not safe to fork from a multithread proces. And he suggests using execve.
>
>You stacktrace btw is consistent with what Kris says: "and if that thread tries to acquire a lock or other formerly-shared resource it may deadlock or crash, because the child process is
>no longer accessing the same memory location as the threads in the parent process". -> that's probably the spinlock in malloc.

This is why we switched to vsys/vfork, assuming it would effectively do the same thing as execve. Perhaps not not. I can give it a try. I am still curious though why only this one particular system call is causing a crash. We have many calls running in other threads and none have ever caused a problem. They all do the same thing, run a command and save the output in a file, and then we process the output. The only thing different is the command we run in this case-fstat.



More information about the freebsd-questions mailing list