Invalid Length of Startup Packet Docker Postgressql
PostgreSQL init process complete; ready for start up.

2022-05-16 19:28:51.674 UTC [1] LOG:  starting PostgreSQL 14.2 on x86_64-pc-linux-musl, compiled by gcc (Alpine 10.3.1_git20211027) 10.3.1 20211027, 64-bit
2022-05-16 19:28:51.674 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2022-05-16 19:28:51.674 UTC [1] LOG:  listening on IPv6 address "::", port 5432
2022-05-16 19:28:51.677 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2022-05-16 19:28:51.681 UTC [51] LOG:  database system was shut down at 2022-05-16 19:28:51 UTC
2022-05-16 19:28:51.684 UTC [1] LOG:  database system is ready to accept connections
2022-05-16 19:29:07.610 UTC [59] LOG:  invalid length of startup packet
2022-05-16 19:29:07.611 UTC [58] LOG:  invalid length of startup packet
2022-05-16 19:29:07.612 UTC [60] LOG:  invalid length of startup packet
2022-05-16 19:29:08.647 UTC [62] LOG:  invalid length of startup packet
2022-05-16 19:29:08.650 UTC [61] LOG:  invalid length of startup packet
2022-05-16 19:29:08.652 UTC [63] LOG:  invalid length of startup packet

Any help would be appreciated I couldn't figure out

Docker composer file

version: '3.9'

services: postgres: image: postgres:14-alpine ports: - 5432:5432 volumes: - ~/apps/postgres:/var/lib/postgresql/data environment: - POSTGRES_PASSWORD=S3cret - POSTGRES_USER=citizix_user - POSTGRES_DB=citizix_db

Using ubuntu 20.4

1

2 Answers

Something, probably a monitoring system, is establishing TCP connections to the database server, then closing them without sending a correct PostgreSQL connection packet.

You can include %h in your log_line_prefix to see the client address of these connections, which may help identify the culprit.

The solution is to get the monitoring system to establish a database connection rather than only a TCP connection. Not only will that get rid of the message, but it will make the test much more useful.

Try these fixes:

  1. Update docker and restart it
  2. Reduce the name length of the sql file that you are providing to /docker-entrypoint-initdb.d in volumes
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Sarah Jenkins

Sarah Jenkins

Senior Technology Editor & AI Specialist

Sarah Jenkins is a veteran tech journalist with over 12 years of experience covering artificial intelligence, mobile innovations, and digital ethics. Her insights have appeared in leading technology publications worldwide.

Share this article
Twitter Facebook Pinterest