>> Locking may help, but this overall sounds like a bad idea for
>> performance as well. Why not have one thread (or main) globally do the
>> 'ifconfig' fork and cache the result in a (lock-protected) global?
Tried locking with a mutex but it still crashes. There must be something inherently unsafe about forking in an web thread, although I don't see anything wrong with a short system process like 'ifconfig' in a thread-per-connection server.
Anyway, I moved the 'ifconfig' fork to the main thread on a timer, writing the output to a temp file so I can read it in the web thread. This seems stable. Cheers.
|