Skip to content
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

[[thread_pool]] has bug #82

Open
lys861205 opened this issue Jul 19, 2023 · 1 comment
Open

[[thread_pool]] has bug #82

lys861205 opened this issue Jul 19, 2023 · 1 comment

Comments

@lys861205
Copy link

lys861205 commented Jul 19, 2023

const auto thread_pools_map = setup_thread_pools(config); // set up loggers, setting the respective sinks and patterns setup_loggers(config, sinks_map, patterns_map, thread_pools_map);

thread_pools_map has contain std::shared_ptr, out of scope, thread_pool will be released, but logger still in use;logger has a thread_pool variable, the thread_pool variable is std::weak_ptr, that do not own raw ptr.

spdlog define
SPDLOG_INLINE spdlog::async_logger::async_logger( std::string logger_name, sink_ptr single_sink, std::weak_ptr<details::thread_pool> tp, async_overflow_policy overflow_policy) : async_logger(std::move(logger_name), {std::move(single_sink)}, std::move(tp), overflow_policy) {}

logger write log, will throw exception。

"async log: thread pool doesn't exist anymore"

@e190
Copy link

e190 commented Sep 16, 2023

try:
static const auto thread_pools_map = setup_thread_pools(config);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants