Nick Mathewson
2e2d18bcd3
Merge pull request #170 from azat/https-client-retries
...
https-client: add -retries argument, for connection retries
2014-10-09 11:29:17 -04:00
Nick Mathewson
163df09b2c
Merge pull request #108 from JoakimSoderberg/minor_issues
...
Fix compilation for older OpenSSL versions.
2014-10-09 10:42:20 -04:00
Nick Mathewson
0fb71c35dc
Merge remote-tracking branch 'origin/patches-2.0'
2014-10-09 10:14:30 -04:00
Nick Mathewson
be1aeff21a
Fix a typo in a doxygen comment. Reported by 亦得.
2014-10-09 10:14:12 -04:00
Azat Khuzhin
bc79cc5c80
http: reset connection before installing retry timer (fix http retries handling)
...
This will fix some invalid read/write:
==556== Invalid read of size 8
==556== at 0x4E4EEC6: event_queue_remove_timeout (minheap-internal.h:178)
==556== by 0x4E508AA: event_del_nolock_ (event.c:2764)
==556== by 0x4E53535: event_base_loop (event.c:3088)
==556== by 0x406FCFA: dispatch (libcrawl.c:271)
==556== by 0x402863: main (crawler.c:49)
==556== Address 0x68a3f18 is 152 bytes inside a block of size 400 free'd
==556== at 0x4C29C97: free (in /usr/local/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==556== by 0x406F140: renew (libcrawl.c:625)
==556== by 0x4E6CDE9: evhttp_connection_cb_cleanup (http.c:1331)
==556== by 0x4E6E2B2: evhttp_connection_cb (http.c:1424)
==556== by 0x4E4DF2D: bufferevent_writecb (bufferevent_sock.c:310)
==556== by 0x4E52D1D: event_process_active_single_queue (event.c:1584)
==556== by 0x4E53676: event_base_loop (event.c:1676)
==556== by 0x406FCFA: dispatch (libcrawl.c:271)
==556== by 0x402863: main (crawler.c:49)
But this one because of some invalid write before (I guess).
It is 100% reproduced during massive crawling (because this process
has many different servers), but after spending some time for trying to
reproduce this using some simple tests/utils I gave up for a few days (I
have a lot of work to do), but I'm sending this patch as a reminder.
Just in case, I've tried next tests:
- mixing timeouts/retries
- shutdown http server and return it back
- slow dns server for first request
- sleep before accept
- hacking libevent sources to change the behaviour of http layer (so it
will go into that function which I'm insterested in).
2014-09-30 18:48:15 +04:00
Azat Khuzhin
97c750d660
evdns: fail ns after we are failing/retrasmitting request
...
In case we are failing request (evdns_request_timeout_callback()), we
delete timeout_event in request_finished(), while just before calling
request_finished() (for failing request) there was a call to
nameserver_failed(), that add event for timeout_event, IOW we must fail
ns after request because otherwise we will not have timeout_event
actived, and we will waiting forever.
Before this patch the dns/retry_disable_when_inactive will wait forever,
after - OK.
2014-09-30 01:40:44 +04:00
Azat Khuzhin
3ca9d43d32
evdns: add retry/reissue tests for EVDNS_BASE_DISABLE_WHEN_INACTIVE
2014-09-30 01:39:51 +04:00
Azat Khuzhin
74d0eee89b
evdns: fix EVDNS_BASE_DISABLE_WHEN_INACTIVE in case retransmit/retry
2014-09-30 01:39:51 +04:00
Joakim Soderberg
5c7282f7a5
Fix compilation for older OpenSSL versions.
...
For instance OpenSSL 0.9.7 does not have SSL_set_tlsext_host_name.
Also add the missing EVENT__DISABLE_SAMPLES CMake option.
2014-09-24 13:46:09 +02:00
Azat Khuzhin
3da84c2949
bufferevent_openssl: reset fd_is_set when setfd with -1 is called
...
Otherwise we will use old fd after close(2) called on it:
(Traces trimmed, to minimize it)
$ strace -keclose,open,socket,epoll_ctl https-client -url https://libevent.org
socket(PF_INET, SOCK_STREAM|SOCK_NONBLOCK, IPPROTO_IP) = 5
> /lib/x86_64-linux-gnu/libc-2.19.so(socket+0x7) [0xe6da7]
> /usr/lib/libevent-2.1.so.4.0.0(evutil_socket_+0x25) [0x27835]
> /usr/lib/libevent-2.1.so.4.0.0(bufferevent_socket_connect+0xe9) [0x1b1a9]
> /usr/lib/libevent-2.1.so.4.0.0(bufferevent_socket_connect+0x21f) [0x1b2df]
> /usr/lib/libevent-2.1.so.4.0.0(evutil_getaddrinfo_async_+0x65) [0x271a5]
> /usr/lib/libevent-2.1.so.4.0.0(bufferevent_socket_connect_hostname+0x106) [0x1b416]
> /usr/lib/libevent-2.1.so.4.0.0(evhttp_connection_connect_+0xe7) [0x39f07]
> /usr/lib/libevent-2.1.so.4.0.0(evhttp_make_request+0xb8) [0x3a218]
epoll_ctl(3, EPOLL_CTL_ADD, 5, {EPOLLIN, {u32=5, u64=5}}) = 0
> ...
> /usr/lib/libevent_openssl-2.1.so.4.0.0(_init+0xfdd) [0x2ced]
> /usr/lib/libevent-2.1.so.4.0.0(bufferevent_setfd+0x3b) [0x16d9b]
> /usr/lib/libevent-2.1.so.4.0.0(bufferevent_socket_connect+0x75) [0x1b135]
> /usr/lib/libevent-2.1.so.4.0.0(bufferevent_socket_connect+0x21f) [0x1b2df]
> /usr/lib/libevent-2.1.so.4.0.0(evutil_getaddrinfo_async_+0x65) [0x271a5]
> /usr/lib/libevent-2.1.so.4.0.0(bufferevent_socket_connect_hostname+0x106) [0x1b416]
> /usr/lib/libevent-2.1.so.4.0.0(evhttp_connection_connect_+0xe7) [0x39f07]
> /usr/lib/libevent-2.1.so.4.0.0(evhttp_make_request+0xb8) [0x3a218]
epoll_ctl(3, EPOLL_CTL_MOD, 5, {EPOLLIN|EPOLLOUT, {u32=5, u64=5}}) = 0
> ...
> /usr/lib/libevent_openssl-2.1.so.4.0.0(_init+0xfee) [0x2cfe]
> /usr/lib/libevent-2.1.so.4.0.0(bufferevent_setfd+0x3b) [0x16d9b]
> /usr/lib/libevent-2.1.so.4.0.0(bufferevent_socket_connect+0x75) [0x1b135]
> /usr/lib/libevent-2.1.so.4.0.0(bufferevent_socket_connect+0x21f) [0x1b2df]
> /usr/lib/libevent-2.1.so.4.0.0(evutil_getaddrinfo_async_+0x65) [0x271a5]
> /usr/lib/libevent-2.1.so.4.0.0(bufferevent_socket_connect_hostname+0x106) [0x1b416]
> /usr/lib/libevent-2.1.so.4.0.0(evhttp_connection_connect_+0xe7) [0x39f07]
> /usr/lib/libevent-2.1.so.4.0.0(evhttp_make_request+0xb8) [0x3a218]
epoll_ctl(3, EPOLL_CTL_MOD, 5, {EPOLLOUT, {u32=5, u64=5}}) = 0
> ...
> /usr/lib/libevent_openssl-2.1.so.4.0.0(_init+0xbbc) [0x28cc]
> /usr/lib/libevent_openssl-2.1.so.4.0.0(_init+0xd96) [0x2aa6]
> /usr/lib/libevent_openssl-2.1.so.4.0.0(_init+0xeb8) [0x2bc8]
> /usr/lib/libevent-2.1.so.4.0.0(event_free+0x3fe) [0x1fd1e]
> /usr/lib/libevent-2.1.so.4.0.0(event_base_loop+0x407) [0x20677]
epoll_ctl(3, EPOLL_CTL_DEL, 5, 7fffa1f841e0) = 0
> ...
> /usr/lib/libevent_openssl-2.1.so.4.0.0(_init+0xbc4) [0x28d4]
> /usr/lib/libevent_openssl-2.1.so.4.0.0(_init+0xd96) [0x2aa6]
> /usr/lib/libevent_openssl-2.1.so.4.0.0(_init+0xeb8) [0x2bc8]
> /usr/lib/libevent-2.1.so.4.0.0(event_free+0x3fe) [0x1fd1e]
> /usr/lib/libevent-2.1.so.4.0.0(event_base_loop+0x407) [0x20677]
close(5) = 0
> /lib/x86_64-linux-gnu/libpthread-2.19.so(__close_nocancel+0x7) [0xeb20]
> /usr/lib/libevent-2.1.so.4.0.0(evhttp_connection_reset_+0x55) [0x373f5]
> /usr/lib/libevent-2.1.so.4.0.0(evhttp_connection_connect_+0x1d) [0x39e3d]
> /usr/lib/libevent-2.1.so.4.0.0(event_free+0x3fe) [0x1fd1e]
> /usr/lib/libevent-2.1.so.4.0.0(event_base_loop+0x407) [0x20677]
epoll_ctl(3, EPOLL_CTL_ADD, 5, {EPOLLIN, {u32=5, u64=5}}) = -1 EBADF (Bad file descriptor)
) = -1 EBADF (Bad file descriptor)
/src/oss/strace-code/strace: Can't initiate libunwind: No such process
> ...
> /usr/lib/libevent_openssl-2.1.so.4.0.0(_init+0xfdd) [0x2ced]
> /usr/lib/libevent-2.1.so.4.0.0(bufferevent_setfd+0x3b) [0x16d9b]
> /usr/lib/libevent-2.1.so.4.0.0(evhttp_connection_connect_+0x14c) [0x39f6c]
> /usr/lib/libevent-2.1.so.4.0.0(event_free+0x3fe) [0x1fd1e]
> /usr/lib/libevent-2.1.so.4.0.0(event_base_loop+0x407) [0x20677]
/src/oss/strace-code/strace: Exit of unknown pid 28185 seen
[warn] Epoll ADD(1) on fd 5 failed. Old events were 0; read change was 1 (add); write change was 0 (none); close change was 0 (none): Bad file descriptor
epoll_ctl(3, EPOLL_CTL_ADD, 5, {EPOLLOUT, {u32=5, u64=5}}) = -1 EBADF (Bad file descriptor)
) = -1 EBADF (Bad file descriptor)
/src/oss/strace-code/strace: Can't initiate libunwind: No such process
> ...
> /usr/lib/libevent_openssl-2.1.so.4.0.0(_init+0xfee) [0x2cfe]
> /usr/lib/libevent-2.1.so.4.0.0(bufferevent_setfd+0x3b) [0x16d9b]
> /usr/lib/libevent-2.1.so.4.0.0(evhttp_connection_connect_+0x14c) [0x39f6c]
> /usr/lib/libevent-2.1.so.4.0.0(event_free+0x3fe) [0x1fd1e]
> /usr/lib/libevent-2.1.so.4.0.0(event_base_loop+0x407) [0x20677]
/src/oss/strace-code/strace: Exit of unknown pid 28186 seen
[warn] Epoll ADD(4) on fd 5 failed. Old events were 0; read change was 0 (none); write change was 1 (add); close change was 0 (none): Bad file descriptor
<getaddrinfo traces trimmed>
close(5) = -1 EBADF (Bad file descriptor)
) = -1 EBADF (Bad file descriptor)
/src/oss/strace-code/strace: Can't initiate libunwind: No such process
> /lib/x86_64-linux-gnu/libpthread-2.19.so(__close_nocancel+0x7) [0xeb20]
> /usr/lib/libevent-2.1.so.4.0.0(evhttp_connection_reset_+0x55) [0x373f5]
> /usr/lib/libevent-2.1.so.4.0.0(evhttp_connection_fail_+0xc1) [0x3aed1]
> /usr/lib/libevent-2.1.so.4.0.0(evhttp_connection_fail_+0x4a3) [0x3b2b3]
> /usr/lib/libevent-2.1.so.4.0.0(bufferevent_enable+0x192) [0x16722]
> /usr/lib/libevent-2.1.so.4.0.0(event_free+0x5df) [0x1feff]
> /usr/lib/libevent-2.1.so.4.0.0(event_base_loop+0x407) [0x20677]
/src/oss/strace-code/strace: Exit of unknown pid 28187 seen
some request failed - no idea which one though!
socket error = Bad file descriptor (9)
Before this patch:
$ sample/https-client -retries 1 -url https://libevent.org
[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
[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
some request failed - no idea which one though!
socket error = Bad file descriptor (9)
After this patch:
$ sample/https-client -retries 1 -url https://libevent.org
Response line: 0 (null)
Reported-by: gerkenjohannes@web.de
2014-09-21 23:48:32 +04:00
Azat Khuzhin
d9da844369
https-client: add -retries argument, for connection retries
...
Using evhttp_connection_set_retries() API.
2014-09-21 23:48:07 +04:00
Nick Mathewson
07b5e45ba5
Merge remote-tracking branch 'origin/patches-2.0'
2014-09-18 15:08:57 -04:00
ufo2243
b34e4ac3a4
[Bugfix] fix bufferevent setwatermark suspend_read
2014-09-18 15:07:41 -04:00
Nick Mathewson
89c1a3b7fe
Fix several memory leaks in the unit tests.
...
Also add a comment to buffer.c about why we call
evbuffer_file_segment_free on failure to add the segment.
2014-09-18 12:40:38 -04:00
Nick Mathewson
364c110687
Fix for a677b72bd6d9d378daf9775966aa8ca574e26e67
2014-09-18 12:12:36 -04:00
Nick Mathewson
fb57b8badc
Make a buffer larger in the tests to avoid a scary evbuffer_copyout_from()
...
The call was safe, but coverity couldn't tell. CID 1239294.
2014-09-18 12:08:50 -04:00
Nick Mathewson
ca5b5c7d86
Use a more precise calculation for max in time-ratelim.c
...
CID 1239297
2014-09-18 12:04:16 -04:00
Nick Mathewson
a677b72bd6
Use evutil_weakrand() in unit tests.
...
(Coverity doesn't like random() or rand(). We don't care; this is
for unit tests.)
Fixes CID 1239298, 1239296, 1239295, 1239293.
2014-09-18 12:02:13 -04:00
Nick Mathewson
76643dd0e7
Fix a c90 warning
2014-09-18 11:54:39 -04:00
Nick Mathewson
c119f2416c
Fix a dead-code warning in unit tests. CID 1193548
2014-09-18 11:54:04 -04:00
Nick Mathewson
37390574b0
Fix a use-after-free in unit tests. CID 752027
2014-09-18 11:52:16 -04:00
Nick Mathewson
c243dbf4c8
Merge pull request #168 from ufo2243/master
...
make bufferevent_getwatermark api more robust
2014-09-18 11:44:11 -04:00
Nick Mathewson
c8c7fa3a16
Merge pull request #119 from ldx/winhosts
...
Fix hosts file use on Windows.
2014-09-18 11:41:18 -04:00
John Ohl
3cc0eace2e
Fix use-after-free error in EV_CLOSURE_EVENT callback
2014-09-18 11:37:28 -04:00
Nick Mathewson
35f107de92
Merge remote-tracking branch 'origin/patches-2.0'
2014-09-18 11:36:08 -04:00
Maks Naumov
79800df7c7
regress_buffer: fix 'memcmp' compare size
2014-09-18 11:33:20 -04:00
Nick Mathewson
73615a3723
Merge pull request #118 from azat/http-forward-family-to-bufferevent
...
Add evhttp_connection_set_family() to set addrinfo->family for DNS requests
2014-09-18 11:31:52 -04:00
Nick Mathewson
08c88ea563
use correct tt macro for pointer compare
2014-09-18 11:28:19 -04:00
Nick Mathewson
afce2721c2
Merge pull request #128 from azat/tests-disable-when-inactive-v5
...
Some tests for EVDNS_BASE_DISABLE_WHEN_INACTIVE flag
2014-09-18 11:25:27 -04:00
Nick Mathewson
a7d5dabf96
Merge pull request #129 from azat/disable-probing-with-disable-when-inactive-v2
...
evdns: disable probing with EVDNS_BASE_DISABLE_WHEN_INACTIVE
2014-09-18 11:24:56 -04:00
ufo2243
a21e5108c2
make bufferevent_getwatermark api more robust
2014-09-12 11:51:59 +08:00
Nick Mathewson
56ad623737
Merge pull request #167 from snikulov/pr_libevent_cmake_upd
...
updates in cmake build
2014-09-08 15:37:31 -04:00
Nick Mathewson
80347e6c93
Merge pull request #103 from ufo2243/master
...
[Bugfix] fix grammer error
2014-09-03 09:29:59 -04:00
ufo2243
3a4d249c9d
[Bugfix] fix grammer error
2014-09-03 10:55:27 +08:00
Sergey Nikulov
27bd9faf49
updates in cmake build
2014-09-02 18:25:52 +04:00
Nick Mathewson
6a53d15383
Correctly handle allocation failures in evdns_getaddrinfo
...
Kuldeep Gupta appears to have used some kind of automated tool to
find this and generate a patch for half the issue as #149 .
2014-08-29 15:26:56 -04:00
Nick Mathewson
9d6acdc551
Merge remote-tracking branch 'origin/patches-2.0'
2014-08-29 15:00:33 -04:00
Nick Mathewson
60f8f729d3
Consistently check for failure from evbuffer_pullup()
...
Closes issue #148 .
2014-08-29 14:59:17 -04:00
Nick Mathewson
9f3a8acfa8
Merge pull request #153 from azat/tests-simplestsignal
...
test/regress: add simplestsignal: to track reorder bugs separately
2014-08-29 14:38:09 -04:00
Nick Mathewson
8bf769c47a
Merge remote-tracking branch 'origin/patches-2.0'
...
Conflicts:
sample/http-server.c
2014-08-29 14:32:10 -04:00
Nick Mathewson
6466e88ac1
Use FindClose for handle from FindFirstFile in http-server.c
...
Noted by Miles Chan as issue #145
2014-08-29 14:31:07 -04:00
Nick Mathewson
f691389e82
Change return type of evutil_load_windows_system_library_ to HMODULE
...
Noted by Miles Chan as issue #146
2014-08-29 14:28:09 -04:00
John Ohl
2c82aa0fef
Fix issue #127 , double free for filterevents that use BEV_OPT_CLOSE_ON_FREE
2014-08-29 12:43:00 -04:00
Nick Mathewson
571295bdf8
Merge remote-tracking branch 'origin/patches-2.0'
2014-08-18 10:14:29 -04:00
Pierre Phaneuf
1a8295a316
Add a few files created by "make verify" to .gitignore.
2014-08-18 10:13:52 -04:00
Azat Khuzhin
b897beff6a
test/regress: add simplestsignal: to track reorder bugs separately
2014-06-29 17:39:33 +04:00
Nick Mathewson
6ec949265a
Merge pull request #140 from vapier/ignore
...
ignore config.cache/test-driver files
2014-06-14 23:44:47 -04:00
Nick Mathewson
c6becf2b2c
Merge pull request #143 from vapier/disable-sample
...
add a --disable-samples configure flag
2014-06-14 23:44:18 -04:00
Mike Frysinger
0c492b33f9
add a --disable-samples configure flag
...
For people building & installing libevent in a distro, building all these
sample apps are not useful. Add a flag to turn them off.
2014-06-13 17:19:50 -04:00
Mike Frysinger
c83f3333a3
ignore config.cache/test-driver files
...
config.cache is generated when you run `./configure -C`.
test-driver comes from newer autotools.
2014-06-13 17:19:24 -04:00