Assistance Required: Timeout or Buffer Overflow Issue in PostgreSQL Client Application

From: Sasmit Utkarsh <utkarshsasmit(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Assistance Required: Timeout or Buffer Overflow Issue in PostgreSQL Client Application
Date: 2024-10-24 16:12:19
Message-ID: CAM-5MT0B3RUXdWmzeK4DYF_igUKqViYS22pQoMr7pANrLHDVKg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Dear PostgreSQL Community Team,

I hope this message finds you well. I am reaching out for assistance with
an issue encountered in our application, which communicates with PostgreSQL
using the libpq client library.

*Issue Details:*
We have observed a problem where one of the application's threads gets
stuck during a database operation. Below is a stack trace of the affected
thread:

*Application Logs:*
Oct 23 10:08:44.806235 cucmtpccu1 shc-server(at)2(dot)service[966034]:
0966070{ef5f81a7-d35b-4604-953d-a35665e505b7.010000}KIP8-SQL_get_tpf_rw()-SQL
read data from File Address before lock fa(-1810606079) fa(94145801) fa2
htonl(22549652)
Oct 23 10:08:44.806235 cucmtpccu1 shc-server(at)2(dot)service[966034]:
0966070{ef5f81a7-d35b-4604-953d-a35665e505b7.010000}KIP8-SQL_get_tpf_rw()
SelectDataCommand = CALL SQL_select_data_procedure($1, $2, NULL, NULL)
hold(0) fa(-1810606079)
Oct 23 10:08:44.807814 cucmtpccu1 shc-server(at)2(dot)service[966034]: *** buffer
overflow detected ***: terminated

*Stack Trace of Thread 966070:*
#0 0x00000000f7ee1129 __kernel_vsyscall (linux-gate.so.1)
#1 0x00000000f6ba23b7 __poll (libc.so.6)
#2 0x00000000f792e5b5 __interceptor_poll (libasan.so.8)
#3 0x00000000f72b30a8 pqSocketCheck (libpq.so.5)
#4 0x00000000f72b3864 pqWaitTimed (libpq.so.5)
#5 0x00000000f72b38d2 pqWait (libpq.so.5)
#6 0x00000000f72aff03 PQgetResult (libpq.so.5)
#7 0x00000000f72b036a PQexecFinish (libpq.so.5)
#8 0x0000000008106dd4 checkLOCK (server)
#9 0x000000000811d871 SQL_get_tpf_rw (server)
...

The stack trace shows that the thread is stuck in a poll operation while
waiting for socket activity within the PostgreSQL client library (libpq).
We suspect this could be related to a network timeout or issue. However,
the application logs indicate a buffer overflow before the crash, which
raises questions about whether these are related.

*Questions:*
-Could the buffer overflow be causing the crash, and if so, how is it
related to the socket activity?
-Are there specific configurations or checks we should perform to diagnose
this issue further?
-Any suggestions for possible solutions to resolve this problem?

For additional context, I've verified that the specified record does exist
in the database, and I am also attaching the implementation details for the
*checkLOCK* function corresponding to the stack trace.

Please let me know if you need any more details

Your assistance with troubleshooting this would be highly appreciated.

Regards,
Sasmit Utkarsh
+91-7674022625

Attachment Content-Type Size
checkLOCK.txt text/plain 1.2 KB

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Sasmit Utkarsh 2024-10-24 17:03:22 Re: Assistance Required: Timeout or Buffer Overflow Issue in PostgreSQL Client Application
Previous Message Igor Korot 2024-10-24 16:12:09 Re: Assistance Required: Timeout or Buffer Overflow Issue in PostgreSQL Client Application