Skip to content

Commit 6d7b8d1

Browse files
committed
bug core: revert "open monitor port early"
The previous PR leads to occasional crashes at service start in `WriteTotalHandlerStatistics`. commit_hash:7e2da29aeb84614282f7640d7cc971fcc862f2c8
1 parent 644c41d commit 6d7b8d1

File tree

4 files changed

+8
-19
lines changed

4 files changed

+8
-19
lines changed

core/functional_tests/early_monitor_port_open/tests/test_boot.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import asyncio
22

33
import aiohttp
4+
import pytest
45

56

7+
@pytest.mark.skip(reason='the feature is not yet enabled')
68
async def test_monitor_port_is_open_before_all_components_are_ready(
79
ensure_daemon_started,
810
service_daemon_scope,

core/include/userver/server/server.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ class Server final : public congestion_control::Limitee, public congestion_contr
5353

5454
const http::HttpRequestHandler& GetHttpRequestHandler(bool is_monitor = false) const;
5555

56-
void StartMonitorPort();
5756
void Start();
5857

5958
void Stop();

core/src/server/component.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@ Server::Server(
4444
statistics_storage.RegisterWriter("http.handler.total", [this](utils::statistics::Writer& writer) {
4545
return server_->WriteTotalHandlerStatistics(writer);
4646
});
47-
48-
server_->StartMonitorPort();
4947
}
5048

5149
Server::~Server() {

core/src/server/server.cpp

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,7 @@ class ServerImpl final {
112112
);
113113
~ServerImpl();
114114

115-
void StartPortInfo();
116-
void StartMonitorPortInfo();
115+
void StartPortInfos();
117116
void Stop();
118117

119118
void AddHandler(const handlers::HttpHandlerBase& handler, engine::TaskProcessor& task_processor);
@@ -179,7 +178,7 @@ ServerImpl::ServerImpl(
179178

180179
ServerImpl::~ServerImpl() { Stop(); }
181180

182-
void ServerImpl::StartPortInfo() {
181+
void ServerImpl::StartPortInfos() {
183182
UASSERT(main_port_info_.request_handler);
184183

185184
if (has_requests_view_watchers_.load()) {
@@ -190,14 +189,12 @@ void ServerImpl::StartPortInfo() {
190189
}
191190

192191
main_port_info_.Start();
193-
194192
main_port_info_.request_handler->DisableAddHandler();
195193
if (monitor_port_info_.request_handler) {
196194
monitor_port_info_.request_handler->DisableAddHandler();
197195
}
198-
}
199196

200-
void ServerImpl::StartMonitorPortInfo() {
197+
// TODO: move to ctr for early start
201198
if (monitor_port_info_.request_handler) {
202199
monitor_port_info_.Start();
203200
} else {
@@ -386,17 +383,10 @@ const http::HttpRequestHandler& Server::GetHttpRequestHandler(bool is_monitor) c
386383
return pimpl_->GetHttpRequestHandler(is_monitor);
387384
}
388385

389-
void Server::StartMonitorPort()
390-
{
391-
LOG_INFO() << "Starting monitor port";
392-
pimpl_->StartMonitorPortInfo();
393-
LOG_INFO() << "Monitor port is started";
394-
}
395-
396386
void Server::Start() {
397-
LOG_INFO() << "Starting server port";
398-
pimpl_->StartPortInfo();
399-
LOG_INFO() << "Server port is started";
387+
LOG_INFO() << "Starting server";
388+
pimpl_->StartPortInfos();
389+
LOG_INFO() << "Server is started";
400390
}
401391

402392
void Server::Stop() { pimpl_->Stop(); }

0 commit comments

Comments
 (0)