[PATCH] immediately kill psql process if server is not running.

From: Srinath Reddy Sadipiralla <srinath(dot)reddy(at)zohocorp(dot)com>
To: "pgsql-hackers" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: [PATCH] immediately kill psql process if server is not running.
Date: 2024-11-08 18:42:33
Message-ID: 1930d15cdf0.560aaa8728374.5183543489155974159@zohocorp.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi ,

When a user tries to enter a large query, thinking the server is still running, and to their surprise, they discover that the server has crashed or stopped, I have observed that the psql process will still be running if it is idle even after the server crashes or stops.

solved this using 2 methods:

1) using a thread (supports --with-readline and --without-readline)

To address this surprise circumstance, I created a patch that creates a new thread within the psql process to monitor the File Descriptor of the psql process,this thread will monitor for -1 or 0 on psql’s FD using select() and recv()  functions .If either one of the value is returned we terminate the psql process.

2) Doing the same thing as above but in single process using readline callbacks(only supports --with-readline)

Regards,

Srinath Reddy Sadipiralla

Member Technical Staff

Zoho

Attachment Content-Type Size
0001-Kill-psql-process-with-thread-implementation.patch application/octet-stream 6.5 KB
0001-Kill-psql-process-with-single-process-implementation.patch application/octet-stream 3.2 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Devulapalli, Raghuveer 2024-11-08 18:43:12 RE: Use __attribute__((target(sse4.2))) for SSE42 CRC32C
Previous Message Peter Geoghegan 2024-11-08 18:40:13 Re: Avoiding superfluous buffer locking during nbtree backwards scans