Mailing List Archive

r910 - trunk/varnish-cache/bin/varnishd
Author: phk
Date: 2006-08-24 08:15:13 +0200 (Thu, 24 Aug 2006)
New Revision: 910

Modified:
trunk/varnish-cache/bin/varnishd/cache_acceptor.c
Log:
This is a workaround for what is probably a race in FreeBSD RELENG_6
socket dismantling.

There is no way that close(2) should ever be able to return EINVAL,
but we've seen it.

Specifically assert on EBADF which is the check we're really after.



Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-23 14:30:06 UTC (rev 909)
+++ trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-24 06:15:13 UTC (rev 910)
@@ -141,10 +141,13 @@
void
vca_close_session(struct sess *sp, const char *why)
{
+ int i;

VSL(SLT_SessionClose, sp->fd, why);
- if (sp->fd >= 0)
- AZ(close(sp->fd));
+ if (sp->fd >= 0) {
+ i = close(sp->fd);
+ assert(i == 0 || errno != EBADF); /* XXX EINVAL seen */
+ }
sp->fd = -1;
}