On Tuesday 05:39 PM 8/19/2008, Jim Davidson wrote:
Your right, the code snippet below could trip over a race condition as you've described.
It's not a race condition, actually; the code in that example was serialized, so there's no race involved.
...fastpath isn't broken.
It's designed in such a way that it can return incorrect results (and ones that are wildly outside of reasonable expectations). Whether or not that's broken is a judgment call, and there we apparently differ, though I find that surprising--just because bad behavior can be documented and avoided doesn't mean it's not bad behavior.
Anyway, for your app, it might be easiest to not change your code but instead write a new ns_returnfile to override the builtin -- maybe just with open and ns_returnfp.
Yep, that was essentially my original suggestion to the developers. I can guarantee you that all uses of ns_returnfile will be receiving close scrutiny. :-)
On Tuesday 05:59 PM 8/19/2008, Juan José del Río wrote:
If you don't want to deactivate it, and have some C skills, I would recommend you to make the needed changes to fastpath code to enable it to use the kernel facilities of the operating system (in case you're using linux, then that'll be "epoll" system call; in FreeBSD case it's kqueue; etc.).
This is an interesting suggestion, but from a quick scan of the epoll man page it doesn't look like it would work in this case since it acts on an open file descriptor, but fastpath associates file data with a (dev, inode, mtime, size) tuple without keeping an open file descriptor (and it'd be pretty wonky for AOLserver to keep open file descriptors for all files currently in the fastpath cache).
No matter, though, we've got plenty of workarounds, and we'll probably just disable fastpath entirely since the benefits are likely vanishingly small anyway.
- John -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]> with the body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: field of your email blank.