Re: Windows: Wrong error message at connection termination

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Cc: Lars Kanis <lars(at)greiz-reinsdorf(dot)de>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Windows: Wrong error message at connection termination
Date: 2021-11-17 22:55:53
Message-ID: 2783154.1637189753@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thomas Munro <thomas(dot)munro(at)gmail(dot)com> writes:
> Interesting discovery. I think you might get the same behaviour from
> a Unix system if you set SO_LINGER to 0 before you exit[1]. I suppose
> if a TCP implementation is partially in user space (I have no idea if
> this is true for Windows, I never use it, but I recall that Winsock
> was at some point a DLL) and can't handle the existence of any socket
> state after the process is gone, you might want to nuke everything and
> tell the peer immediately that you're doing so on exit?

It's definitely plausible that Windows does this because it can't
handle retransmits once the sender's state is gone. However, it
seems to me that any such state would be tied to the open socket,
not to the sender process as such. Which would suggest that an
early close() as Lars suggests would make things worse not better.
This is all just speculation unfortunately. (Man, I hate dealing
with closed-source software.)

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Mark Dilger 2021-11-17 23:07:10 Re: Non-superuser subscription owners
Previous Message Tom Lane 2021-11-17 22:47:10 Re: XLogReadRecord() error in XlogReadTwoPhaseData()