Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Sep 2020 17:16:14 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 246886] [sendfile] Nginx + NFS or FUSE causes VM stall
Message-ID:  <bug-246886-227-VOfl6wOZ5d@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-246886-227@https.bugs.freebsd.org/bugzilla/>
References:  <bug-246886-227@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D246886

--- Comment #54 from Gleb Smirnoff <glebius@FreeBSD.org> ---
Then that's a crazy mix of subsystems involved!

Here goes description of how nginx combines aio and sendfile. When sendfile=
(2)
returns EBUSY, nginx would do aio_read(2) of 1 byte out of the file, and us=
e a
side effect of the page being cached, then it would retry sendfile again.

Note, that EBUSY from sendfile in FreeBSD 11 and before means totally diffe=
rent
thing than EBUSY from sendfile on FreeBSD 12 and after. On older versions E=
BUSY
means that SF_NODISKIO was set on request and file is not in memory. On new
versions EBUSY is a soft error that means page is busy (again SF_NODISKIO is
set). The busy condition would go away in a few milliseconds. However, nginx
doesn't differentiate between versions of FreeBSD and always does this
aio_read() of 1 byte. It is harmless on newer versions of FreeBSD and just =
adds
a small delay before retry. At Netflix we have removed this code from nginx=
 and
in case of EBUSY we just retry after a timer, so we don't use aio.

It is entirely possible that problem shows up only when aio_read() and send=
file
are combined on the same region of a file on NFS or FUSE :(

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-246886-227-VOfl6wOZ5d>