Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit d8f15c9

Browse files
committed
Reduce chatter from signaling of autovacuum workers.
Don't print a WARNING if we get ESRCH from a kill() that's attempting to cancel an autovacuum worker. It's possible (and has been seen in the buildfarm) that the worker is already gone by the time we are able to execute the kill, in which case the failure is harmless. About the only plausible reason for reporting such cases would be to help debug corrupted lock table contents, but this is hardly likely to be the most important symptom if that happens. Moreover issuing a WARNING might scare users more than is warranted. Also, since sending a signal to an autovacuum worker is now entirely a routine thing, and the worker will log the query cancel on its end anyway, reduce the message saying we're doing that from LOG to DEBUG1 level. Very minor cosmetic cleanup as well. Since the main practical reason for doing this is to avoid unnecessary buildfarm failures, back-patch to all active branches.
1 parent 1e2bd43 commit d8f15c9

File tree

1 file changed

+19
-9
lines changed
  • src/backend/storage/lmgr

1 file changed

+19
-9
lines changed

src/backend/storage/lmgr/proc.c

+19-9
Original file line numberDiff line numberDiff line change
@@ -1167,22 +1167,32 @@ ProcSleep(LOCALLOCK *locallock, LockMethod lockMethodTable)
11671167
/* release lock as quickly as possible */
11681168
LWLockRelease(ProcArrayLock);
11691169

1170-
ereport(LOG,
1170+
/* send the autovacuum worker Back to Old Kent Road */
1171+
ereport(DEBUG1,
11711172
(errmsg("sending cancel to blocking autovacuum PID %d",
11721173
pid),
11731174
errdetail_log("%s", logbuf.data)));
11741175

1175-
pfree(logbuf.data);
1176-
pfree(locktagbuf.data);
1177-
1178-
/* send the autovacuum worker Back to Old Kent Road */
11791176
if (kill(pid, SIGINT) < 0)
11801177
{
1181-
/* Just a warning to allow multiple callers */
1182-
ereport(WARNING,
1183-
(errmsg("could not send signal to process %d: %m",
1184-
pid)));
1178+
/*
1179+
* There's a race condition here: once we release the
1180+
* ProcArrayLock, it's possible for the autovac worker to
1181+
* close up shop and exit before we can do the kill().
1182+
* Therefore, we do not whinge about no-such-process.
1183+
* Other errors such as EPERM could conceivably happen if
1184+
* the kernel recycles the PID fast enough, but such cases
1185+
* seem improbable enough that it's probably best to issue
1186+
* a warning if we see some other errno.
1187+
*/
1188+
if (errno != ESRCH)
1189+
ereport(WARNING,
1190+
(errmsg("could not send signal to process %d: %m",
1191+
pid)));
11851192
}
1193+
1194+
pfree(logbuf.data);
1195+
pfree(locktagbuf.data);
11861196
}
11871197
else
11881198
LWLockRelease(ProcArrayLock);

0 commit comments

Comments
 (0)