Skip to content

Commit e585b4f

Browse files
author
lexeyo
committed
fix core: fixes deadlock detector configuration issues
* Adds deadlock\_detector parameter definition to the static schema. * Replaces `on` and `off` with `enable` and `disable` to prevent implicit conversions to bool during configuration merges. * Fixes incorrect parsing of enable option. commit_hash:a3d39e3a11daab8d2543c09e16980edb9e8760d7
1 parent e56d027 commit e585b4f

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

core/include/userver/components/manager_controller_component.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class Manager;
3737
/// coro_pool.stack_size | size of a single coroutine stack @ref scripts/docs/en/userver/stack.md | 256 * 1024
3838
/// coro_pool.local_cache_size | local coroutine cache size per thread | 32
3939
/// coro_pool.stack_usage_monitor_enabled | whether stack usage is accounted and warnings about too high stack usage are logged @ref scripts/docs/en/userver/stack.md | true
40-
/// coro_pool.deadlock_detector | Coroutines deadlock detector mode. Can slow down the service. One of: off, on, detect-only. | off
40+
/// coro_pool.deadlock_detector | Coroutines deadlock detection mode. `disabled` disables deadlock detection. `enabled` allows deadlock detection alongs with stacktraces collection. `detect-only` allows only deadlock detection. Deadlock detection could slow down the service. | disabled
4141
/// event_thread_pool.threads | number of threads to process low level IO system calls (number of ev loops to start in libev) | 2
4242
/// event_thread_pool.thread_name | set OS thread name to this value | 'event-worker'
4343
/// components | dictionary of "component name": "options" | -

core/src/components/manager_config.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,19 @@ additionalProperties: false
115115
type: boolean
116116
description: stack usage monitor status
117117
defaultDescription: true
118+
deadlock_detector:
119+
type: string
120+
description: |
121+
Coroutines deadlock detection mode.
122+
`disabled` disables deadlock detection.
123+
`enabled` allows deadlock detection alongs with stacktraces collection.
124+
`detect-only` allows only deadlock detection.
125+
Deadlock detection could slow down the service.
126+
defaultDescription: disabled
127+
enum:
128+
- disabled
129+
- enabled
130+
- detect-only
118131
event_thread_pool:
119132
type: object
120133
description: event thread pool options

core/src/engine/deadlock_detector_config.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ namespace engine {
66

77
DeadlockDetector Parse(const yaml_config::YamlConfig& value, formats::parse::To<DeadlockDetector>) {
88
auto str = value.As<std::string>();
9-
if (str == "off") {
9+
if (str == "disabled") {
1010
return DeadlockDetector::kOff;
1111
}
12-
if (str == "on") {
13-
return DeadlockDetector::kOff;
12+
if (str == "enabled") {
13+
return DeadlockDetector::kOn;
1414
}
1515
if (str == "detect-only") {
1616
return DeadlockDetector::kDetectOnly;

0 commit comments

Comments
 (0)