php.net |  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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
12 - 8 = ?
Subscribe to this entry?

 
 [2017-12-14 02:50 UTC] spongi1019 at naver dot com
Description:
------------
I have a weird happening.

On Windows, I executed below the script.

{code}
<?php
$pdo = new PDO('pgsql:host=xxxxxxxx;dbname=postgres;port=5432', 'postgres', 'mypassword');
sleep(600);
{code}

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'.
{code}
tcp        0      0 xxx.xxx.xxx.xxx:5432    xxx.xxx.xxx.xxx:64682      ESTABLISHED 26620/postgres: pos
{code}

Why it happened?


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

Test script:
---------------
<?php
$pdo = new PDO('pgsql:host=xxxxxxxx;dbname=postgres;port=5432', 'postgres', 'mypassword');
sleep(600);

Expected result:
----------------
close connection(not established)

Actual result:
--------------
tcp        0      0 xxx.xxx.xxx.xxx:5432    xxx.xxx.xxx.xxx:64682      ESTABLISHED 26620/postgres: pos

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-12-15 01:47 UTC] adambaratz@php.net
-Package: PDO related +Package: PDO PgSQL
 [2018-01-16 03:20 UTC] mattficken@php.net
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 (127.0.0.1) ??
 [2018-01-23 03:04 UTC] mattficken@php.net
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] mattficken@php.net
-Status: Open +Status: Not a bug
 [2018-02-06 03:21 UTC] mattficken@php.net
Isn't a bug. Behavior specified in IETF RFC 793.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sat Oct 19 12:01:27 2019 UTC