"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: gotwebd: handle short reads and timeouts
To:
Omar Polo <op@omarpolo.com>
Cc:
gameoftrees@openbsd.org
Date:
Fri, 10 Mar 2023 18:42:47 +0100

Download raw body.

Thread
On Fri, Mar 10, 2023 at 06:23:26PM +0100, Omar Polo wrote:
> Diff below fixes two issue:
> 
>  - the second hunk guards the only gotweb_free_transport call for a
>    NULL transport.  If we hit the timeout *before*
>    gotweb_process_request c->t is NULL and we crash
> 
>  - the other hunks deal with short reads.  fcgi_request reads in a
>    buffer one or more fcgi records and parses all it has read.  If a
>    short reads happens, we still have to read part of a record, and we
>    currently fail to handle that case because:
> 
>    1. fcgi_request is not scheduled again; so the timeout hits and we
>       crash in gotweb_free_transport; so register the event handler
>       with EV_PERSIST.  (alternatively we could call event_add() in
>       fcgi_request)
> 
>    2. drop the parsed record at every successful loop invocation,
>       otherwise we may fail to make space for the next record.
> 
> Many, many thanks to stsp for helping debugging this :)

Makes sense to me (while our discusson on IRC is still fresh on my mind ;)

ok.