Skip site navigation (1) Skip section navigation (2)

Re: FATAL: semctl(1672698088, 12, SETVAL, 0) failed

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Qingqing Zhou <zhouqq(at)cs(dot)toronto(dot)edu>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: FATAL: semctl(1672698088, 12, SETVAL, 0) failed
Date: 2006-02-28 19:05:02
Message-ID: 200602281905.k1SJ52b19021@candle.pha.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugs
Qingqing Zhou wrote:
> I encountered an error when I fast shutdown 8.1.1 on Win2k:
> 
>     FATAL:  semctl(1672698088, 12, SETVAL, 0) failed:  A blocking operation
>     was interrupted by a call to WSACancelBlockingCall.
> 
> A similar error on 8.1/win2003 was reported on pgsql-general (sorry, I can't
> dig out the
> original post from our web archives):
> 
>     From:  Niederland
>     Date:  Tues, Dec 13 2005 9:49 am
> 
>     2005-12-12 20:30:00 FATAL:  semctl(50884184, 15, SETVAL, 0) failed: A
>     non-blocking socket operation could not be completed immediately.
> 
> ---
> 
> There are two problems here:
> 
> (1) Why a socket error?
> In port/win32.h, we have
> 
> #undef EAGAIN
> #undef EINTR
> #define EINTR WSAEINTR
> #define EAGAIN WSAEWOULDBLOCK
> 
> What's the rationale of doing so?

We did this so that our code could refer to EINTR/EAGAIN without
port-specific tests.

> (2) What's happened here?
> It may come from PGSemaphoreReset(), and win32 semop() looks like this:
> 
>   ret = WaitForMultipleObjectsEx(2, wh, FALSE, (sops[0].sem_flg &
> IPC_NOWAIT) ? 0 : INFINITE, TRUE);
>   ...
>   else if (ret == WAIT_OBJECT_0 + 1 || ret == WAIT_IO_COMPLETION)
>   {
>    pgwin32_dispatch_queued_signals();
>    errno = EINTR;
>   }
>   else if (ret == WAIT_TIMEOUT)
>    errno = EAGAIN;
> 
> So it seems the EINTR is caused by an incoming signal, the EAGAIN is caused
> by a TIMEOUT ... any ideas?

I looked at the documentation for the function:

	http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/waitformultipleobjectsex.asp

and it isn't clear what return failure values it has.  We certainly
could loop on WSAEINTR.  Can you test it?

-- 
  Bruce Momjian   http://candle.pha.pa.us
  SRA OSS, Inc.   http://www.sraoss.com

  + If your life is a hard drive, Christ can be your backup. +

In response to

Responses

pgsql-bugs by date

Next:From: Qingqing ZhouDate: 2006-03-01 02:08:58
Subject: Re: FATAL: semctl(1672698088, 12, SETVAL, 0) failed
Previous:From: Tim KordasDate: 2006-02-28 18:25:10
Subject: BUG #2291: int2vectorrecv() and oidvectorrecv() are wrong (SIGBUS)

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group