Tarantool development patches archive
 help / color / mirror / Atom feed
From: Ilya Kosarev <i.kosarev@tarantool.org>
To: tarantool-patches@dev.tarantool.org
Subject: [Tarantool-patches] [PATCH v5 1/3] httpc: fix assertion fail after curl write error
Date: Thu,  7 Nov 2019 15:07:14 +0300	[thread overview]
Message-ID: <40e665ace244806d8ccd34286f3d64ef32b2c1c5.1573127783.git.i.kosarev@tarantool.org> (raw)
In-Reply-To: <cover.1573127783.git.i.kosarev@tarantool.org>
In-Reply-To: <cover.1573127783.git.i.kosarev@tarantool.org>

After executing curl request we need to process curl_request code. It
might be CURLE_WRITE_ERROR. We had special case for it, which assumed
diagnostic message being set and contained corresponding assert, though
it is incorrect. Better way is to handle it as any other non-standard
event.
It was discovered while adding accept_encoding option. In case of
unknown encoding curl_request code is currently set to
CURLE_WRITE_ERROR and therefore we come to an assert assuming we have
some diagnostics set. However, it is not being set and it is totally
fine. This means we are failing on assert and it is not correct
behavior.

Prerequisites: #4232
---
 src/httpc.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/src/httpc.c b/src/httpc.c
index 8d18b9966..212064080 100644
--- a/src/httpc.c
+++ b/src/httpc.c
@@ -429,16 +429,12 @@ httpc_execute(struct httpc_request *req, double timeout)
 	case CURLE_COULDNT_RESOLVE_PROXY:
 	case CURLE_COULDNT_RESOLVE_HOST:
 	case CURLE_COULDNT_CONNECT:
+	case CURLE_WRITE_ERROR:
 		/* 595 Connection Problem (AnyEvent non-standard) */
 		req->status = 595;
 		req->reason = curl_easy_strerror(req->curl_request.code);
 		++env->stat.failed_requests;
 		break;
-	case CURLE_WRITE_ERROR:
-		/* Diag is already set by curl_write_cb() */
-		assert(!diag_is_empty(&fiber()->diag));
-		++env->stat.failed_requests;
-		return -1;
 	case CURLE_OUT_OF_MEMORY:
 		diag_set(OutOfMemory, 0, "curl", "internal");
 		++env->stat.failed_requests;
-- 
2.17.1

  reply	other threads:[~2019-11-07 12:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-07 12:07 [Tarantool-patches] [PATCH v5 0/3] httpc: add curl accept_encoding option and relevant fixes Ilya Kosarev
2019-11-07 12:07 ` Ilya Kosarev [this message]
2019-11-07 12:07 ` [Tarantool-patches] [PATCH v5 2/3] httpc: add curl accept_encoding option Ilya Kosarev
2019-12-23 11:05   ` Alexander Turenko
2019-11-07 12:07 ` [Tarantool-patches] [PATCH v5 3/3] httpc: handle bad Content-Encoding with curl-7.67.0+ Ilya Kosarev
2019-12-23 11:38 ` [Tarantool-patches] [PATCH v5 0/3] httpc: add curl accept_encoding option and relevant fixes Alexander Turenko

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=40e665ace244806d8ccd34286f3d64ef32b2c1c5.1573127783.git.i.kosarev@tarantool.org \
    --to=i.kosarev@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v5 1/3] httpc: fix assertion fail after curl write error' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox