-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
Fix incorrect ThreadPool usage after ThreadPool introspection #48244
Conversation
``` $ gg 'ThreadPool[^()]([A-Za-z_]\+,' src/ src/Interpreters/Context.cpp: shared->load_marks_threadpool = std::make_unique<ThreadPool>(pool_size, pool_size, queue_size); src/Interpreters/Context.cpp: shared->prefetch_threadpool = std::make_unique<ThreadPool>(pool_size, pool_size, queue_size); src/Interpreters/Context.cpp: shared->threadpool_writer = std::make_unique<ThreadPool>(pool_size, pool_size, queue_size); ``` Fixes: ClickHouse#47880 Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
Do we have other incorrect usages? Let's make the compiler find them (it's okay to to in a separate PR) |
Style check is broken in master, so it's impossible to merge anything... |
The problem is that before #47880 there was the following ctor: explicit ThreadPoolImpl(size_t max_threads_); /* 1 */
ThreadPoolImpl(
size_t max_threads_,
size_t max_free_threads_,
size_t queue_size_,
bool shutdown_on_exception_ = true); /* 2 */ After: explicit ThreadPoolImpl(
Metric metric_threads_,
Metric metric_active_threads_,
size_t max_threads_); /* 1 */
ThreadPoolImpl(
Metric metric_threads_,
Metric metric_active_threads_,
size_t max_threads_,
size_t max_free_threads_,
size_t queue_size_,
bool shutdown_on_exception_ = true); /* 2 */ And |
Yep, seems that this helps - https://s3.amazonaws.com/clickhouse-test-reports/0/46e85357ce2da2a99f56ee83a079e892d7ec3726/stress_test__asan_.html |
Yes, I understand the problem. I mean that we can change ctors somehow, so it will be impossible to pass invalid arguments. It's great when the compiler can validate code. For example, we can create a structure like |
@tavplubix yeah, I thought about this, but this will require recompile lots of stuff, so decided to postpone this, anyway here is a PR, that uncovers another, last, bug - #48314 |
Fixes: #47880
Closes: #48234
Changelog category (leave one):