Thread: Notice Deadlock detected and Backend cache invalidation initialization failed

Notice Deadlock detected and Backend cache invalidation initialization failed

From
Trevor Astrope
Date:
Hello,

We're using postgresql 6.4.2 on red hat linux 6.0, kernel 2.2.10 with dbi
1.09 and DBD-Pg 0.91 for web database connectivity. We are occasionally
experiencing deadlocks that are logged to the apache logs as follows:

NOTICE:  Deadlock detected -- See the lock(l) manual page for a possible
cause.
NOTICE:  Deadlock detected -- See the lock(l) manual page for a possible
cause.
DBD::Pg::st execute failed: ERROR:  WaitOnLock: error on wakeup - Aborting
this transaction
Database handle destroyed without explicit disconnect.
Database handle destroyed without explicit disconnect.

However, on Friday, we experienced a much more sivere problem where
shortly after the Deadlock errors, the following occured:

NOTICE:  SIAssignBackendId: discarding tag 2147474428
DBI->connect failed: FATAL 1:  Backend cache invalidation initialization
failed
 at /home/sitesell/cgi-bin/Database_Interaction//database_func.pl line 727

After this, none of the scripts would execute and generated 500 server
errors. When I tried to restart postgresql, I got the following error:

Starting postgresql service: IpcMemoryCreate: shmget failed (Identifier
removed) key=5432010, size=24588, permission=700
IpcMemoryIdGet: shmget failed (Identifier removed) key=5432010,
size=24588, permission=0
IpcMemoryAttach: shmat failed (Invalid argument) id=-2
FATAL 1:  AttachSLockMemory: could not attach segment
postmaster []

I do have IPC support compiled into the kernel...

CONFIG_SYSVIPC=y
CONFIG_BSD_PROCESS_ACCT=y
CONFIG_SYSCTL=y


I don't know if these 2 problems are related or not. If anyone knows the
cause for either or both, I'd appreciate any help you could provide.

Thanks,

Trevor Astrope
astrope@e-corp.net



> Hello,
>
> We're using postgresql 6.4.2 on red hat linux 6.0, kernel 2.2.10 with dbi
> 1.09 and DBD-Pg 0.91 for web database connectivity. We are occasionally
> experiencing deadlocks that are logged to the apache logs as follows:
>
> NOTICE:  Deadlock detected -- See the lock(l) manual page for a possible
> cause.
> NOTICE:  Deadlock detected -- See the lock(l) manual page for a possible
> cause.
> DBD::Pg::st execute failed: ERROR:  WaitOnLock: error on wakeup - Aborting
> this transaction
> Database handle destroyed without explicit disconnect.
> Database handle destroyed without explicit disconnect.
>
> However, on Friday, we experienced a much more sivere problem where
> shortly after the Deadlock errors, the following occured:
>
> NOTICE:  SIAssignBackendId: discarding tag 2147474428
> DBI->connect failed: FATAL 1:  Backend cache invalidation initialization
> failed
>  at /home/sitesell/cgi-bin/Database_Interaction//database_func.pl line 727
>
> After this, none of the scripts would execute and generated 500 server
> errors. When I tried to restart postgresql, I got the following error:
>
> Starting postgresql service: IpcMemoryCreate: shmget failed (Identifier
> removed) key=5432010, size=24588, permission=700
> IpcMemoryIdGet: shmget failed (Identifier removed) key=5432010,
> size=24588, permission=0
> IpcMemoryAttach: shmat failed (Invalid argument) id=-2
> FATAL 1:  AttachSLockMemory: could not attach segment
> postmaster []

My guess is that your shared memory is still allocated to the crashed
backends.  I recommend using pgsql/bin/ipcclean to clear out your shared
memory and restart.

As far as the deadlocks, if the lock manual pages doesn't help show the
cause, I recommend upgrading to 6.5, where we have new locking code.

--
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist@candle.pha.pa.us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026