List for cgit developers and users
 help / color / mirror / Atom feed
From: john at keeping.me.uk (John Keeping)
Subject: premature exits bork cache
Date: Fri, 26 Feb 2016 16:09:32 +0000	[thread overview]
Message-ID: <20160226160932.GQ1766@serenity.lan> (raw)
In-Reply-To: <CAHmME9oStUe22mDw-NRsLP9RQ9DHbS89tETB+RmN2=SQ3tmFsQ@mail.gmail.com>

On Fri, Feb 26, 2016 at 01:29:21PM +0100, Jason A. Donenfeld wrote:
> When caching is turned on, if we exit(0) early from a cmd, the cache
> won't be properly finalized (or even sent), and we get a server error
> because of blank output. I just fixed this bug with redirect:
> 
> https://git.zx2c4.com/cgit/commit/?id=e9cbdf64632fbe64d6b0c4974ac947ef954938e7
> 
> This is fine, because it's called only from 1 function (three times),
> and that function then returns, so execution doesn't continue after
> the redirect. It simply gives control back to the caching layer that
> does things properly now.
> 
> But I noticed we have this issue with HTTP HEAD method:
> 
> https://git.zx2c4.com/cgit/tree/ui-shared.c#n695
> 
> Here we're calling exit(0). The motivation, I imagine, was that we
> want to retain the same handlers, but just return the headers for the
> HEAD method. Unfortunately, this borks the cache layer for the same
> reasons as described above. I'm not yet sure the cleanest way to fix
> this. Suggestions?

We set cfg.nocache in cgit.c for HEAD requests so I think we're already
okay in this case, although it is a subtle interaction.


  reply	other threads:[~2016-02-26 16:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-26 12:29 Jason
2016-02-26 16:09 ` john [this message]
2016-02-26 16:18   ` Jason

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160226160932.GQ1766@serenity.lan \
    --to=cgit@lists.zx2c4.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).