The following ERROR messages are downgraded to DEBUG messages.
(1) ERROR:unable to flush data to frontend
(2) ERROR: unable to read data from frontend
DETAIL: EOF encountered with frontend
(3) ERROR: unable to read data
DETAIL: child connection forced to terminate due to client_idle_limit:30 is reached
(1) and (2)
These messages are cuased when the client did not send a terminate message
before disconnecting to pgpool.
For example, when the client process was forcefully terminated, the error occurs.
Although they are harmless, it can sometimes confuse users.
(3)
If we set "client_idle_limit" to a non-zero value, the connection
will be disconnected if it remains idle since the last query.
The disconnection is caused by Pgpool-II settings,
but Pgpool-II handles the log message as an "ERROR".
Because the ERROR messages above are normal messages, I decide to downgrade them.
Discussion: https://www.pgpool.net/pipermail/pgpool-hackers/2023-June/004351.html
/* pgpool-II extension. This is same as ERROR but sets the
* do not cache connection flag before transforming to ERROR.
*/
-#define FRONTEND_ERROR 23 /* transformed to ERROR at errstart */
-#define FRONTEND_ONLY_ERROR 24 /* this is treated as LOG message
+#define FRONTEND_DEBUG 23 /* transformed to DEBUG at errstart */
+#define FRONTEND_LOG 24 /* transformed to LOG at errstart */
+#define FRONTEND_ERROR 25 /* transformed to ERROR at errstart */
+#define FRONTEND_ONLY_ERROR 26 /* this is treated as LOG message
* internally for pgpool-II but forwarded
* to frontend clients just like normal
* errors followed by readyForQuery
#define FATAL 21 /* fatal error - abort process */
#define PANIC 22 /* take down the other backends with me */
-#define FRONTEND_ERROR 23 /* transformed to ERROR at errstart */
-#define FRONTEND_ONLY_ERROR 24 /* this is treated as LOG message
+#define FRONTEND_DEBUG 23 /* transformed to DEBUG at errstart */
+#define FRONTEND_LOG 24 /* transformed to LOG at errstart */
+#define FRONTEND_ERROR 25 /* transformed to ERROR at errstart */
+#define FRONTEND_ONLY_ERROR 26 /* this is treated as LOG message
* internally for pgpool-II but forwarded
* to frontend clients just like normal
* errors followed by readyForQuery
pool_write(frontend, DUMMY_VALUE, sizeof(DUMMY_VALUE));
if (pool_flush_it(frontend) < 0)
{
- ereport(FRONTEND_ERROR,
- (errmsg("unable to to flush data to frontend"),
+ ereport(FRONTEND_DEBUG,
+ (errmsg("unable to flush data to frontend"),
errdetail("frontend error occurred while waiting for backend reply")));
}
pool_write(frontend, notice_message, strlen(notice_message) + 1);
if (pool_flush_it(frontend) < 0)
{
- ereport(FRONTEND_ERROR,
- (errmsg("unable to to flush data to frontend"),
+ ereport(FRONTEND_DEBUG,
+ (errmsg("unable to flush data to frontend"),
errdetail("frontend error occurred while waiting for backend reply")));
}
if (idle_count > pool_config->client_idle_limit)
{
- ereport(FRONTEND_ERROR,
+ ereport(FRONTEND_DEBUG,
(pool_error_code("57000"),
errmsg("unable to read data"),
errdetail("child connection forced to terminate due to client_idle_limit:%d is reached",
if (idle_count_in_recovery > pool_config->client_idle_limit_in_recovery)
{
- ereport(FRONTEND_ERROR,
+ ereport(FRONTEND_DEBUG,
(pool_error_code("57000"),
errmsg("unable to read data"),
errdetail("child connection forced to terminate due to client_idle_limit_in_recovery:%d is reached", pool_config->client_idle_limit_in_recovery)));
* If we are in recovery and client_idle_limit_in_recovery is -1,
* then exit immediately.
*/
- ereport(FRONTEND_ERROR,
+ ereport(FRONTEND_DEBUG,
(pool_error_code("57000"),
errmsg("connection terminated due to online recovery"),
errdetail("child connection forced to terminate due to client_idle_limit:-1")));
case DEBUG3:
case DEBUG4:
case DEBUG5:
+ case FRONTEND_DEBUG:
prefix = "DEBUG";
break;
case LOG:
case COMMERROR:
+ case FRONTEND_LOG:
prefix = "LOG";
break;
case INFO:
static bool
is_log_level_output(int elevel, int log_min_level)
{
- if (elevel == LOG || elevel == COMMERROR || elevel == FRONTEND_ONLY_ERROR)
+ if (elevel == LOG || elevel == COMMERROR || elevel == FRONTEND_ONLY_ERROR || elevel == FRONTEND_LOG)
{
if (log_min_level == LOG || log_min_level <= ERROR)
return true;
}
+ else if (elevel == FRONTEND_DEBUG)
+ {
+ if (log_min_level <= DEBUG1)
+ return true;
+ }
else if (log_min_level == LOG)
{
/* elevel != LOG */
frontend_invalid = true;
elevel = ERROR;
}
+ else if (elevel == FRONTEND_DEBUG || elevel == FRONTEND_LOG)
+ {
+ frontend_invalid = true;
+ }
if (elevel >= ERROR && elevel != FRONTEND_ONLY_ERROR)
{
* proc_exit's responsibility to see that this doesn't turn into
* infinite recursion!)
*/
- if (elevel == ERROR)
+ if (elevel == ERROR || elevel == FRONTEND_LOG || elevel == FRONTEND_DEBUG)
{
if (PG_exception_stack == NULL ||
proc_exit_inprogress)
* If ERROR (not more nor less) we pass it off to the current handler.
* Printing it and popping the stack is the responsibility of the handler.
*/
- if (elevel == ERROR)
+ if (elevel == ERROR || elevel == FRONTEND_LOG || elevel == FRONTEND_DEBUG)
{
/*
* We do some minimal cleanup before longjmp'ing so that handlers can
case DEBUG1:
case LOG:
case COMMERROR:
+ case FRONTEND_LOG:
+ case FRONTEND_DEBUG:
case INFO:
case NOTICE:
eventlevel = EVENTLOG_INFORMATION_TYPE;
case DEBUG3:
case DEBUG2:
case DEBUG1:
+ case FRONTEND_DEBUG:
syslog_level = LOG_DEBUG;
break;
case LOG:
case COMMERROR:
case INFO:
+ case FRONTEND_LOG:
syslog_level = LOG_INFO;
break;
case NOTICE:
case DEBUG3:
case DEBUG4:
case DEBUG5:
+ case FRONTEND_DEBUG:
prefix = _("DEBUG");
break;
case LOG:
case COMMERROR:
+ case FRONTEND_LOG:
prefix = _("LOG");
break;
case INFO:
}
else
{
- ereport(FRONTEND_ERROR,
+ ereport(FRONTEND_DEBUG,
(errmsg("unable to read data from frontend"),
errdetail("socket read failed with error \"%m\"")));
}
* if backend offers authentication method, frontend could
* close connection
*/
- ereport(FRONTEND_ERROR,
+ ereport(FRONTEND_DEBUG,
(errmsg("unable to read data from frontend"),
errdetail("EOF encountered with frontend")));
}
(errmsg("unable to flush data to frontend"),
errdetail("pgpool is in replication mode, ignoring error to keep consistency among backends")));
else
- ereport(FRONTEND_ERROR,
+ ereport(FRONTEND_DEBUG,
(errmsg("unable to flush data to frontend")));
}