Fabian Keil <[email protected]> wrote:

> Test 584 has recently become unreliable on FreeBSD:
[...] 
> Bisecting lead to 5b2342d3772.
> 
> The attached work-around brings back one of the removed infof()
> lines and gets the test working reliably again.
> 
> I assume that's because the info() call has the side effect of
> slightly delaying Curl_addHandleToPipeline(), but I haven't
> confirmed that.

The attached patch uses wait_ms(1) instead of info() and
works around the problem as well, so I consider this
theory confirmed.

Fabian
From 2ec46c558ab3772099f573ee6949f08607e7d667 Mon Sep 17 00:00:00 2001
From: Fabian Keil <[email protected]>
Date: Wed, 22 Jan 2014 14:33:14 +0100
Subject: [PATCH] Delay Curl_addHandleToPipeline() by a milisecond

Work-around to get test 584 working reliably on FreeBSD 11-CURRENT
again after 5b2342d3772 removed a couple of log messages which made
the function faster.
---
 lib/url.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/lib/url.c b/lib/url.c
index fba3bd3..e975ae1 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -2723,11 +2723,21 @@ bool Curl_isPipeliningEnabled(const struct SessionHandle *handle)
   return Curl_multi_pipeline_enabled(handle->multi);
 }
 
+static void wait_ms(int ms)
+{
+  struct timeval t;
+  t.tv_sec = ms/1000;
+  ms -= (int)t.tv_sec * 1000;
+  t.tv_usec = ms * 1000;
+  select(0, NULL, NULL , NULL, &t);
+}
+
 CURLcode Curl_addHandleToPipeline(struct SessionHandle *data,
                                   struct curl_llist *pipeline)
 {
   if(!Curl_llist_insert_next(pipeline, pipeline->tail, data))
     return CURLE_OUT_OF_MEMORY;
+  wait_ms(1);
   return CURLE_OK;
 }
 
-- 
1.9.0

Attachment: signature.asc
Description: PGP signature

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Reply via email to