forked from libevent/libevent
-
Notifications
You must be signed in to change notification settings - Fork 64
Update to v2.1.12 #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Even after referenced patch there is still possible recursive callbacks from evbuffer_drain(bev_input), i.e.: wm_transfer() -> evbuffer_drain() -> wm_transfer() inc(ctx->get) But if we will increment ctx->get before drain that we will not add more data to buffer. Refs: 54c6fe3 ("regress_ssl: make ssl/bufferevent_wm_filter more fault-tolerance") CI: https://ci.appveyor.com/project/nmathewson/libevent/build/job/f0rv299i71wnuxdq#L2546 (cherry picked from commit 1fc1c7e)
Some improvements for http-server sample: - getopt - persistent port via -p option - IOCP for win32 via -I - disable buffering - enable debug logging via -v/EVENT_DEBUG_LOGGING_ALL - cleanup (by signal and separate error path on errors) * sample-http-server: s/http-server: graceful cleanup s/http-server: enable debug logging if EVENT_DEBUG_LOGGING_ALL env isset s/http-server: turn off buffering (otherwise do output on win32) s/http-server: add an option to use IOCP s/http-server: add options (for persistent port) Refs: libevent#709 (cherry picked from commit 9a4b8ec)
…/stderr Useful for win32 (cherry picked from commit b2d4fb4)
Done with coccinelle and manual line rewrap: $ cat > BEV_UPCAST.cocci @@ expression field_; expression var; @@ - EVUTIL_UPCAST(var, struct bufferevent_private, field_) + BEV_UPCAST(var) $ spatch --sp-file BEV_UPCASE.cocci --in-place bufferevent*.c > /dev/null (cherry picked from commit 7bcf576)
Although this is not a problem, since bufferevent uses finalizers and will free itself only from the loop (well this is not a problem if you do not play games with various event_base in different threads) it generates questions, so rewrite it in more reliable way. Fixes: libevent#712 (cherry picked from commit 5dc88b3)
* iocp-fixes: regress: test for HTTP/HTTPS with IOCP enabled bev_async: trigger/run only deferred callbacks bev_async: do not initialize timeouts multiple times bev_async: set "ok" on setfd if fd>=0 (like we do during creation) bev_async: ignore ERROR_INVALID_PARAMETER on .setfd for iocp Closes: libevent#709 Refs: nmathewson/Libevent#160 (cherry picked from commit 3d815cf)
(cherry picked from commit 56f3bde)
Refs: libevent#255 (cherry picked from commit 903c6ac)
(cherry picked from commit f8d510f)
We have calls to the next functions but do not check return values, though they can be invalid and it is better to show this somehow. Also do bufferevent_setfd() first and only after it bufferevent_enable()/bufferevent_disable() since: a) it is more natural b) it will avoid extra operations c) it will not fail first bufferevent_enable() (this is the case for buffbufferevent_async at least) In this case we could add more information for issues like libevent#709 (cherry picked from commit b98d32d)
…ailed (cherry picked from commit 57765b2)
* TT_RETRIABLE: Mark a lot of flacky tests with TT_RETRIABLE (for linux/win32 only) regress: introduce TT_RETRIABLE Fixes: libevent#704 (cherry picked from commit 4d2f013)
(cherry picked from commit d705e8c)
Long time ago in [1] cmake build was forced to compile both libraries (SHARED and STATIC), since this is how our autotools build works. [1]: 7182c2f ("cmake: build SHARED and STATIC libraries (like autoconf does)") And there is no way to configure this (and indeed you need to do this for MSVC for example), so let's introduce option for this -- EVENT__LIBRARY_TYPE. Plus now we have INTERFACE libraries, that we can use internally in libevent's cmake rules to avoid strict to _shared/_static variant of the libraries to link with samples/tests (we prefer SHARED over STATIC for linking). Also bump minimal cmake required version to 3.1 by the following reasons: - 3.1 is required for RPATH configuration under APPLE - 3.0 is required for add_library(INTERFACE) (did not found it in 2.8.x documentation) - remove extra conditions (anyway 3.1 was release 4 years ago, so I guess that most of the systems will have it) (cherry picked from commit c9a073e)
MSVC does not support SHARED and STATIC libraries with the same name, so let's just build SHARED libraries by default instead (yes we can add prefix but let's stick with this). The reason for this is that in windows shared libraries requires .lib file too, but this is not static library it is imported library for shared (doh...), for more info [1] and [2]. [1]: https://docs.microsoft.com/en-us/windows/desktop/dlls/dynamic-link-library-creation [2]: https://blogs.msdn.microsoft.com/oldnewthing/20091013-00/?p=16403 And when we build both static library can and will override shared library imported part, let's take a look at event_extra.lib: - before patch [3]: $ less libevent-fail/lib/Debug/event_extra.lib | head ==> use library:contained_file to view a file in the archive rw-rw-rw- 100666/100666 59568 Nov 21 23:55 2018 event_extra_static.dir/Debug/evrpc.obj rw-rw-rw- 100666/100666 252219 Nov 21 23:55 2018 event_extra_static.dir/Debug/evdns.obj rw-rw-rw- 100666/100666 203850 Nov 21 23:55 2018 event_extra_static.dir/Debug/http.obj rw-rw-rw- 100666/100666 25907 Nov 21 23:55 2018 event_extra_static.dir/Debug/event_tagging.obj [3]: https://ci.appveyor.com/project/azat/libevent/builds/20472024/job/t0o93v042jai0dj7 - "after patch" [4] (not after but the same effect): $ less libevent-ok/lib/Debug/event_extra.lib | head ==> use library:contained_file to view a file in the archive --------- 0/0 509 Nov 21 23:38 2018 event_extra.dll ... [4]: https://ci.appveyor.com/project/azat/libevent/builds/20478998/job/ca9k3c76amc4qr76 Refs: libevent#691 (cherry picked from commit 90d80ef)
(cherry picked from commit 1a79fd3)
Could fail from time to time in travis-ci: https://travis-ci.org/libevent/libevent/jobs/458554097#L1702 Follow-up-for: fe5b071 ("Mark a lot of flacky tests with TT_RETRIABLE (for linux/win32 only)") (cherry picked from commit 1d2ef90)
(cherry picked from commit 196e3a7)
This will fix coveralls badge See: https://travis-ci.org/libevent/libevent/jobs/458590276#L1425 (cherry picked from commit 3e6bec7)
Fixes: libevent#726 (cherry picked from commit e5ec52d)
…nection We should not attemp to establishe the connection if there is retry timer active, since otherwise there will be a bug. Imagine next situation: con = evhttp_connection_base_new() evhttp_connection_set_retries(con, 2) req = evhttp_request_new() evhttp_make_request(con, req, ...) # failed during connecting, and timer for 2 second scheduler (retry_ev) Then another request scheduled for this evcon: evhttp_make_request(con, req, ...) # got request from server, # and now it tries to read the response from the server # (req.kind == EVHTTP_RESPONSE) # # but at this point retry_ev scheduled, # and it schedules the connect again, # and after the connect will succeeed, it will pick request with # EVHTTP_RESPONSE for sending and this is completelly wrong and will # fail in evhttp_make_header_response() since there is no # "http_server" for this evcon This was a long standing issue, that I came across few years ago firstly, bad only now I had time to dig into it (but right now it was pretty simple, by limiting amount of CPU for the process and using rr for debug to go back and forth). (cherry picked from commit f3f7aa5)
(cherry picked from commit f33c2ce)
Closes: libevent#736 (cherry-picked) (cherry picked from commit 972da7c)
(cherry picked from commit 51945fd)
Fixes: libevent#737 (cherry picked from commit 246f440)
Closes: libevent#738 (cherry-picked) (cherry picked from commit 28d7221)
UBSAN reports: evbuffer/remove_buffer_with_empty3: ../buffer.c:1443:3: runtime error: null pointer passed as argument 2, which is declared to never be null #0 0x7ffff6cd0410 in evbuffer_pullup ../buffer.c:1443 #1 0x5555556d68b9 in test_evbuffer_remove_buffer_with_empty3 ../test/regress_buffer.c:408 #2 0x5555557b95ee in testcase_run_bare_ ../test/tinytest.c:173 #3 0x5555557ba048 in testcase_run_one ../test/tinytest.c:333 #4 0x5555557bc0f8 in tinytest_main ../test/tinytest.c:527 libevent#5 0x555555787702 in main ../test/regress_main.c:528 libevent#6 0x7ffff606c001 in __libc_start_main (/usr/lib/libc.so.6+0x27001) libevent#7 0x55555569436d in _start (/src/le/libevent/.cmake-debug/bin/regress+0x14036d) (cherry picked from commit a0c642a)
This allows the object methods to be properly inherited and called via `super(..)`, addressing breakage with python 2.x, introduced in cfcc093. Fixes libevent#1042. Signed-off-by: Enji Cooper <yaneurabeya@gmail.com> (cherry picked from commit 46c9ead)
…ers) tinytest uses another way of detecting test failures, it uses pipe between child and parent, and if the test function in child returns OK it writes OK flag into pipe, and reads it in parent. However sanitizers uses atexit handlers to detect leaks, and this will not detect failures in case of exit() will be called from the atexit handlers, fix this by checking status after waitpid(). (cherry picked from commit 6754740)
…oo tricky) And cannot be suppressed with suppressions due to setup routines. (cherry picked from commit 3b13a64)
…backs) (cherry picked from commit cdbb237)
- http/https_filter_basic - http/https_filter_chunk_out (cherry picked from commit ec94a6b)
(cherry picked from commit ff4ec5f)
(cherry picked from commit 0ac3cfc)
With some modifications: - drop coverage - drop doxygen - do not deploy ABI check, only artifacts
(cherry picked from commit 9adc9f1)
(cherry picked from commit ce8be23)
(cherry picked from commit e2f938c)
…x gcc) (cherry picked from commit 7b9ba3b)
(cherry picked from commit 9da1743)
UBSAN reports: test/regress_buffer.c:2360:2: runtime error: null pointer passed as argument 1, which is declared to never be null /usr/include/string.h:140:33: note: nonnull attribute specified here (cherry picked from commit ba19b35)
Some requests may get response (evutil_addrinfo) from gaic_server_cb, in case of cancel_event (10000ms) will not be fast enough. (cherry picked from commit 90bcf2d)
Fixes main/fork under ASAN (LSAN if to be precise) * fix-signal-leak: select: requires reinit (otherwise it leaks signal handlers) poll: requires reinit (otherwise it leaks signal handlers) (cherry picked from commit f6bfa8b)
PR: libevent#1045 * release-2.1.12-stable-pull: Update ChangeLog ci/linux: create dist artifact only if dist archive was built Merge branch 'fix-signal-leak' test: fix leak in dns/getaddrinfo_cancel_stress test: fix UB in evbuffer/empty_reference_prepend_buffer ci: set build type to debug with sanitizers test: really disable bufferevent_pair_release_lock under ASAN (and fix gcc) test-closed: fix leak test-export: adjust libevent version cmake: set rpath for libraries on linux test-export: compatible with all versions of visual studio Bump version to 2.1.12-stable (w/o ABI breakage) ci: run ABI for release-*-pull branches too Purge travis-ci config Purge appveyor config Bump ChangeLog for 2.1.12 Update AUTHORS for 2.1.12 Backport github actions to 2.1 test: add getaddrinfo(AI_ADDRCONFIG) test (off by default) build: remove duplicate -Wredundant-decls test: fix memory leaks for https (add BEV_OPT_CLOSE_ON_FREE) test: "fix" (with a quirk) leak in ssl/bufferevent_wm (w/o defer callbacks) test: disable bufferevent/bufferevent_pair_release_lock under ASAN (too tricky) test: detect test failures if atexit handler calls _exit(!0) (sanitizers) Make all classes Entry, Struct, etc) new-style classes buffer: do not pass NULL to memcpy() from evbuffer_pullup() test: do not pass NULL to memcmp() in evbuffer_datacmp() helper http: fix undefined-shift in EVUTIL_IS*_ helpers Check error code of evhttp_add_header_internal() in evhttp_parse_query_impl() cmake: avoid problems from use of CMAKE_USE_PTHREADS_INIT test/regress_testutils: use inet_addr() remove FindGit.cmake, improve `git describe` command checkpatch.sh: fix clang-format-diff usage checkpatch.sh: fix usage Fix clang-format-diff usage variable redefinition in win32_dispatch test: http/autofree_connection cleanup http: fix EVHTTP_CON_AUTOFREE in case of timeout (and some else) test: cleanup http/autofree_connection test: fix http/autofree_connection evdns: Add additional validation for values of dns options test: Fix test_simpleclose for Windows platform abi-check: abi-monitor 1.10 does not support -make -j8 (1.12 supports though) Add API/ABI checker (using LVC) Update list of cmake files for autotools dist archive Pass --quiet to the event_rcpgen.py (autotools already does this) There is typo in GetAdaptersAddresses windows library. It should be iphlpapi.dll Support EV_CLOSED on linux for poll(2) Fix EV_CLOSED detection/reporting (epoll only) Merge branch 'EV_CLOSED-and-EV_ET-fixes' bufferevent: allow setting priority on socket and openssl type cmake: set a default value for LIBEVENT_STATIC_LINK evutil_time: improve evutil_gettimeofday on Windows bench: Allow backend method selection cmake: missing test-closed binary Merge branch 'event_rpcgen.py-cleanup' cmake: replace CheckFunctionExists with CheckSymbolExists LibeventConfig.cmake: restore CMAKE_FIND_LIBRARY_SUFFIXES and LIBEVENT_STATIC_LINK default cmake: fix getaddrinfo checking error cmake: remove CheckFunctionExistsEx autoconf: fix getaddrinfo checking errors on mingw test-time: do not use deprecated API test-time: enable debug mode if EVENT_DEBUG_LOGGING_ALL env set increase segment refcnt only if evbuffer_add_file_segment() succeeds evdns: fix a crash when evdns_base with waiting requests is freed event_base_once: fix potential null pointer threat test-ratelim: add missing free Do not use shared global structures on CYGWIN test: move thread into realtime class even on EVENT__DISABLE_THREAD_SUPPORT test: fix compilation without thread support (EVENT__DISABLE_THREAD_SUPPORT=ON) test: fix bufferevent/bufferevent_connect_fail_eventcb* under osx/freebsd test: fix dst thread in move_pthread_to_realtime_scheduling_class (osx) test: fix compilation under win32 (rearrange thread_setup() code) test: use THREAD_* wrappers over pthread* in del_notify Merge branch 'osx-clock' cmake: do not print used method (EVENT_SHOW_METHOD) while running tests cmake: run regress test quietly like autotools (makes CI logs cleaner) Merge branch 'http-connect' http: do not assume body for CONNECT Added uninstall target check to cmakelists Fix compilation without OPENSSL_API_COMPAT evutil_time: Implements usleep() using wait funtion on Windows Initialize variable to 0 replace use memset function in sample/hello-world.c cmake: set CMAKE_{RUNTIME,LIBRARY,ARCHIVE}_OUTPUT_DIRECTORY they are not defined cmake: use CMAKE_LIBRARY_OUTPUT_DIRECTORY for the final shared library symlink test-ratelim: calculate timers bias (for slow CPUs) to avoid false-positive mailmap: add name/email aliases for yuangongji (name and email) cmake: test for find_package() cmake: improve package config file Link with iphlpapi only on windows Parse IPv6 scope IDs. Relax bufferevent_connect_hostname_emfile autotools: fails build when need but can not find openssl cmake: eliminate duplicate installation of public headers append to CMAKE_MODULE_PATH Do not use sysctl.h on linux (it had been deprecated) sample/https-client: link crypt32 explicitly when build with mingw-w64 Fix compat with NetBSD >= 10 Avoid transforming base C_FLAGS set deliberately tinytest: support timeout on Windows Merge branch 'upstream/pr/899' (evbuffer_freeze testcase enhancements) evbuffer_add_file: fix freeing of segment in the error path evutil_time: detect and use _gmtime64_s()/_gmtime64() http: rename bind_socket_ai() to create_bind_socket_nonblock() https-client: load certificates from the system cert store on Windows Fix checking return value of the evdns_base_resolv_conf_parse() cmake: fix getrandom() detection arc4random: replace sysctl() with getrandom (on linux) Upgrade autoconf (after upgrading minimum required to 2.67) Revert "Warn if forked from the event loop during event_reinit()" eliminate some C4267 warnings in Windows autotools: attach doxygen target into all target cmake: attach doxygen target into all target Fix memory corruption in EV_CLOSURE_EVENT_FINALIZE with debug enabled test: prevent duplicate event_enable_debug_mode() for TT_ENABLE_DEBUG_MODE test: introduce TT_ENABLE_DEBUG_MODE flag sample/http-server: fix parameter parsing sample/signal-test: fix use of uninitialized variable Fix typos in comments (sample/test/event-internal.h) sample/signal-test: add NULL checks Change the minimum version of automake to 1.13 and autoconf to 2.67 Add Uninstall.cmake.in into dist archive
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.