[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: Re: Re: [Libevent-users] Assert fail in evhttp_connection_fail_ with req=0x00 on error=EVREQ_HTTP_TIMEOUT at http.c:691
Full testcase:
diff --git a/sample/https-client.c b/sample/https-client.c
index b5f0b1a..235fe69 100644
--- a/sample/https-client.c
+++ b/sample/https-client.c
@@ -20,7 +20,7 @@
#include <stdlib.h>
#include <string.h>
#include <errno.h>
-
+#include <time.h>
#ifdef _WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
@@ -334,7 +334,9 @@ main(int argc, char **argv)
#endif // not _WIN32
// Create event base
- base = event_base_new();
+ struct event_config *evcfg = event_config_new();
+ event_config_set_flag(evcfg,EVENT_BASE_FLAG_EPOLL_USE_CHANGELIST);
+ base = event_base_new_with_config(evcfg);
if (!base) {
perror("event_base_new()");
return 1;
@@ -373,6 +375,16 @@ main(int argc, char **argv)
return 1;
}
+
+
+ struct timeval retry_timeout;
+ retry_timeout.tv_sec=5;
+ retry_timeout.tv_usec=0;
+ evhttp_connection_set_timeout(evcon,15);
+ evhttp_connection_set_retries(evcon,3);
+ evhttp_connection_set_initial_retry_tv(evcon,&retry_timeout);
+
+
// Fire off the request
req = evhttp_request_new(http_request_done, bev);
if (req == NULL) {
@@ -414,7 +426,7 @@ main(int argc, char **argv)
}
event_base_dispatch(base);
-
+
evhttp_connection_free(evcon);
event_base_free(base);
Â
Â
Output:
some request failed - no idea which one though!
socket error = Bad file descriptor (9)
[warn] Epoll ADD(5) on fd 6 failed. Old events were 0; read change was 1 (add); write change was 1 (add); close change was 0 (none): Bad file descriptor
[err] http.c:691: Assertion req != NULL failed in evhttp_connection_fail_
zsh: abort (core dumped) ./https-client -url https://libevent.org
I'm using the latest checkout (master). My system is linux x86_64 3.16.3. I compile with gcc 4.9.1
Gesendet:ÂFreitag, 19. September 2014 um 14:40 Uhr
Von:Âgerkenjohannes@xxxxxx
An:Âlibevent-users@xxxxxxxxxxxxx
Betreff:ÂRe: Re: [Libevent-users] Assert fail in evhttp_connection_fail_ with req=0x00 on error=EVREQ_HTTP_TIMEOUT at http.c:691
I'm using the "master" from github.
The problem only occurs, when I set a timeout/retry for an https connection(to an server with port 443 closed). The segfault/assert-fail occurs, if I use EVENT_BASE_FLAG_EPOLL_USE_CHANGELIST in combination with the timeouts/retrys.
Testcase:
add the following to sample/https-client.c
struct timeval retry_timeout;
retry_timeout.tv_sec=5;
retry_timeout.tv_usec=0;
evhttp_connection_set_timeout(evcon,15);
evhttp_connection_set_retries(evcon,3);
evhttp_connection_set_initial_retry_tv(evcon,&retry_timeout);
execute: https_client -url https://libevent.org
output:
[warn] Epoll ADD(1) on fd 6 failed. Old events were 0; read change was 1 (add); write change was 0 (none); close change was 0 (none): Bad file descriptor
[debug] event_add: event: 0x25a5b30 (fd 6), EV_WRITE EV_TIMEOUT call 0x7f1942897ae4
[warn] Epoll ADD(4) on fd 6 failed. Old events were 0; read change was 0 (none); write change was 1 (add); close change was 0 (none): Bad file descriptor
[debug] event_process_active: event_callback 0x25a5c40, closure 3, call 0x7f1941fc8879
some request failed - no idea which one though!
socket error = Bad file descriptor (9)
Â
Gesendet:ÂDonnerstag, 04. September 2014 um 09:44 Uhr
Von:Â"Azat Khuzhin" <a3at.mail@xxxxxxxxx>
An:Âlibevent-users@xxxxxxxxxxxxx
Cc:Âlibevent-users@xxxxxxxx
Betreff:ÂRe: [Libevent-users] Assert fail in evhttp_connection_fail_ with req=0x00 on error=EVREQ_HTTP_TIMEOUT at http.c:691
On Fri, Aug 29, 2014 at 06:30:26PM +0200, gerkenjohannes@xxxxxx wrote:
> Hi,
>
> when I add new evhttp requests to an running event_loop, I get "epoll ADD: Bad file descriptor" and later "SIGABRT".
> The event_base is running in an seperate worker thread, the main thread is doing the evhttp_make_request.
>
> Output from GDB:
> http://paste.ubuntu.com/8176676/[http://paste.ubuntu.com/8176676/][http://paste.ubuntu.com/8176676/[http://paste.ubuntu.com/8176676/]]
>
> Output from GDB with libevent debugging on:
> http://paste.ubuntu.com/8176681/[http://paste.ubuntu.com/8176681/][http://paste.ubuntu.com/8176681/[http://paste.ubuntu.com/8176681/]]
>
> I get the assert fail in the folowing 2 cases:
>
> case 1:
> 1. add new requests to the running event_base
>
> case 2:
> 1. call loop_brake from the main thread
> 2. wait for the loop to "brake" in the worker thread
> 3. put the worker thread to sleep
> 4. add new requests
> 5. wake up the worker thread
> 6. run the event_loop
>
> Is this bug in libevent or my code?
Which version of libevent do you have?
Could you produce simple program or regress test for http (inside
libevent), to test it?
>
> Best regards,
> ***********************************************************************
> To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
> unsubscribe libevent-users in the body.
--
Respectfully
Azat Khuzhin
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users in the body.
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users in the body.
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users in the body.