Skip to contentSkip to conversation

How to reset TCP connections when resuming system from disk/ram

QUESTION Maxim Levitsky 3 participants 6 messages Jun 1, 2008 – Jun 5, 2008

lore
Share & tools
lore
#0 lore raw

Hi,

Thanks to your effort, the suspend to ram/disk works flawlessly on my desktop system.

But I still have rather small, but annoying problem, that system doesn't understands that a long suspend cycle was done, and still waits for long closed TCP connections.

I remember there was a patch to close all TCP connections on suspend, but it was rejected due to the fact that TCP sessions can live through short suspend/resume cycles.

What can you suggest here?
Is there a tool to close all TCP connections?

I noticed that sockets aren't dependent on network drivers,
so even removing network driver doesn't close them.
( I guess that it is possible for TCP session to migrate from one to another network hardware too)

Another thing I want to know, is this possible to set socket timeout and how?

(There is a settings page for that in KDE, but I don't yet know what this changes, a KDE specific settings or not)

I want something CLI based.

Btw, I recently bought an acer laptop (5720G), and there are few suspend/resume issues, namely:

*attempt to do a second suspend to ram freezes the system hard on resume. for example this works:

suspend to ram
suspend to disk
suspend to ram
suspend to disk

but this doesn't

suspend to ram
suspend to ram

Best regards,
Maxim Levitsky

#1 lore raw

Hi!

Quoted 9 lines

Thanks to your effort, the suspend to ram/disk works flawlessly on my desktop system.

But I still have rather small, but annoying problem, that system doesn't understands that a long suspend cycle was done, and still waits for long closed TCP connections.

I remember there was a patch to close all TCP connections on suspend, but it was rejected due to the fact that TCP sessions can live through short suspend/resume cycles.

Well... tcp sessions can survive even long suspends ... if there's no NAT nearby and both sides are quiescent...

Dig out the patch and lets see if it can be made acceptable?

Quoted 11 lines

Btw, I recently bought an acer laptop (5720G), and there are few suspend/resume issues, namely:

*attempt to do a second suspend to ram freezes the system hard on resume. for example this works:

suspend to ram
suspend to disk
suspend to ram
suspend to disk

Quoted 4 lines

but this doesn't

suspend to ram
suspend to ram

Try it from minimum system, but this looks like acpi problem...

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#3 lore raw
In reply to Maxim Levitsky
Quoted 41 lines · Maxim Levitsky

Hi,

Thanks to your effort, the suspend to ram/disk works flawlessly on my desktop system.

But I still have rather small, but annoying problem, that system doesn't understands that a long suspend cycle was done, and still waits for long closed TCP connections.

I remember there was a patch to close all TCP connections on suspend, but it was rejected due to the fact that TCP sessions can live through short suspend/resume cycles.

What can you suggest here?
Is there a tool to close all TCP connections?

I noticed that sockets aren't dependent on network drivers,
so even removing network driver doesn't close them.
( I guess that it is possible for TCP session to migrate from one to another network hardware too)

Another thing I want to know, is this possible to set socket timeout and how?

(There is a settings page for that in KDE, but I don't yet know what this changes, a KDE specific settings or not)

I want something CLI based.

Btw, I recently bought an acer laptop (5720G), and there are few suspend/resume issues, namely:

*attempt to do a second suspend to ram freezes the system hard on resume. for example this works:

suspend to ram
suspend to disk
suspend to ram
suspend to disk

Quoted 7 lines

but this doesn't

suspend to ram
suspend to ram

Best regards,
Maxim Levitsky

Meanwhile I found a tcpkill utility,
but doesn't do what I want, since this tool gets a list of TCP connections by sniffing network traffic, thus it can't detect all connections during suspend.

Any ideas?

Best regards,
Maxim Levitsky

#4 lore raw
Quoted 10 lines · Maxim Levitsky
Quoted 9 lines · Maxim Levitsky

Hi,

Thanks to your effort, the suspend to ram/disk works flawlessly on my desktop system.

But I still have rather small, but annoying problem, that system doesn't understands that a long suspend cycle was done, and still waits for long closed TCP connections.

Quoted 5 lines
Quoted 5 lines

I remember there was a patch to close all TCP connections on suspend, but it was rejected due to the fact that TCP sessions can live through short suspend/resume cycles.

What can you suggest here?
Is there a tool to close all TCP connections?

I don't know the answer to your question.

However you should note that closing all TCP connections is overkill. It's quite possible that some processes on your computer are communicating among themselves using TCP; there's no reason those connections should be killed.

Alan Stern

#5 lore raw
Quoted 18 lines · Alan Stern
Quoted 10 lines · Maxim Levitsky
Quoted 9 lines · Maxim Levitsky

Hi,

Thanks to your effort, the suspend to ram/disk works flawlessly on my desktop system.

But I still have rather small, but annoying problem, that system doesn't understands that a long suspend cycle was done, and still waits for long closed TCP connections.

Quoted 5 lines
Quoted 5 lines

I remember there was a patch to close all TCP connections on suspend, but it was rejected due to the fact that TCP sessions can live through short suspend/resume cycles.

What can you suggest here?
Is there a tool to close all TCP connections?

Quoted 6 lines

I don't know the answer to your question.

However you should note that closing all TCP connections is overkill. It's quite possible that some processes on your computer are communicating among themselves using TCP; there's no reason those connections should be killed.

Thanks a lot for the pointer, I agree completely
I guess such connections can be filtered by filtering out connections with all local addresses (localhost, and each nic address)

When I have time I will probably write such a tool (I need to look at /proc/net/.. for list of open TCP sockets, and then I need to send RST to both ends of those sockets).

I can even parse netstat output for list of open sockets.

Quoted 3 lines

Alan Stern

Thanks a lot,
Best regards,
Maxim Levitsky

#2 lore raw
In reply to Pavel Machek
Quoted 9 lines · On Wednesday, 4 June 2008 17:59:00 Pavel Machek wrote:

Hi!

Quoted 7 lines

Thanks to your effort, the suspend to ram/disk works flawlessly on my desktop system.

But I still have rather small, but annoying problem, that system doesn't understands that a long suspend cycle was done, and still waits for long closed TCP connections.

Quoted 5 lines
Quoted 2 lines

I remember there was a patch to close all TCP connections on suspend, but it was rejected due to the fact that TCP sessions can live through short suspend/resume cycles.

Well... tcp sessions can survive even long suspends ... if there's no NAT nearby and both sides are quiescent...

Well, nat is close, (in my router....)

Quoted 2 lines

Dig out the patch and lets see if it can be made acceptable?

I will try, but currently I have very little free time, thus I even haven't researched the suspen/resume problems on this notebook

Quoted 12 lines
Quoted 12 lines

Btw, I recently bought an acer laptop (5720G), and there are few suspend/resume issues, namely:

*attempt to do a second suspend to ram freezes the system hard on resume. for example this works:

suspend to ram
suspend to disk
suspend to ram
suspend to disk

Quoted 6 lines
Quoted 4 lines

but this doesn't

suspend to ram
suspend to ram

Try it from minimum system, but this looks like acpi problem...

Probably, I will investigate thoughtfully this laptop, when I have free time,
It has several broken features including wireless (which works only with disable_hw_scan=1, and still buggy), leds, sound, some messages about APIC 40 error, webcam that freezes afrer a minute or so, or in other words lots of fun....

It has also an XD and memstick reader that aren't supported - I will try to reverse engineer the windows driver, to add those drivers to linux (shouldn't be that hard).

I don't want to bother anybody with this stuff yet, since I have very little free time now.

Best regards,
Maxim Levitsky