|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75680 On Windows, While script(PDO) executing... by SIGINT(ctrl+c).
Submitted: 2017-12-14 02:50 UTC Modified: 2018-02-06 03:21 UTC
From: spongi1019 at naver dot com Assigned:
Status: Not a bug Package: PDO PgSQL
PHP Version: 7.1.12 OS: Windows7
Private report: No CVE-ID: None
 [2017-12-14 02:50 UTC] spongi1019 at naver dot com
I have a weird happening.

On Windows, I executed below the script.

$pdo = new PDO('pgsql:host=xxxxxxxx;dbname=postgres;port=5432', 'postgres', 'mypassword');

After 10 seconds, I stopped the script by SIGINT(CTRL+C).
And then I saw the 'netstat' in Postgresql server.
I expected not to see the 'established connection'.

However, I saw the 'established connection'.
tcp        0      0      ESTABLISHED 26620/postgres: pos

Why it happened?

On Linux(centos7), it was the same that I expected.
(could not see 'established connection')

Test script:
$pdo = new PDO('pgsql:host=xxxxxxxx;dbname=postgres;port=5432', 'postgres', 'mypassword');

Expected result:
close connection(not established)

Actual result:
tcp        0      0      ESTABLISHED 26620/postgres: pos


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2017-12-15 01:47 UTC]
-Package: PDO related +Package: PDO PgSQL
 [2018-01-16 03:20 UTC]
Please try again and wait 50 seconds and run `netstat` again and then again at 60 seconds (so 2 `netstats`, one 60 seconds after socket created and one 60 seconds after database connection closed).

Just checking, is the database server localhost ( ??
 [2018-01-23 03:04 UTC]
Windows doesn't reallocate the port# for 240 seconds(by default) after the connection is closed -- to ensure that, the connection is left in that table. This is in case additional packets are sent by the other side after the connection is closed on this side.

This time is controlled by the registry key: HKEY_LOCAL_MACHINE \System \CurrentControlSet \services \Tcpip \Parameters

For higher web server performance, you can decrease this time. Otherwise, its fine. Its just a behavior difference (though behavior specified in IETF RFC 793).

Without more info, I assume this is what the issue here is... in which case, this can be closed as not a bug.  

Maybe this should be in the PHP manual for socket() (since its is a generic TCP behavior not just PgSQL).
 [2018-02-06 03:21 UTC]
-Status: Open +Status: Not a bug
 [2018-02-06 03:21 UTC]
Isn't a bug. Behavior specified in IETF RFC 793.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Dec 02 05:03:34 2021 UTC