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 1t40X5-00FttO-No for pgsql-general@arkaria.postgresql.org; Thu, 24 Oct 2024 16:17:55 +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 1t40X3-005AmM-IM for pgsql-general@arkaria.postgresql.org; Thu, 24 Oct 2024 16:17:53 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t40X3-005Am5-7M for pgsql-general@lists.postgresql.org; Thu, 24 Oct 2024 16:17:53 +0000 Received: from mail-yw1-x112e.google.com ([2607:f8b0:4864:20::112e]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1t40X0-002lE9-Uu for pgsql-general@postgresql.org; Thu, 24 Oct 2024 16:17:52 +0000 Received: by mail-yw1-x112e.google.com with SMTP id 00721157ae682-6e38ebcc0abso14314137b3.2 for ; Thu, 24 Oct 2024 09:17:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729786669; x=1730391469; darn=postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Wx8J0LvYOgmQMRfq/e/6d+hHFeYO4wJx96439En4QNw=; b=J10tDcOLBdFVFZWReg/JkBLXNx8eFofokTA0rh7ccfLltfFCQ24jIOlo3wGiZh3Hf7 tMOGSsiEub7bgd+KiEGQFxyXI0GARNAfCU+dOuBXi34GkEp2GrP1nawMjTY+q7UQtfO+ uy6I/oUWTtWTYmus46PzLFtk1KL9CtYaQRJEokaKvn1Z6dvtuA8ri3SmJGtvueV69qy8 gRV0yOTGRRh4KD+LA/dQ7FtamHJt2RiVcUMVVe4Tl7ticEj0aL/0vsl4XZQPcNtTnfsQ sn0E/ILnRBTvlda6lUumJm8ys6kcul/lhpTIP9dQK7t+JIqlJ4MMm1U2cy8Th9jPddSW FgBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729786669; x=1730391469; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Wx8J0LvYOgmQMRfq/e/6d+hHFeYO4wJx96439En4QNw=; b=LA/xFvR4ir2+gBjDRdF3YU+tVOSaJsmtOFNgdneG9r+Unlhz+KQSC4VQY/EQL/UQ6t PokXF/zlsI1VYuYH3FWYtW675NIUNhFJ7vzeEKArrDxhilnV6xiECWWIY3LnygRGvtY1 tVThi3Z1/4HtpVNEtWPLazGPThfobtS4GtGzLO6FX1dS3kqKKO1tpKiKncsLqRvZnUNb fxtqPznImNsEkG4yUPks9NYntguEqY6vuLCWS1ZLqRpRUBi7qIm4BtaiWFQquFm7d/zW CZtWTo8Pdr4v2ILvFQ9rMOqA40UGsAFEUO77eswce6iA+Y/bQiz7GU3GxnNe4sm6P4lN XcHQ== X-Gm-Message-State: AOJu0Yw8UAwDu9GVXG81SDFKj5uneK2GGXEF52FZoPom3b6B6TV+otcL U6j0Nrb9LJf+e/o7XofWKuoj3FYykCxx/WRObLfwXY8gkpPss1Zlsw/picrbupSYR080nuzwMzG ZTpPdefCnHsCCCoTOLx2TjIpD388= X-Google-Smtp-Source: AGHT+IGFpvZrCiG8+wSL4ThZkv1vVVz1Y2WSOQ5xngxwM9kE5l3+LeCq73zfRCWuqYIqs80Am2iWARj/rOb0WYwnLco= X-Received: by 2002:a05:690c:6c0c:b0:6e3:1063:91ca with SMTP id 00721157ae682-6e86632cdd3mr31724087b3.40.1729786667601; Thu, 24 Oct 2024 09:17:47 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Igor Korot Date: Thu, 24 Oct 2024 11:12:09 -0500 Message-ID: Subject: Re: Assistance Required: Timeout or Buffer Overflow Issue in PostgreSQL Client Application To: Sasmit Utkarsh Cc: pgsql-general , pgsql-general@lists.postgresql.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, Is this a complete backtrace? Can you post a complete backtrace? We need to see if there is a reference to your application code? What language is it written in? What operation this thread was performing? Thank you. On Thu, Oct 24, 2024 at 11:12=E2=80=AFAM Sasmit Utkarsh wrote: > > 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 PostgreSQ= L using the libpq client library. > > Issue Details: > We have observed a problem where one of the application's threads gets st= uck during a database operation. Below is a stack trace of the affected thr= ead: > > Application Logs: > Oct 23 10:08:44.806235 cucmtpccu1 shc-server@2.service[966034]: 0966070{e= f5f81a7-d35b-4604-953d-a35665e505b7.010000}KIP8-SQL_get_tpf_rw()-SQL read d= ata from File Address before lock fa(-1810606079) fa(94145801) fa2 htonl(22= 549652) > Oct 23 10:08:44.806235 cucmtpccu1 shc-server@2.service[966034]: 0966070{e= f5f81a7-d35b-4604-953d-a35665e505b7.010000}KIP8-SQL_get_tpf_rw() SelectData= Command =3D 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]: *** buffe= r 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). W= e 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 rel= ated to the socket activity? > -Are there specific configurations or checks we should perform to diagnos= e this issue further? > -Any suggestions for possible solutions to resolve this problem? > > For additional context, I've verified that the specified record does exis= t in the database, and I am also attaching the implementation details for t= he 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