[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: file-descriptor probs.

From: Greg Stein <gstein_at_lyra.org>
Date: 2001-09-20 02:40:48 CEST

On Thu, Sep 20, 2001 at 12:43:39AM +0100, Joe Orton wrote:
> On Thu, Sep 20, 2001 at 01:22:42AM +0200, Branko �ibej wrote:
>...
> > ... which won't work on Windows, where an apr_os_file_t is a HANDLE, not
> > a Unix-like file descriptor.

Yup. I alluded to that earlier, which is why Bill went and looked for those
mapping functions.

> > I don't know how to solve this except by moving neon on top of APR, or
> > changing neon's interface to use some kind of generic stream, like we do
> > in Subversion.
>
> The problem is that neon offers a generic interface to "pull" request
> bodies (i.e., you provide a callback, neon calls it to get a block of
> data).

Yes... it does :-) I suggested that interface, and the excellent Mr Orton
went and coded the thing into Neon. It actually gives us what we need.

> But SVN wants a "push" interface: it's hard to offer this
> without a complete rewrite of the neon request code (which to be fair is
> needed anyway).

Nah. We can spin up a second thread, establish a pipe between the two
threads, and SVN push data into the pipe while Neon reads it from the pipe.
It would work great. No temp file! Yah... that's it. That's what we'll do!

*slap*

Okay. Sorry. :-)

We don't actually have to go to that extreme. We can use Neon's callback to
read from the apr_file_t and never worry about file descriptors or HANDLEs
or whatever.

That said: having a "push" interface in Neon would be quite nice -- it would
eliminate the need for a temporary file altogether.

> Having neon support APR just makes the workaround for this API mismatch
> a bit easier.

No need for it, as we can use the callback functions per above.

However, the problem that Ben is seeing is much more subtle, and indicates a
very deep bug somewhere. Possibly even in the OS. We have the following
lines from a truss output (on his FreeBSD box):

write(4,0x8111ae2,19) = 19 (0x13)
lseek(4,0x0,0) = 0 (0x0)
fstat(4,0xbfbff714) = 0 (0x0)
socket(0x2,0x1,0x0) = 5 (0x5)
connect(0x5,0xbfbff284,0x10) = 0 (0x0)
write(5,0x8144800,206) = 206 (0xce)
lseek(4,0x0,0) = 0 (0x0)
read(0x4,0xbfbfeea4,0x400) ERR#9 'Bad file descriptor'
write(5,0xbfbfeea4,-1) ERR#22 'Invalid argument'

The first write() is putting the svndiff into the temp file. Then we rewind
it. Neon fstat's it to get the size, opens the socket to the server, writes
the header information, then rewinds the temp file. It then goes to read the
file and blows up.

The problem is that the read() returns EBADF, but there is no close(!)

Anybody ever see this before? (on FreeBSD, recall)

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 21 14:36:42 2006

This is an archived mail posted to the Subversion Dev mailing list.