From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id EDD7320709; Tue, 5 Jul 2016 13:50:20 +0000 (UTC) From: Eric Wong To: yahns-public@yhbt.net Cc: Eric Wong Subject: [PATCH 3/3] proxy_pass: avoid stuck responses in "proxy_buffering: false" Date: Tue, 5 Jul 2016 13:50:16 +0000 Message-Id: <20160705135016.14274-4-e@80x24.org> In-Reply-To: <20160705135016.14274-1-e@80x24.org> References: <20160705135016.14274-1-e@80x24.org> List-Id: Another critical bugfix for this yet-to-be-released feature. By the time we call proxy_unbuffer in proxy_read_body, the req_res socket may be completely drained of readable data and a persistent-connection-capable backend will be waiting for the next request (not knowing we do not yet support persistent connections). This affects both chunked and identity responses from the upstream. --- lib/yahns/wbuf_lite.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/yahns/wbuf_lite.rb b/lib/yahns/wbuf_lite.rb index fa52f54..25daf21 100644 --- a/lib/yahns/wbuf_lite.rb +++ b/lib/yahns/wbuf_lite.rb @@ -33,10 +33,14 @@ def wbuf_flush(client) def wbuf_close(client) wbuf_abort - # resume reading when @blocked is empty + # resume the event loop when @blocked is empty + # The actual Yahns::ReqRes#yahns_step is actually read/write-event + # agnostic, and we should actually watch for writability here since + # the req_res socket itself could be completely drained of readable + # data and just waiting for another request (which we don't support, yet) if @req_res client.hijack_cleanup - Thread.current[:yahns_queue].queue_mod(@req_res, Yahns::Queue::QEV_RD) + Thread.current[:yahns_queue].queue_mod(@req_res, Yahns::Queue::QEV_WR) return :ignore end @wbuf_persist -- EW