Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i9rU7-00087x-Jj for pgsql-bugs@arkaria.postgresql.org; Mon, 16 Sep 2019 13:56:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1i9rT7-0006yW-Bx for pgsql-bugs@arkaria.postgresql.org; Mon, 16 Sep 2019 13:55:05 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i9rT7-0006yH-07 for pgsql-bugs@lists.postgresql.org; Mon, 16 Sep 2019 13:55:05 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1i9rT0-0002ZE-EN for pgsql-bugs@lists.postgresql.org; Mon, 16 Sep 2019 13:55:03 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x8GDst4d031395; Mon, 16 Sep 2019 09:54:55 -0400 From: Tom Lane To: Kiran Khatke cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #16007: Regarding patch for BUG #3995: pqSocketCheck doesn't return In-reply-to: References: <16007-1d32de61f44fe1f4@postgresql.org> <27311.1568319454@sss.pgh.pa.us> Comments: In-reply-to Kiran Khatke message dated "Sun, 15 Sep 2019 23:53:41 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <31393.1568642095.1@sss.pgh.pa.us> Date: Mon, 16 Sep 2019 09:54:55 -0400 Message-ID: <31394.1568642095@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Kiran Khatke writes: > One of the thread of DBMGR Daemon is waiting for the result of poll() > function. > poll() was called by pgSocketCheck(). So pqSocketCheck() didn't return, > hung in poll(). > Below is the backtrace. Well, it's waiting for the query to finish, or so it thinks. Did you look at what the server thinks the session is doing? Your reference to multiple threads is a red flag to me. Very often we see people whose programs try to use the same PGconn object from multiple threads. That doesn't work --- and libpq does not have any internal mutexes that would prevent the object's state from getting messed up by concurrent operations. So a plausible theory is that this PGconn was used concurrently, and now this particular thread is stuck because the object's state is corrupt (ie, it shows the query as busy but the server doesn't think so). It might be worth enabling log_statement = all on the server side and then watching the server log to see what seems to be happening from that end. regards, tom lane