Re: EINTR error in SunOS - Mailing list pgsql-hackers

From Greg Stark
Subject Re: EINTR error in SunOS
Date
Msg-id 87r77t6i3v.fsf@stark.xeocode.com
Whole thread Raw
In response to Re: EINTR error in SunOS  (Qingqing Zhou <zhouqq@cs.toronto.edu>)
Responses Re: EINTR error in SunOS
Re: EINTR error in SunOS
List pgsql-hackers
Qingqing Zhou <zhouqq@cs.toronto.edu> writes:

> On Sat, 31 Dec 2005, Greg Stark wrote:
> 
> >
> > I don't think that's reasonable. The NFS intr option breaks the traditional
> > unix filesystem semantics which breaks a lot of older or naive programs. But
> > that's no reason to decide that Postgres can't handle the new semantics.
> >
> 
> Is that by default the EINTR is truned off in NFS? If so, I don't see that
> will be a problem. Sorry for my limited knowledge, is there any
> requirements/benefits that people turn on EINTR?

That's why the "intr" option (and the "soft") option has traditionally not
been enabled by default in NFS implementations. But many people don't like
that when their NFS server disappears their client applications become
unkillable. They like to be able to hit C-c and stop whatever is running.

In the case of Postgres having "intr" off on the NFS mount point would mean
you couldn't C-c a query stuck because the database is on NFS. Of course it's
not like you would be able to run any more queries after that, but you might
want your terminal back.

You wouldn't even be able to shut down Postgres, even with kill -9. If your
NFS server is unrecoverable and you want to bring up a Postgres instance using
a backup restored some other place you would have to bring it up on another
port or reboot your machine.

That's the kind of thing that leads lots of sysadmins to use the "intr" and
"soft" options. And those sysadmins generally aren't aware of these kinds of
consequences since it's more of a programming level issue.

> > Handling EINTR after all file system calls doesn't sound like it would be
> > terribly hard.
> 
> The problem is not restricted to file system. Actually my patched
> version(only backend/storage) passed hundreds times of regression without
> any problem, but EINTR can hurt other syscalls as well. Find out *all* the
> EINTR situtations may need big efforts AFAICS.

Well NFS is only going to affect filesystem calls. If there are other syscalls
that can signal EINTR on some obscure platform where Postgres isn't handling
it then that's just a run-of-the-mill porting issue.

But like I mentioned in the other thread POSIX is of no help here. With the
exception of the pthreads syscalls POSIX doesn't prohibit functions from
signalling errors other than the ones documented in the specification. So in
other words, just about any function can signal just about any error including
errors that are proprietary additions any time. Good luck :)

-- 
greg



pgsql-hackers by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: EINTR error in SunOS
Next
From: Qingqing Zhou
Date:
Subject: Re: EINTR error in SunOS