Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Wdkku-0008H0-LD for pgsql-bugs@arkaria.postgresql.org; Fri, 25 Apr 2014 18:21:48 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Wdkku-0006vX-1q for pgsql-bugs@arkaria.postgresql.org; Fri, 25 Apr 2014 18:21:48 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Wdkks-0006vQ-VG for pgsql-bugs@postgresql.org; Fri, 25 Apr 2014 18:21:47 +0000 Received: from tamriel.snowman.net ([2001:4830:167b::11]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Wdkkp-0008NM-CO for pgsql-bugs@postgresql.org; Fri, 25 Apr 2014 18:21:46 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id DA3775F812; Fri, 25 Apr 2014 14:21:42 -0400 (EDT) Date: Fri, 25 Apr 2014 14:21:42 -0400 From: Stephen Frost To: molind@gmail.com Cc: pgsql-bugs@postgresql.org Subject: Re: BUG #10141: Server fails to send query result. Message-ID: <20140425182142.GQ2556@tamriel.snowman.net> References: <20140425155227.2715.56833@wrigleys.postgresql.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="qK9XcJxkZd/EUF8W" Content-Disposition: inline In-Reply-To: <20140425155227.2715.56833@wrigleys.postgresql.org> X-Editor: Vim http://www.vim.org/ X-Info: http://www.snowman.net X-Operating-System: Linux/3.11.0-19-generic (x86_64) X-Uptime: 14:17:36 up 17 days, 4:36, 8 users, load average: 0.02, 0.06, 0.11 User-Agent: Mutt/1.5.21 (2010-09-15) X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org --qK9XcJxkZd/EUF8W Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Greetings, * molind@gmail.com (molind@gmail.com) wrote: > While it works it opens 1 db connection per thread (8 threads) and queries > all tiles from list 25k tiles in average. 5 queries per tile. During map > generation usually 2 threads stuck in idle state. >=20 > http://i.stack.imgur.com/VUU4O.png This only shows what's happening server-side. > Look at the last row. Query started. We have a timestamp, then it finished > and changed state to idle, and we have timestamp of that moment. Everythi= ng > looks ok, except console app which waits answer from server inside >=20 > PGresult *res =3D PQexec(conn, query); >=20 > It waits for query results from server. And I can't find why server thinks > that job is done and app says that there was no answer from db yet. Can you provide a small example test case which illustrates this? You didn't provide your code, so it's really difficult to have any idea what's going on. What version of libpq is being used and on what platform? Are you using SSL at all for your connection? > I added PQtrace for each thread and wait for stuck thread. There is trace: >=20 > >From backend> D > >From backend (#4)> 139891 > >From backend> D > >From backend (#4)> 139891 > >From backend> D > >From backend (#4)> 139891 > >From backend> D > >From backend (#4)> 139891 > >From backend> D > >From backend (#4)> 139891 > >From backend> D > >From backend (#4)> 139891 >=20 > Seems problem somewhere inside PostgreSQL. It tries to send result but > fails. I don't see anything here which shows that to be the case. Is the TCP connection still fully ESTABLISHED on both sides? What's in the middle..? Could you have a firewall or IDS which is dropping the connections? Thanks, Stephen --qK9XcJxkZd/EUF8W Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.14 (GNU/Linux) iQIcBAEBAgAGBQJTWqe2AAoJEO1sijiDR2RVyz0P/2/He+U6oJn5oL7W8omceAnz G11/3vAdegmIOtRRJhyOD7YgFbxLO3UYxFIUYC0PK6/314DLxpIEOjb5TMGGsmcE Ud/l+ouMq2AO/12doWhV5I4Efxo8tY0CAvFg+8dHta0Jsb+F3ubTnzJOP+eek7a7 pHLw1K52YXrgOFlRm0kUq0CgCPnnjxOMeeujZRQR8EGCkDFC6awjo4xJBL6U6/Ah 9jrjeDJbypsiUk2dCK4BHF+12TKVHICkrXbtORYH2HRFFU7F2gqu27ZxDdmzSsMU Hq+WGdX7wkY01NpYPPjQcGtW9M46M6DbcAtaVR7Od1/brq029eYvHV4H9L4tHxeO NuqQyCHqMuTfcyYDAKcjUW3sNeofI3cd0vebJli+gs7QJKV976kYrqEjbtxZqBUG YbMJTFE1ZvKcJT9ld8wKqtLlsgO7jQ1Np6wZjYx9XZIDK27rfNtXeVYaqEO/hWJI s0Um1PUJnNVdYzRgFMd9x/9l9Rlbpklb0tCTw6ql9Pzu/LYaj9Qib2Uo/+58qFZs xyy2Q/QlIbqO40z58+yQ7i2eDPmJc3z5zFhq1sd72r9Fad005E7UF1R99Dd5Ef/i vKmmfoUI7PcIgJWeB5BoSMrhbM9SmA8WfW0zPU3yUMddT14Qle9M71HOR4S5BOha RB7uHMuU4a1z7kplLM3j =PLlT -----END PGP SIGNATURE----- --qK9XcJxkZd/EUF8W--