Could you try the attached program? This crashes 100% for me, same
stack trace as before.
You will still need to set up an h2c Apache server yourself, with a
large (eg. 10G) file hosted, so that's a bit of a pain, but hopefully
with a standalone program this should be easier to debug. (Not ruling
out a problem with the program itself!)
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
nbdkit - Flexible, fast NBD server with plugins
https://gitlab.com/nbdkit/nbdkit
/* gcc -Wall curl-multi.c -o curl-multi `pkgconf libcurl --cflags` `pkgconf
libcurl --libs` */
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <inttypes.h>
#include <error.h>
#include <errno.h>
#include <curl/curl.h>
static size_t
write_cb (char *ptr, size_t size, size_t nmemb, void *opaque)
{
return size * nmemb;
}
int
main (int argc, char *argv[])
{
const char *url;
CURLM *multi;
CURL *easy;
CURLMcode mc;
int running_handles = 0, numfds;
CURLMsg *msg;
int msgs_in_queue;
char range[128];
if (argc != 2) error (EXIT_FAILURE, 0, "%s URL", argv[0]);
url = argv[1];
multi = curl_multi_init ();
if (multi == NULL)
error (EXIT_FAILURE, errno, "curl_multi_init");
do {
if (running_handles < 500) {
easy = curl_easy_init ();
if (!easy) error (EXIT_FAILURE, errno, "curl_easy_init");
curl_easy_setopt (easy, CURLOPT_VERBOSE, 1L);
curl_easy_setopt (easy, CURLOPT_URL, url);
curl_easy_setopt (easy, CURLOPT_NOSIGNAL, 1L);
curl_easy_setopt (easy, CURLOPT_AUTOREFERER, 1L);
curl_easy_setopt (easy, CURLOPT_FAILONERROR, 1L);
curl_easy_setopt (easy, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_0);
curl_easy_setopt (easy, CURLOPT_WRITEFUNCTION, write_cb);
curl_easy_setopt (easy, CURLOPT_WRITEDATA, NULL);
curl_easy_setopt (easy, CURLOPT_HTTPGET, 1L);
snprintf (range, sizeof range, "%" PRIu64 "-%" PRIu64,
UINT64_C(0), UINT64_C(16384));
curl_easy_setopt (easy, CURLOPT_RANGE, range);
mc = curl_multi_add_handle (multi, easy);
if (mc != CURLM_OK)
error (EXIT_FAILURE, 0, "curl_multi_add_handle: %s",
curl_multi_strerror (mc));
}
mc = curl_multi_perform (multi, &running_handles);
if (mc != CURLM_OK)
error (EXIT_FAILURE, 0, "curl_multi_perform: %s",
curl_multi_strerror (mc));
/* Check for finished handles and remove. */
while ((msg = curl_multi_info_read (multi, &msgs_in_queue)) != NULL) {
if (msg->msg == CURLMSG_DONE) {
curl_multi_remove_handle (multi, msg->easy_handle);
curl_easy_cleanup (msg->easy_handle);
fprintf (stderr, "retiring handle\n");
}
}
mc = curl_multi_poll (multi, NULL, 0, 1000000, &numfds);
if (mc != CURLM_OK)
error (EXIT_FAILURE, 0, "curl_multi_poll: %s",
curl_multi_strerror (mc));
fprintf (stderr, "running_handles = %d\n", running_handles);
} while (running_handles > 0);
exit (EXIT_SUCCESS);
}
--
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library
Etiquette: https://curl.se/mail/etiquette.html