Hi Marcel, On 10/19/2011 06:40 PM, Marcel Holtmann wrote: >>>> This prevents a deadlog while writing to syslog and then >>>> we receive a signal to write syslog. >>> >>> how is this suppose to work. We get a segmentation fault and have to >>> return to the mainloop and you expect the code be still fully functional >>> at that point. >> >> I suspected something like this. Recently, I have encountered several >> times when ConnMan crashes the daemon was stuck and no output >> whatsoever. Not even a "kill -9" did help. > > I have not seen this. Could it be that I screwed up the backtrace symbol > resolving magic. Or do you happen to have some VPN open and we forgot to > close all file descriptors.
Nope, I didn't have any VPN running. I try to grap a full BT next time it hangs. > Potentially we have to add CLOEXEC to all our file descriptors. > >>> Also the backtrace must be totally wrong in this case since it would >>> show the mainloop now and not where it really came from. >> >> Right, didn't really think this through. So what can we do with the >> syslog deadlock then? > > No idea. The man pages from signal are quite clear on this one: Async-signal-safe functions A signal handler function must be very careful, since processing elsewhere may be interrupted at some arbitrary point in the execution of the program. POSIX has the concept of "safe function". If a signal interrupts the execution of an unsafe function, and handler calls an unsafe function, then the behavior of the program is undefined. After a bit goolging I found out there are two solution in the wild to solve this. Either add the log entries to a buffer in memory and flush it after the signal handler has returned or use a socket to /dev/log and write directly to it. I think only solution two would make sense. What do you think? cheers, daniel _______________________________________________ connman mailing list [email protected] http://lists.connman.net/listinfo/connman
