*** a/src/backend/storage/lmgr/proc.c --- b/src/backend/storage/lmgr/proc.c *************** *** 1086,1097 **** ProcSleep(LOCALLOCK *locallock, LockMethod lockMethodTable) !(autovac_pgxact->vacuumFlags & PROC_VACUUM_FOR_WRAPAROUND)) { int pid = autovac->pid; ! elog(DEBUG2, "sending cancel to blocking autovacuum PID %d", ! pid); ! /* don't hold the lock across the kill() syscall */ ! LWLockRelease(ProcArrayLock); /* send the autovacuum worker Back to Old Kent Road */ if (kill(pid, SIGINT) < 0) --- 1086,1114 ---- !(autovac_pgxact->vacuumFlags & PROC_VACUUM_FOR_WRAPAROUND)) { int pid = autovac->pid; + StringInfoData locktagbuf; + StringInfoData logbuf; /* errdetail for server log */ + + initStringInfo(&locktagbuf); + initStringInfo(&logbuf); + DescribeLockTag(&locktagbuf, &lock->tag); + appendStringInfo(&logbuf, + _("Process %d waits for %s on %s"), + MyProcPid, + GetLockmodeName(lock->tag.locktag_lockmethodid, + lockmode), + locktagbuf.data); + + /* release lock as quickly as possible */ + LWLockRelease(ProcArrayLock); ! ereport(LOG, ! (errmsg("sending cancel to blocking autovacuum PID %d", ! pid), ! errdetail_log("%s", logbuf.data))); ! pfree(logbuf.data); ! pfree(locktagbuf.data); /* send the autovacuum worker Back to Old Kent Road */ if (kill(pid, SIGINT) < 0)