Skip to content

Commit

Permalink
Log message dump in case of a failure
Browse files Browse the repository at this point in the history
  • Loading branch information
jesperpedersen committed Aug 24, 2020
1 parent 4bfb63c commit a529f68
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/libpgagroal/message.c
Original file line number Diff line number Diff line change
Expand Up @@ -995,9 +995,8 @@ pgagroal_log_message(struct message* msg)
}
else
{
ZF_LOGI("Size: %zd", msg->length);
ZF_LOGI_MEM(msg->data, msg->length,
"Message %p:", (const void *)msg->data);
"Message (%zd) %p:", msg->length, (const void *)msg->data);
}
}

Expand Down
4 changes: 4 additions & 0 deletions src/libpgagroal/pipeline_perf.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ performance_client(struct ev_loop *loop, struct ev_io *watcher, int revents)

client_error:
ZF_LOGW("[C] Client error: %s (socket %d status %d)", strerror(errno), wi->client_fd, status);
pgagroal_log_message(msg);
errno = 0;

exit_code = WORKER_CLIENT_FAILURE;
Expand All @@ -134,6 +135,7 @@ performance_client(struct ev_loop *loop, struct ev_io *watcher, int revents)

server_error:
ZF_LOGW("[C] Server error: %s (socket %d status %d)", strerror(errno), wi->server_fd, status);
pgagroal_log_message(msg);
errno = 0;

exit_code = WORKER_SERVER_FAILURE;
Expand Down Expand Up @@ -185,6 +187,7 @@ performance_server(struct ev_loop *loop, struct ev_io *watcher, int revents)

client_error:
ZF_LOGW("[S] Client error: %s (socket %d status %d)", strerror(errno), wi->client_fd, status);
pgagroal_log_message(msg);
errno = 0;

exit_code = WORKER_CLIENT_FAILURE;
Expand All @@ -194,6 +197,7 @@ performance_server(struct ev_loop *loop, struct ev_io *watcher, int revents)

server_error:
ZF_LOGW("[S] Server error: %s (socket %d status %d)", strerror(errno), wi->server_fd, status);
pgagroal_log_message(msg);
errno = 0;

exit_code = WORKER_SERVER_FAILURE;
Expand Down
4 changes: 4 additions & 0 deletions src/libpgagroal/pipeline_session.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ session_client(struct ev_loop *loop, struct ev_io *watcher, int revents)

client_error:
ZF_LOGW("[C] Client error: %s (socket %d status %d)", strerror(errno), wi->client_fd, status);
pgagroal_log_message(msg);
errno = 0;

client_inactive(wi->slot, wi->pipeline_shmem);
Expand All @@ -262,6 +263,7 @@ session_client(struct ev_loop *loop, struct ev_io *watcher, int revents)

server_error:
ZF_LOGW("[C] Server error: %s (socket %d status %d)", strerror(errno), wi->server_fd, status);
pgagroal_log_message(msg);
errno = 0;

client_inactive(wi->slot, wi->pipeline_shmem);
Expand Down Expand Up @@ -335,6 +337,7 @@ session_server(struct ev_loop *loop, struct ev_io *watcher, int revents)

client_error:
ZF_LOGW("[S] Client error: %s (socket %d status %d)", strerror(errno), wi->client_fd, status);
pgagroal_log_message(msg);
errno = 0;

client_inactive(wi->slot, wi->pipeline_shmem);
Expand All @@ -346,6 +349,7 @@ session_server(struct ev_loop *loop, struct ev_io *watcher, int revents)

server_error:
ZF_LOGW("[S] Server error: %s (socket %d status %d)", strerror(errno), wi->server_fd, status);
pgagroal_log_message(msg);
errno = 0;

client_inactive(wi->slot, wi->pipeline_shmem);
Expand Down

0 comments on commit a529f68

Please sign in to comment.