9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] drawterm dies when my mac book sleeps by 9p design?
@ 2011-03-07  0:35 Fernan Bolando
  2011-03-07  2:34 ` erik quanstrom
  0 siblings, 1 reply; 13+ messages in thread
From: Fernan Bolando @ 2011-03-07  0:35 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

Hi all

apparently mac os x turns off wifi when it decides to go low power. It
can a happily recover most connections that do not require a steady
flow of data.
I have not tested it but I dont think it turns off wifi when torrent
or ssh is connected to a host. Drawterm dies with a sysfatal error,
when the mac book wakes up.

Is this how 9p currently behaves or is there some settings somewhere
that will help prevent it? Is there a thread that have already
discussed

fernan



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9fans] drawterm dies when my mac book sleeps by 9p design?
  2011-03-07  0:35 [9fans] drawterm dies when my mac book sleeps by 9p design? Fernan Bolando
@ 2011-03-07  2:34 ` erik quanstrom
  2011-03-07  3:31   ` Bakul Shah
  0 siblings, 1 reply; 13+ messages in thread
From: erik quanstrom @ 2011-03-07  2:34 UTC (permalink / raw)
  To: fernanbolando, 9fans

> Is this how 9p currently behaves or is there some settings somewhere
> that will help prevent it? Is there a thread that have already
> discussed

it's actually tcp that's timing out, not 9p.

this is how almost all connection-based protocols behave.
typically there are keep-alive packets set every so often.
and if the last time a packet was received from the other
side was too long ago, the connection is declared defunct
and closed.

there may be some controls determining how soon to turn
off the wifi that may be of some help.

- erik



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9fans] drawterm dies when my mac book sleeps by 9p design?
  2011-03-07  2:34 ` erik quanstrom
@ 2011-03-07  3:31   ` Bakul Shah
  2011-03-07  3:34     ` erik quanstrom
  0 siblings, 1 reply; 13+ messages in thread
From: Bakul Shah @ 2011-03-07  3:31 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Sun, 06 Mar 2011 21:34:58 EST erik quanstrom <quanstro@quanstro.net>  wrote:
> > Is this how 9p currently behaves or is there some settings somewhere
> > that will help prevent it? Is there a thread that have already
> > discussed
>
> it's actually tcp that's timing out, not 9p.
>
> this is how almost all connection-based protocols behave.
> typically there are keep-alive packets set every so often.
> and if the last time a packet was received from the other
> side was too long ago, the connection is declared defunct
> and closed.
>
> there may be some controls determining how soon to turn
> off the wifi that may be of some help.

You don't need to mess with the wifi.  Just do

$ sysctl -w net.inet.tcp.always_keepalive=0

This will prevent the stack from sending any keepalive packets
on its own.  But this will *not* help if the higher level
protocol generates such packets.



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9fans] drawterm dies when my mac book sleeps by 9p design?
  2011-03-07  3:31   ` Bakul Shah
@ 2011-03-07  3:34     ` erik quanstrom
  2011-03-07  4:15       ` Bakul Shah
  0 siblings, 1 reply; 13+ messages in thread
From: erik quanstrom @ 2011-03-07  3:34 UTC (permalink / raw)
  To: 9fans

> > there may be some controls determining how soon to turn
> > off the wifi that may be of some help.
>
> You don't need to mess with the wifi.  Just do
>
> $ sysctl -w net.inet.tcp.always_keepalive=0
>
> This will prevent the stack from sending any keepalive packets
> on its own.  But this will *not* help if the higher level
> protocol generates such packets.

i don't think that does what you think it does.  the timers
on the plan 9 side will keep running.

- erik



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9fans] drawterm dies when my mac book sleeps by 9p design?
  2011-03-07  3:34     ` erik quanstrom
@ 2011-03-07  4:15       ` Bakul Shah
  2011-03-07  4:17         ` erik quanstrom
  2011-03-07  4:25         ` ron minnich
  0 siblings, 2 replies; 13+ messages in thread
From: Bakul Shah @ 2011-03-07  4:15 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Sun, 06 Mar 2011 22:34:03 EST erik quanstrom <quanstro@quanstro.net>  wrote:
> > > there may be some controls determining how soon to turn
> > > off the wifi that may be of some help.
> >
> > You don't need to mess with the wifi.  Just do
> >
> > $ sysctl -w net.inet.tcp.always_keepalive=0
> >
> > This will prevent the stack from sending any keepalive packets
> > on its own.  But this will *not* help if the higher level
> > protocol generates such packets.
>
> i don't think that does what you think it does.  the timers
> on the plan 9 side will keep running.

Don't know about plan9.

This setting works for ssh, xterm etc. between *BSD/Mac and I
think Linux (Windows forcibly terminates everything when the
link goes down -- there may be a setting to disable keepalives
but I try not to know more about Windows).

>From RFC1122:

         4.2.3.6  TCP Keep-Alives

            Implementors MAY include "keep-alives" in their TCP
            implementations, although this practice is not universally
            accepted.  If keep-alives are included, the application MUST
            be able to turn them on or off for each TCP connection, and
            they MUST default to off.




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9fans] drawterm dies when my mac book sleeps by 9p design?
  2011-03-07  4:15       ` Bakul Shah
@ 2011-03-07  4:17         ` erik quanstrom
  2011-03-07  4:25         ` ron minnich
  1 sibling, 0 replies; 13+ messages in thread
From: erik quanstrom @ 2011-03-07  4:17 UTC (permalink / raw)
  To: 9fans

> This setting works for ssh, xterm etc. between *BSD/Mac and I
> think Linux (Windows forcibly terminates everything when the
> link goes down -- there may be a setting to disable keepalives
> but I try not to know more about Windows).
>
>  From RFC1122:
>
>          4.2.3.6  TCP Keep-Alives
>
>             Implementors MAY include "keep-alives" in their TCP
>             implementations, although this practice is not universally
>             accepted.  If keep-alives are included, the application MUST
>             be able to turn them on or off for each TCP connection, and
>             they MUST default to off.

read the section on timers.  if you don't do keep-alives, then
your session will timeout if there's no traffic.  keep-alives do not
affect timers.

- erik



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9fans] drawterm dies when my mac book sleeps by 9p design?
  2011-03-07  4:15       ` Bakul Shah
  2011-03-07  4:17         ` erik quanstrom
@ 2011-03-07  4:25         ` ron minnich
  2011-03-07  4:44           ` Bakul Shah
                             ` (2 more replies)
  1 sibling, 3 replies; 13+ messages in thread
From: ron minnich @ 2011-03-07  4:25 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

I used to work with David Mills, back long ago. He was one of the
original Internet Buzzards, a really great guy. One of the many things
he invented was NTP.

He would get pretty exercised about keep-alives. Felt that it was not
the business of TCP to make these kinds of decisions. I can't remember
if he actually called them an abomination, but at the same time, one
was left with the feeling that he might have.

I never fully appreciated his argument until John DeGood described ham
radio internet tcp sessions (this is also long ago) that would halt
for days, then come back to life. That's pretty neat, and it can be
hard if you are depending on keepalives. Just about any value you pick
will be wrong.

So, yeah, they're out there and I guess nowadays everyone does them.
Whether they are a good idea is somebody else's guess, I suppose. I
note that today I slept my mac several times during this workshop and
my ssh session was always there when I opened the lid again. That's
nice.

ron



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9fans] drawterm dies when my mac book sleeps by 9p design?
  2011-03-07  4:25         ` ron minnich
@ 2011-03-07  4:44           ` Bakul Shah
  2011-03-07  4:51             ` erik quanstrom
  2011-03-07  4:49           ` Lyndon Nerenberg (VE6BBM/VE7TFX)
  2011-03-07  8:54           ` Anthony Sorace
  2 siblings, 1 reply; 13+ messages in thread
From: Bakul Shah @ 2011-03-07  4:44 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Sun, 06 Mar 2011 20:25:10 PST ron minnich <rminnich@gmail.com>  wrote:
> I used to work with David Mills, back long ago. He was one of the
> original Internet Buzzards, a really great guy. One of the many things
> he invented was NTP.

I wonder if he still owns a class B block of IP addresses :-)
[A friend did his PhD with him so we heard stories.]

> He would get pretty exercised about keep-alives. Felt that it was not
> the business of TCP to make these kinds of decisions. I can't remember
> if he actually called them an abomination, but at the same time, one
> was left with the feeling that he might have.

Agreed 100%. TCP is supposed to be resilient and not throw a
fit every time a link goes down.

> I never fully appreciated his argument until John DeGood described ham
> radio internet tcp sessions (this is also long ago) that would halt
> for days, then come back to life. That's pretty neat, and it can be
> hard if you are depending on keepalives. Just about any value you pick
> will be wrong.

A TCP connection is defined as <src-ip-addr, src-port,
dst-ip-addr, dst-port>. As long as these are in use, and a
path exists *when* a packet is to be sent, it is no one
else's business to consider it dead!

> So, yeah, they're out there and I guess nowadays everyone does them.
> Whether they are a good idea is somebody else's guess, I suppose. I
> note that today I slept my mac several times during this workshop and
> my ssh session was always there when I opened the lid again. That's
> nice.

I routinely leave ssh, xterm etc. alive for weeks on end and
my macbookpro puts itself to sleep a few times a day!  Even
when I used to take my laptop to work, no connexion broke as
long as avoided accidentally typing in the window (which would
generate traffic).



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9fans] drawterm dies when my mac book sleeps by 9p design?
  2011-03-07  4:25         ` ron minnich
  2011-03-07  4:44           ` Bakul Shah
@ 2011-03-07  4:49           ` Lyndon Nerenberg (VE6BBM/VE7TFX)
  2011-03-07  5:00             ` erik quanstrom
  2011-03-07  8:54           ` Anthony Sorace
  2 siblings, 1 reply; 13+ messages in thread
From: Lyndon Nerenberg (VE6BBM/VE7TFX) @ 2011-03-07  4:49 UTC (permalink / raw)
  To: 9fans

> He would get pretty exercised about keep-alives. Felt that it was not
> the business of TCP to make these kinds of decisions. I can't remember
> if he actually called them an abomination, but at the same time, one
> was left with the feeling that he might have.

I'm sure he's called them worse than that over the years.  And he could
not be more right.

We have been inflicted with keepalives as a workaround to the only
worse abomination on the planet: shitty shitty shitty home NAT routers
that have a ten minute attention span.

--lyndon




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9fans] drawterm dies when my mac book sleeps by 9p design?
  2011-03-07  4:44           ` Bakul Shah
@ 2011-03-07  4:51             ` erik quanstrom
  2011-03-07  5:38               ` Bakul Shah
  0 siblings, 1 reply; 13+ messages in thread
From: erik quanstrom @ 2011-03-07  4:51 UTC (permalink / raw)
  To: 9fans

> I routinely leave ssh, xterm etc. alive for weeks on end and
> my macbookpro puts itself to sleep a few times a day!  Even
> when I used to take my laptop to work, no connexion broke as
> long as avoided accidentally typing in the window (which would
> generate traffic).

now that's robust.

back to the problem at hand, lets suppose that the mac doesn't
generate keep alive traffic, and lets suppose that plan 9 doesn't either,
it's going to be hard to come up with a drawterm setup that is useful and
has no programs that walk /dev by doing things like calling time().

- erik



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9fans] drawterm dies when my mac book sleeps by 9p design?
  2011-03-07  4:49           ` Lyndon Nerenberg (VE6BBM/VE7TFX)
@ 2011-03-07  5:00             ` erik quanstrom
  0 siblings, 0 replies; 13+ messages in thread
From: erik quanstrom @ 2011-03-07  5:00 UTC (permalink / raw)
  To: 9fans

On Sun Mar  6 23:50:48 EST 2011, lyndon@orthanc.ca wrote:
> > He would get pretty exercised about keep-alives. Felt that it was not
> > the business of TCP to make these kinds of decisions. I can't remember
> > if he actually called them an abomination, but at the same time, one
> > was left with the feeling that he might have.
>
> I'm sure he's called them worse than that over the years.  And he could
> not be more right.
>
> We have been inflicted with keepalives as a workaround to the only
> worse abomination on the planet: shitty shitty shitty home NAT routers
> that have a ten minute attention span.

oddly enough, il has always had a non-optional keepalive timer.

however there are no (that i know of) application-level timers in plan 9.
so when the file server went out to lunch for a 1 hr maintence window
on the aoe hardware, everything hung and peacefully waited for the
storage to reappear.  when it did, it was as if nothing had happened.

on linux, things would have gone quite sideways because there were
outstanding requests to the storage and there are timers left right and
center.  though in this case there was nothing sensible to do but wait for
the storage.

rather than get on high horses, i think we should admit that timers are
dangerous.  not having timers can also be dangerous.  in short, there's no
winning.

- erik



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9fans] drawterm dies when my mac book sleeps by 9p design?
  2011-03-07  4:51             ` erik quanstrom
@ 2011-03-07  5:38               ` Bakul Shah
  0 siblings, 0 replies; 13+ messages in thread
From: Bakul Shah @ 2011-03-07  5:38 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Sun, 06 Mar 2011 23:51:34 EST erik quanstrom <quanstro@quanstro.net>  wrote:
> back to the problem at hand, lets suppose that the mac doesn't
> generate keep alive traffic, and lets suppose that plan 9 doesn't either,
> it's going to be hard to come up with a drawterm setup that is useful and
> has no programs that walk /dev by doing things like calling time().

That's why I said disabling tcp keepalives won't help if the
higher level protocol can generate packets while the link is
be down. Either change the protocol (to limp along in an
"offline" mode -- get time() locally?) or retry connecting or
live with what is there.



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9fans] drawterm dies when my mac book sleeps by 9p design?
  2011-03-07  4:25         ` ron minnich
  2011-03-07  4:44           ` Bakul Shah
  2011-03-07  4:49           ` Lyndon Nerenberg (VE6BBM/VE7TFX)
@ 2011-03-07  8:54           ` Anthony Sorace
  2 siblings, 0 replies; 13+ messages in thread
From: Anthony Sorace @ 2011-03-07  8:54 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

// I can't rememberif he actually called them an
// abomination, but at the same time, onewas left
// with the feeling that he might have.

Geoff's explanation to me a long time ago wasn't quite as emotional, but was quite helpful for understanding what was actually going on:

"They're not 'keep alives'. They're 'make deads'."




^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2011-03-07  8:54 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-07  0:35 [9fans] drawterm dies when my mac book sleeps by 9p design? Fernan Bolando
2011-03-07  2:34 ` erik quanstrom
2011-03-07  3:31   ` Bakul Shah
2011-03-07  3:34     ` erik quanstrom
2011-03-07  4:15       ` Bakul Shah
2011-03-07  4:17         ` erik quanstrom
2011-03-07  4:25         ` ron minnich
2011-03-07  4:44           ` Bakul Shah
2011-03-07  4:51             ` erik quanstrom
2011-03-07  5:38               ` Bakul Shah
2011-03-07  4:49           ` Lyndon Nerenberg (VE6BBM/VE7TFX)
2011-03-07  5:00             ` erik quanstrom
2011-03-07  8:54           ` Anthony Sorace

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).