mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-29 19:12:03 +00:00
protect socket timeouts
This commit is contained in:
parent
6e3dccf365
commit
08229390df
@ -366,7 +366,10 @@ void TCPHandler::runImpl()
|
||||
try
|
||||
{
|
||||
/// If a user passed query-local timeouts, reset socket to initial state at the end of the query
|
||||
SCOPE_EXIT({state.timeout_setter.reset();});
|
||||
SCOPE_EXIT({
|
||||
std::scoped_lock lock(in_mutex, out_mutex);
|
||||
state.timeout_setter.reset();
|
||||
});
|
||||
|
||||
/** If Query - process it. If Ping or Cancel - go back to the beginning.
|
||||
* There may come settings for a separate query that modify `query_context`.
|
||||
@ -779,6 +782,8 @@ void TCPHandler::extractConnectionSettingsFromContext(const ContextPtr & context
|
||||
|
||||
bool TCPHandler::readDataNext()
|
||||
{
|
||||
std::scoped_lock lock(in_mutex);
|
||||
|
||||
Stopwatch watch(CLOCK_MONOTONIC_COARSE);
|
||||
|
||||
/// Poll interval should not be greater than receive_timeout
|
||||
|
@ -229,6 +229,9 @@ private:
|
||||
/// `out_mutex` protects `out` (WriteBuffer).
|
||||
/// So it is used for method sendData(), sendProgress(), sendLogs(), etc.
|
||||
std::mutex out_mutex;
|
||||
/// `in_mutex` protects `in` (ReadBuffer)
|
||||
/// Used in readDataNext() and to protect socket timeout settings
|
||||
std::mutex in_mutex;
|
||||
/// `task_callback_mutex` protects tasks callbacks.
|
||||
/// Inside these callbacks we might also change cancellation status,
|
||||
/// so it also protects cancellation status checks.
|
||||
|
Loading…
Reference in New Issue
Block a user