Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t40Rz-00Ft86-52 for pgsql-general@arkaria.postgresql.org; Thu, 24 Oct 2024 16:12:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1t40Rx-0055Pw-Br for pgsql-general@arkaria.postgresql.org; Thu, 24 Oct 2024 16:12:37 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t40Rw-0055Pm-QZ for pgsql-general@lists.postgresql.org; Thu, 24 Oct 2024 16:12:37 +0000 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1t40Rt-002eQN-NC for pgsql-general@lists.postgresql.org; Thu, 24 Oct 2024 16:12:35 +0000 Received: by mail-pj1-x102b.google.com with SMTP id 98e67ed59e1d1-2e56df894d4so861775a91.3 for ; Thu, 24 Oct 2024 09:12:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729786351; x=1730391151; darn=lists.postgresql.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=SUza4WndxS5DYkY95viUrXzZ2FYJif5b6Wcm7YiCCjQ=; b=PtSNB/bN0AePGsyHGnw4lGs0rrhw4yYYRqPto5qdyHfkW+phqqzdlkjIJ8DyHW1spA GI0a3h8dk3OWeSJ4WO2K9AKOvOaSrIfjaEec8NvYN6p7XjKWFijS02kgcLaHITJ0MGvN okDtGHjTAG0lbDKCt/v0WJr1CkZxEUmBqOGSj7XLsIqjXUoCYI3SAEkxXghVbaOUBkYX Ru2C6BGwjR/8D2jIG0vanbUgM4OYUSrFKVMWcPWbXhcEjuzTY0Fv1ebTCO1qR6vx9lYw hTpWNpACSXXCTalSi8qZ0LIc3qLDhofBoJ08sRryw5zHQEQKsGwcNTYKy4JRDRllGBZL TxaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729786351; x=1730391151; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=SUza4WndxS5DYkY95viUrXzZ2FYJif5b6Wcm7YiCCjQ=; b=cHSdF/P9qiD/6FqDuRjtGVlbxI7oC0Gw7NlPQ1C/qZpxDVq59borHj1+tU7k7Snl9p QgS8mrEH9JwKkCh28QPTvd85lxwNGehYOW0Z8LhcIqNBJDNlJPPsfCGoSWhHEO4EWFp0 n2nKxFmiEbnD4BGYKyryCnHYDquoWBpEX135j7eLqeP3RO/dh42DmhLOOGtlrEOWKtDA ZOgjv28qW1s7Ccz0qSdl+t3BTwYhzWYsy0/DVqGW1Z19UoNMtvpADA5hSIvdzOioxOpK v7DgWxp5VoyCCfhbC55CGCkEgrnS5Uk+x3Q5rVXuq1zC3+nLXF55+XO0ZpjNqbEUkw/2 TZjQ== X-Forwarded-Encrypted: i=1; AJvYcCVpGpotxmgNmISpLxSuwn7RP6oI8Tr24Jy3/E41wV4LulLn6iNSl2aXNuwiB3A+0K0df5VaBxXNjOQE06Fx@lists.postgresql.org X-Gm-Message-State: AOJu0YwXRIao1GagDV2ECbwXe2wv27vA1zqO3ok4VOMe3uNdiVBfnafY nxObZFDMdVnBWypjMKb+0EFqWtr0uZyQFTR7KPofnRPbeQJc1PybmUY3O20Iu/gOuuj3SaIV5H+ 3Oao0cHVBpkSZr1As6QvqOTwG5M8= X-Google-Smtp-Source: AGHT+IHbYHn2oTXt/POrNzgmSS8MlOSuqLBNifv0pv5R50QNRKA9yg1HjHokJHF1hlcPNdMcJrA5pJtet57s31Zo+3E= X-Received: by 2002:a17:90b:4b0d:b0:2e2:ffb0:89f6 with SMTP id 98e67ed59e1d1-2e76b5de293mr6529020a91.15.1729786350668; Thu, 24 Oct 2024 09:12:30 -0700 (PDT) MIME-Version: 1.0 From: Sasmit Utkarsh Date: Thu, 24 Oct 2024 21:42:19 +0530 Message-ID: Subject: Assistance Required: Timeout or Buffer Overflow Issue in PostgreSQL Client Application To: pgsql-general , pgsql-general@lists.postgresql.org Content-Type: multipart/mixed; boundary="000000000000f82bda06253b4423" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000f82bda06253b4423 Content-Type: multipart/alternative; boundary="000000000000f82bd906253b4421" --000000000000f82bd906253b4421 Content-Type: text/plain; charset="UTF-8" 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@2.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@2.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@2.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 --000000000000f82bd906253b4421 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Dear PostgreSQL Community Team,

I hope this me= ssage finds you well. I am reaching out for assistance with an issue encoun= tered in our application, which communicates with PostgreSQL using the libp= q client library.

Issue Details:
We have observed a proble= m where one of the application's threads gets stuck during a database o= peration. Below is a stack trace of the affected thread:

Applicat= ion Logs:
Oct 23 10:08:44.806235 cucmtpccu1 shc-server@2.service[966= 034]: 0966070{ef5f81a7-d35b-4604-953d-a35665e505b7.010000}KIP8-SQL_get_tpf_= rw()-SQL read data from File Address before lock fa(-1810606079) fa(9414580= 1) fa2 htonl(22549652)
Oct 23 10:08:44.806235 cucmtpccu1 shc-server@2.se= rvice[966034]: 0966070{ef5f81a7-d35b-4604-953d-a35665e505b7.010000}KIP8-SQL= _get_tpf_rw() SelectDataCommand =3D CALL SQL_select_data_procedure($1, $2, = NULL, NULL) hold(0) fa(-1810606079)
Oct 23 10:08:44.807814 cucmtpccu1 sh= c-server@2.service[966034]: *** buffer overflow detected ***: terminated
Stack Trace of Thread 966070:
#0 =C2=A00x00000000f7ee1129 __kernel_vsyscall (linux-gate= .so.1)
#1 =C2=A00x00000000f6ba23b7 __poll (libc.so.6)
#2 =C2=A00x0000= 0000f792e5b5 __interceptor_poll (libasan.so.8)
#3 =C2=A00x00000000f72b30= a8 pqSocketCheck (libpq.so.5)
#4 =C2=A00x00000000f72b3864 pqWaitTimed (l= ibpq.so.5)
#5 =C2=A00x00000000f72b38d2 pqWait (libpq.so.5)
#6 =C2=A00= x00000000f72aff03 PQgetResult (libpq.so.5)
#7 =C2=A00x00000000f72b036a P= QexecFinish (libpq.so.5)
#8 =C2=A00x0000000008106dd4 checkLOCK (server)<= /span>
#9 =C2=A00x000000000811d871 SQL_get_tpf_rw (server)
...
The stack trace shows that the thread is stuck in a poll operation while w= aiting 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:
-Cou= ld the buffer overflow be causing the crash, and if so, how is it related t= o the socket activity?
-Are there specific configurations or checks we s= hould perform to diagnose this issue further?
-Any suggestions for possi= ble solutions to resolve this problem?

For additional con= text, I've verified that the specified record does exist in the databas= e, and I am also attaching the implementation details for the checkLOCK<= /b> function corresponding to the stack trace.

Please let me know if= you need any more details=C2=A0

Your assistance with trouble= shooting this would be highly appreciated.

Regards,
Sasmit Utkarsh
<= div>+91-7674022625
--000000000000f82bd906253b4421-- --000000000000f82bda06253b4423 Content-Type: text/plain; charset="US-ASCII"; name="checkLOCK.txt" Content-Disposition: attachment; filename="checkLOCK.txt" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_m2nhxcuz0 dm9pZCBjaGVja0xPQ0soaW50MzJfdCBmYSkNCnsNCmludCAgICAgICAgIG5GaWVsZHM7DQppbnQg ICAgICAgICBuVHVwbGVzOw0KaW50ICAgICAgICAgaSwgajsNClBHcmVzdWx0ICpjaGVja0xPQ0tf cmVzPU5VTEw7DQpjaGFyIENvbW1hbmRbMTAwXTsNCg0KCUxPR19UUkFDRSgiJ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