mirror of
https://gitlab.com/niansa/libcrosscoro.git
synced 2025-03-06 20:53:32 +01:00
* io_scheduler inline support * add debug info for io_scheduler size issue * move poll info into its own file * cleanup for feature * Fix valgrind introduced use after free with inline processing Running the coroutines inline with event processing caused a use after free bug with valgrind detected in the inline tcp server/client benchmark code. Basically if an event and a timeout occured in the same time period because the inline processing would resume _inline_ with the event or the timeout -- if the timeout and event occured in the same epoll_wait() function call then the second one's coroutine stackframe would already be destroyed upon resuming it so the poll_info->processed check would be reading already free'ed memory. The solution to this was to introduce a vector of coroutine handles which are appended into on each epoll_wait() iteration of events and timeouts, and only then after the events and timeouts are deduplicated are the coroutine handles resumed. This new vector has elided a malloc in the timeout function, but there is still a malloc to extract the poll infos from the timeout multimap data structure. The vector is also on the class member list and is only ever cleared, it is possible with a monster set of timeouts that this vector could grow extremely large, but I think that is worth the price of not re-allocating it.
35 lines
1 KiB
C++
35 lines
1 KiB
C++
#pragma once
|
|
|
|
#include "coro/concepts/awaitable.hpp"
|
|
#include "coro/concepts/buffer.hpp"
|
|
#include "coro/concepts/executor.hpp"
|
|
#include "coro/concepts/promise.hpp"
|
|
#include "coro/concepts/range_of.hpp"
|
|
|
|
#include "coro/net/connect.hpp"
|
|
#include "coro/net/dns_resolver.hpp"
|
|
#include "coro/net/hostname.hpp"
|
|
#include "coro/net/ip_address.hpp"
|
|
#include "coro/net/recv_status.hpp"
|
|
#include "coro/net/send_status.hpp"
|
|
#include "coro/net/socket.hpp"
|
|
#include "coro/net/ssl_context.hpp"
|
|
#include "coro/net/tcp_client.hpp"
|
|
#include "coro/net/tcp_server.hpp"
|
|
#include "coro/net/udp_peer.hpp"
|
|
|
|
#include "coro/event.hpp"
|
|
#include "coro/generator.hpp"
|
|
#include "coro/io_scheduler.hpp"
|
|
#include "coro/latch.hpp"
|
|
#include "coro/mutex.hpp"
|
|
#include "coro/poll.hpp"
|
|
#include "coro/ring_buffer.hpp"
|
|
#include "coro/semaphore.hpp"
|
|
#include "coro/shared_mutex.hpp"
|
|
#include "coro/stop_signal.hpp"
|
|
#include "coro/sync_wait.hpp"
|
|
#include "coro/task.hpp"
|
|
#include "coro/task_container.hpp"
|
|
#include "coro/thread_pool.hpp"
|
|
#include "coro/when_all.hpp"
|