Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Handle close_connection when writefds is 0 #2042

Merged
merged 4 commits into from
Jul 11, 2023

Conversation

mattmundell
Copy link
Contributor

@mattmundell mattmundell commented Jul 10, 2023

What

Ensure that close_connection is set when writefds is 0.

Check close_connection before doing select.

Why

To make sure the serve_gmp select loop exits in situations where EOF is received before writefds is set. This happens for example if EOF is received before we queue a response to the client.

For me this solved the problem of many gvmd processes hanging around when using GSA. If I clicked around GSA enough I would eventually get these:
md manage:WARNING:2023-07-10 15h10.16 utc:2550706: sql_open: PQerrorMessage (conn): connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL: remaining connection slots are reserved for non-replication superuser connections

References

Problem introduced in /pull/2028.

Closes #2038.

GEA-242

@mattmundell mattmundell requested a review from a team as a code owner July 10, 2023 14:32
@github-actions
Copy link

Conventional Commits Report

Type Number
Bug Fixes 60
Added 59
Changed 85
Removed 10

🚀 Conventional commits found.

@mattmundell mattmundell changed the title Handle close_connection when writefds is 0 Fix: Handle close_connection when writefds is 0 Jul 10, 2023
@timopollmeier timopollmeier merged commit 5ecc656 into greenbone:main Jul 11, 2023
1 check failed
@mattmundell mattmundell deleted the close-always branch July 11, 2023 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

gvmd@gvmd FATAL: remaining connection slots are reserved for non-replication superuser connections
2 participants