Skip to content

Fix /connections CreatedTime - #3773

Open
bzs1118 wants to merge 1 commit into
apache:masterfrom
bzs1118:fix/connections-created-time-monotonic
Open

bzs1118 wants to merge 1 commit into
apache:masterfrom
bzs1118:fix/connections-created-time-monotonic

Conversation

@bzs1118

@bzs1118 bzs1118 commented Nov 24, 2026

Copy link
Copy Markdown

What problem does this PR solve?

Issue Number: resolve

Problem Summary:
12fb539a switched Socket::_reset_fd_real_us to butil::cpuwide_time_us() (monotonic), but connections_service.cpp still renders it with PrintRealDateTime(), which treats the value as microseconds since the Unix epoch. As a result the CreatedTime column in /connections shows 1970/01/01 + uptime (e.g. 1971/03/11 on a host up for 434 days).

What is changed and the side effects?

Changed:
Convert the monotonic elapsed time back to wall clock before formatting.
Before: 1970/03/07-07:29:54
After: 2026/11/24-16:42:15

Side effects:

  • Performance effects:

  • Breaking backward compatibility:


Check List:

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain, and the change includes a targeted conversion fix with regression coverage for current CreatedTime values.

No open issues 🎉

What changed in this PR

This PR fixes the /connections builtin service so CreatedTime correctly displays wall-clock timestamps after socket reset times switched to a monotonic clock.

Changes:

  • Converts the monotonic socket reset timestamp into a wall-clock timestamp before formatting.
  • Adds regression coverage validating current CreatedTime values in plain-text /connections responses.
File Description
test/​brpc_builtin_service_unittest.cpp Adds regression coverage that validates plain-text /connections output contains a current CreatedTime value.
src/​brpc/​builtin/​connections_service.cpp Converts the monotonic socket reset timestamp into wall-clock time before rendering CreatedTime.

Review effort: Lite

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants