Bug #71401
closedChanging the value of ms_async_op_threads in mon config db does not apply to OSD successfully even after a restart
0%
Description
This impact ceph daemons running in foreground mode(adding -f option), unfortunately, running in foreground has been the default for years. We should fix it.
This is very easy to reproduce, take ceph-osd as an example:
1. Ensure the ceph-osd is running with option -f (As far as I know, it's the default for upstream ceph and ubuntu ceph package)
e.g. /usr/bin/ceph-osd -f --cluster ceph --id 2 --setuser ceph --setgroup ceph
2. ceph config set osd ms_async_op_threads 5
3. Restart ceph-osd
4. You will see ms_async_op_threads is upadated to 5 from both the config db dump and the config show of osd's admin socket command
5. However, if you check the actual number of messenger threads with command: pgrep ceph-osd | xargs -i pstree -altp {} | grep -e 'ceph-osd,' -e msgr-worker
ceph-osd,1381 -f --cluster ceph --id 2 --setuser ceph --setgroup ceph
|-{msgr-worker-0},1429
|-{msgr-worker-1},1430
|-{msgr-worker-2},1431
You'll find the actual async messenger thread number remains the original value 3, but the expected number of threads is 5.
I did some investigation, and the reason is as below:
During the initialization, OSD needs to create a temporary messenger to read config db from the ceph-mon.
This temporary messenger will need to create async messenger threads according to the local/default value of "ms_async_op_threads" .
If this option is not specified in ceph.conf, it will by default create 3 threads, then use these threads to read config db from ceph-mon.
Those threads are associated to a stack singletion object.
Now here is the difference between OSD running in foreground and background:
a. In background mode, this singleton object will be dropped before forking the child process in function notify_pre_fork,
then the new ms_async_op_threads fetched from mon config db will be used to create later messenger threads, this is what we want.
b. In foreground mode, this singleton object will not be dropped and will be reused by all later messengers,
thus the number of threads doesn't change.
I propose a fix to drop the singleton object that was meant to be temporary for foreground ceph daemons.
DT Updated by dongdong tao over 1 year ago
RZ Updated by Radoslaw Zarzynski over 1 year ago
Reviewed.
RZ Updated by Radoslaw Zarzynski over 1 year ago
- Status changed from New to Fix Under Review
- Pull request ID set to 63390
LF Updated by Laura Flores over 1 year ago
Fix still under review.
DT Updated by dongdong tao over 1 year ago
PR is still awaiting review — @Radoslaw Zarzynski @Laura Flores, could you please take another look?
RZ Updated by Radoslaw Zarzynski about 1 year ago
Review-in-progress. I will take another look.
LF Updated by Laura Flores about 1 year ago
Bump up @Radoslaw Zarzynski
RZ Updated by Radoslaw Zarzynski about 1 year ago
Bump up.
LF Updated by Laura Flores about 1 year ago
Review in progress.
RZ Updated by Radoslaw Zarzynski about 1 year ago
Bump up/
LF Updated by Laura Flores about 1 year ago
Bump up
RZ Updated by Radoslaw Zarzynski about 1 year ago
Sent to QA.
RZ Updated by Radoslaw Zarzynski about 1 year ago
scrub note: awaits QA.
LF Updated by Laura Flores about 1 year ago
- Assignee set to dongdong tao
RZ Updated by Radoslaw Zarzynski about 1 year ago
scrub note: picked up by QA.
UB Updated by Upkeep Bot about 1 year ago
- Status changed from Fix Under Review to Resolved
- Merge Commit set to 3ed04b63533532d05b290e68f46459d75ddacd6f
- Fixed In set to v20.3.0-4261-g3ed04b6353
- Upkeep Timestamp set to 2025-11-20T03:26:07+00:00
DT Updated by dongdong tao about 1 year ago
- Backport set to tentacle, squid
SK Updated by Srinivasa Bharath Kanta 11 months ago
- Status changed from Resolved to Pending Backport
UB Updated by Upkeep Bot 11 months ago
- Copied to Backport #74351: tentacle: Changing the value of ms_async_op_threads in mon config db does not apply to OSD successfully even after a restart added
UB Updated by Upkeep Bot 11 months ago
- Copied to Backport #74352: squid: Changing the value of ms_async_op_threads in mon config db does not apply to OSD successfully even after a restart added
UB Updated by Upkeep Bot 11 months ago
- Tags (freeform) set to backport_processed
UB Updated by Upkeep Bot 3 months ago
- Status changed from Pending Backport to Backporting
- Tags (freeform) deleted (
backport_processed) - Upkeep Timestamp changed from 2025-11-20T03:26:07+00:00 to 2026-08-27T18:23:17+00:00
UB Updated by Upkeep Bot about 1 month ago
- Released In set to v21.2.0~1658
- Upkeep Timestamp changed from 2026-08-27T18:23:17+00:00 to 2026-10-24T01:13:03+00:00
UB Updated by Upkeep Bot 30 days ago
- Released In changed from v21.2.0~1658 to v21.2.0~1659
- Upkeep Timestamp changed from 2026-10-24T01:13:03+00:00 to 2026-11-04T01:07:33+00:00