Re: Multithreaded SIGPIPE race in libpq on Solaris
От | Tom Lane |
---|---|
Тема | Re: Multithreaded SIGPIPE race in libpq on Solaris |
Дата | |
Msg-id | 12130.1409265931@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Multithreaded SIGPIPE race in libpq on Solaris (Thomas Munro <munro@ip9.org>) |
Ответы |
Re: Multithreaded SIGPIPE race in libpq on Solaris
|
Список | pgsql-hackers |
Thomas Munro <munro@ip9.org> writes: > My theory is that if two connections accessed by different threads get > shut down around the same time, there is a race scenario where each of > them fails to write to its socket, sees errno == EPIPE and then sees a > pending SIGPIPE with sigpending(), but only one thread returns from > sigwait() due to signal merging. Hm, that does sound like it could be a problem, if the platform fails to track pending SIGPIPE on a per-thread basis. > We never saw the problem again after we made the following change: > ... > Does this make any sense? I don't think that patch would fix the problem if it's real. It would prevent libpq from hanging up when it's trying to throw away a pending SIGPIPE, but the fundamental issue is that that action could cause a SIGPIPE that's meant for some other thread to get lost; and that other thread isn't necessarily doing anything with libpq. I don't claim to be an expert on this stuff, but I had the idea that multithreaded environments were supposed to track signal state per-thread not just per-process, precisely because of issues like this. regards, tom lane
В списке pgsql-hackers по дате отправления: