[Varnish] #475: usleep() does not handle errors correctly (values > 1,000,000 aren’t allowed on NetBSD)
Varnish
varnish-bugs at projects.linpro.no
Sun Mar 22 15:00:28 CET 2009
#475: usleep() does not handle errors correctly (values > 1,000,000 aren’t
allowed on NetBSD)
----------------------+-----------------------------------------------------
Reporter: michael | Owner: phk
Type: defect | Status: new
Priority: high | Milestone: Varnish 2.1 release
Component: varnishd | Version: trunk
Severity: normal | Keywords: NetBSD
----------------------+-----------------------------------------------------
On NetBSD, varnish was causing very high load.
After a while of debugging, I found the usleep() calls to not sleep at
all. This is caused by using param->wthread_purge_delay (= 1000) and
multiplying it with 1000, this going beyond the limit of 1,000,000 for
usleep(). On other systems, this error is ingored, on NetBSD however,
usleep() will immediately return with -EINVAL.
The attached patch adds a new function to libvarnish, called TIM_usleep,
which handles this usleep()-error correctly and falls back to sleep().
This fixes the CPU issue with varnish on NetBSD :-).
--
Ticket URL: <http://varnish.projects.linpro.no/ticket/475>
Varnish <http://varnish.projects.linpro.no/>
The Varnish HTTP Accelerator
More information about the varnish-bugs
mailing list