[GH-ISSUE #980] [BUG] Postgresql reports "could not receive data from client: Connection reset by peer" #355

Closed
opened 2026-02-27 08:16:49 +03:00 by kerem · 7 comments
Owner

Originally created by @shizunge on GitHub (Sep 23, 2024).
Original GitHub issue: https://github.com/lldap/lldap/issues/980

Describe the bug
Firstly I did not notice any incorrect functions about lldap. This is just about cleanup my log.

I run lldap with postgresql.
My postgresql database generates the following log every hour.

2024-09-23 00:00:52.556 PDT [3718] LOG:  could not receive data from client: Connection reset by peer

It seems lldap running some periodic job, but it does not close the link to database gracefully.

image

To Reproduce
Steps to reproduce the behavior:

  1. Run lldap with postgresql.
  2. After sometime, read the postgresql log.

Expected behavior
No log about Connection reset by peer from the postgresql.

Logs

Will upload the log later if there is a corresponding event in the log. I did not run lldap in verbose mode.

If applicable, add logs to explain the problem.
LLDAP should be started in verbose mode (LLDAP_VERBOSE=true env variable, or verbose = true in the > config). Include the logs in triple-backtick "```"
If integrating with another service, please add its configuration (paste it or screenshot it) as well as any > useful logs or screenshots (showing the error, for instance).

Additional context
NA

Originally created by @shizunge on GitHub (Sep 23, 2024). Original GitHub issue: https://github.com/lldap/lldap/issues/980 **Describe the bug** Firstly I did not notice any incorrect functions about lldap. This is just about cleanup my log. I run lldap with postgresql. My postgresql database generates the following log every hour. ``` 2024-09-23 00:00:52.556 PDT [3718] LOG: could not receive data from client: Connection reset by peer ``` It seems lldap running some periodic job, but it does not close the link to database gracefully. ![image](https://github.com/user-attachments/assets/0d892b53-32d2-4fd7-a35c-c59a3334f3df) **To Reproduce** Steps to reproduce the behavior: 1. Run lldap with postgresql. 2. After sometime, read the postgresql log. **Expected behavior** No log about *Connection reset by peer* from the postgresql. **Logs** Will upload the log later if there is a corresponding event in the log. I did not run lldap in verbose mode. > If applicable, add logs to explain the problem. > LLDAP should be started in verbose mode (`LLDAP_VERBOSE=true` env variable, or `verbose = true` in the > config). Include the logs in triple-backtick "```" > If integrating with another service, please add its configuration (paste it or screenshot it) as well as any > useful logs or screenshots (showing the error, for instance). **Additional context** NA
kerem 2026-02-27 08:16:49 +03:00
Author
Owner

@nitnelave commented on GitHub (Sep 23, 2024):

Hmm, we're using a connection pool, not explicitly managing the lifetime of single connections. I'll ask around in our dependencies, but I'm not sure there's much that I can do about it.

<!-- gh-comment-id:2367511341 --> @nitnelave commented on GitHub (Sep 23, 2024): Hmm, we're using a connection pool, not explicitly managing the lifetime of single connections. I'll ask around in our dependencies, but I'm not sure there's much that I can do about it.
Author
Owner

@nitnelave commented on GitHub (Oct 30, 2024):

I think this should help, once it lands: https://github.com/launchbadge/sqlx/pull/3582

<!-- gh-comment-id:2447260238 --> @nitnelave commented on GitHub (Oct 30, 2024): I think this should help, once it lands: https://github.com/launchbadge/sqlx/pull/3582
Author
Owner

@shizunge commented on GitHub (Nov 11, 2024):

I don't see the problem with 0.6.0.
Close for now.

<!-- gh-comment-id:2468834970 --> @shizunge commented on GitHub (Nov 11, 2024): I don't see the problem with 0.6.0. Close for now.
Author
Owner

@shizunge commented on GitHub (Nov 12, 2024):

I still see the message, but much less often.

<!-- gh-comment-id:2469689816 --> @shizunge commented on GitHub (Nov 12, 2024): I still see the message, but much less often.
Author
Owner

@shizunge commented on GitHub (Dec 24, 2024):

Reopen.
I still see the messages (hourly) with LLDAP version 0.6.1 and Postgresql 17.

<!-- gh-comment-id:2560539219 --> @shizunge commented on GitHub (Dec 24, 2024): Reopen. I still see the messages (hourly) with LLDAP version 0.6.1 and Postgresql 17.
Author
Owner

@thielj commented on GitHub (Sep 4, 2025):

Probably related, as the pool currently defaults to a minimum of zero connections.

https://github.com/lldap/lldap/discussions/910
https://github.com/lldap/lldap/pull/1248#issuecomment-3250818457

<!-- gh-comment-id:3254804544 --> @thielj commented on GitHub (Sep 4, 2025): Probably related, as the pool currently defaults to a minimum of zero connections. https://github.com/lldap/lldap/discussions/910 https://github.com/lldap/lldap/pull/1248#issuecomment-3250818457
Author
Owner

@shizunge commented on GitHub (Sep 4, 2025):

I debugged it a little bit.
I think this is a network/firewall issue. The system does not keep the long live TCP connection.

For my setup everything is on a docker overlay network.
Setting endpoint to dnsrr seems resolved the problem. See https://forums.docker.com/t/4-minute-timeout-when-connecting-to-published-tcp-port-on-docker-swarm/136666

<!-- gh-comment-id:3255256065 --> @shizunge commented on GitHub (Sep 4, 2025): I debugged it a little bit. I think this is a network/firewall issue. The system does not keep the long live TCP connection. For my setup everything is on a docker overlay network. Setting endpoint to dnsrr seems resolved the problem. See https://forums.docker.com/t/4-minute-timeout-when-connecting-to-published-tcp-port-on-docker-swarm/136666
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/lldap-lldap#355
No description provided.