cgit 1.2.3: lighttpd 1.4.57, AlpineLinux [edge]: using cache breaks delivery

Steffen Nurpmeso steffen at sdaoden.eu
Tue Dec 22 14:55:37 CET 2020


gs-cgit-lists.zx2c4.com at gluelogic.com wrote in
 <20201222061206.GA54419 at xps13>:
 |>Steffen Nurpmeso wrote in
 |> <20201221193127.zbZeP%steffen at sdaoden.eu>:
 |>|John Keeping wrote in
 |>| <X+DiDgGaPaynnocI at john.keeping.me.uk>:
 |>||On Mon, Dec 21, 2020 at 05:26:19PM +0100, Steffen Nurpmeso wrote:
 |>||> I discovered today that cgit no longer delivers pages, and it must
 |>||> have been like that for some time.  The server looks show
 |>||> successful delivery, the cgit cache is populated and rotated just
 |>||> correctly, but all cgit delivers is that final error of main() as
 |>||> 
 |>||>   <div class='error'>Error processing page: Invalid argument (22)</div\
 |>||>   >
 |> ...
 |>||> I am pretty sure cgit delivered some weeks ago, the most notable
 |>||> difference is that AlpineLinux switched to Lighttpd 1.4.56 then
 |>||> .57, which seems to have brought tremendous changes under the
 |> ...
 |>|But the file was generated normally:
 |>|
 |>|  # ll /var/lib/lighttpd/cgit/b1000000
 |>|  -rw-------    1 lighttpd lighttpd     23417 Dec 21 20:22 /var/lib/light\
 |>|  tpd/cgit/b1000000
 |> ...
 |>
 |>Slightly resorted:
 |>
 |> ...
 |>||Have you looked at the log output?
 |>|  [cgit] error printing cache /var/lib/lighttpd/cgit/b1000000: Invalid \
 |>|  argument (22)
 |> ...
 |>||and this may be caused by sendfile(2) failing due to some difference in
 |>||how the web server is setting up the output file descriptor.  You may
 |>||want to rebuild CGit without HAVE_LINUX_SENDFILE and see if that works.
 |>
 |>So i build it with
 ...
 |>  -       CGIT_CFLAGS += -DHAVE_LINUX_SENDFILE
 |>  +       #CGIT_CFLAGS += -DHAVE_LINUX_SENDFILE
 ...
 |>and .. it works.
 |>
 |>Thank you, i will open an AlpineLinux bug report.  And lighttpd.
 ...

 |I would like to propose an alternative and more portable solution:
 |
 |cgit cache should fallback to lseek, xread, xwrite if sendfile fails.

(Yes.)

 |Even if the kernel supports sendfile() and cgit is built with
 |HAVE_LINUX_SENDFILE defined, certain filesystem types might not support
 |sendfile() operations.

This is ext3 and the overall system has not changed for years (but
following AlpineLinux [edge]).

 |The following patch falls back to lseek, xread, xwrite if the *initial*
 |call to sendfile() fails.

I will use it this afternoon, and do some more testing on the
descriptor (fstat, i don't know) because gstrauss (lighttpd
maintainer) is "driving up the walls" because he cannot reproduce
the issue it seems.  He says nothing changed regarding the
descriptor handling, mysterious, maybe a kernel bug, 5.10.1 it is
at the moment.

 |diff --git a/cache.c b/cache.c
 ...

Thanks, and
Ciao,

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


More information about the CGit mailing list