Re: pg_listener entries deleted under heavy NOTIFY load only on Windows

From: "Marshall, Steve" <smarshall(at)wsi(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: pg_listener entries deleted under heavy NOTIFY load only on Windows
Date: 2009-02-09 15:11:45
Message-ID: 499047B1.5070502@wsi.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

*** kill.c 2009-02-03 14:28:21.753474644 -0500
--- kill.c.mod 2009-02-03 14:28:04.465829331 -0500
***************
*** 25,30 ****
--- 25,33 ----
BYTE sigData = sig;
BYTE sigRet = 0;
DWORD bytes;
+ DWORD timeout = 1000; /* in ms; forever = NMPWAIT_WAIT_FOREVER */
+ const int max_pipe_tries = 3;
+ int pipe_tries = 0;

/* we allow signal 0 here, but it will be ignored in pg_queue_signal */
if (sig >= PG_SIGNAL_COUNT || sig < 0)
***************
*** 39,45 ****
return -1;
}
snprintf(pipename, sizeof(pipename), "\\\\.\\pipe\\pgsignal_%u", pid);
! if (!CallNamedPipe(pipename, &sigData, 1, &sigRet, 1, &bytes, 1000))
{
if (GetLastError() == ERROR_FILE_NOT_FOUND)
errno = ESRCH;
--- 42,63 ----
return -1;
}
snprintf(pipename, sizeof(pipename), "\\\\.\\pipe\\pgsignal_%u", pid);
!
! /*
! * Writing data to the named pipe can fail for transient reasons.
! * Therefore, it is useful to retry if it fails. The maximum number of
! * calls to make was empirically determined from a 90-hour notification
! * stress test.
! */
! while (pipe_tries < max_pipe_tries &&
! !CallNamedPipe(pipename, &sigData, 1, &sigRet, 1, &bytes, timeout))
! {
! pipe_tries++;
! timeout = 250;
! pg_usleep(10000);
! }
!
! if (pipe_tries >= max_pipe_tries)
{
if (GetLastError() == ERROR_FILE_NOT_FOUND)
errno = ESRCH;

Attachment Content-Type Size
unknown_filename text/html 2.7 KB
kill.c.notify_dropping_patch text/plain 1.4 KB

Browse pgsql-bugs by date

  From Date Subject
Next Message Bruce Momjian 2009-02-09 15:17:17 Re: pg_listener entries deleted under heavy NOTIFY load only on Windows
Previous Message Marshall, Steve 2009-02-09 14:58:03 Re: pg_listener entries deleted under heavy NOTIFY load only on Windows