Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

placate shutdown logging #260

Merged
merged 2 commits into from
Apr 25, 2024
Merged

placate shutdown logging #260

merged 2 commits into from
Apr 25, 2024

Conversation

dorjesinpo
Copy link
Collaborator

When having 1000's client sessions, shutting down broker can exceed shutdown timeouts and stop the Dispatcher with unfinished work. That causes an assert.
This PR does not address this completely. It increases timeouts and throttles logging. We need to think about better fix, for example:

  1. Remove the assert and discard 'late' work items
    or
  2. Detect the shutdown condition earlier and avoid creating work items for the Dispatcher

@dorjesinpo dorjesinpo added the bug Something isn't working label Apr 22, 2024
@dorjesinpo dorjesinpo requested a review from a team as a code owner April 22, 2024 19:00
@dorjesinpo dorjesinpo requested a review from kaikulimu April 22, 2024 19:55
Copy link
Collaborator

@678098 678098 left a comment

Choose a reason for hiding this comment

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

Hi @dorjesinpo, what do you think about adding [THROTTLED] in every throttled log?

@dorjesinpo
Copy link
Collaborator Author

Hi @dorjesinpo, what do you think about adding [THROTTLED] in every throttled log?

Good idea. Let me put that in a macro...

@dorjesinpo dorjesinpo assigned 678098 and unassigned kaikulimu Apr 25, 2024
Copy link
Collaborator

@678098 678098 left a comment

Choose a reason for hiding this comment

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

Have a few comments


#define LOGTHROTTLE_INFO() \
BALL_LOGTHROTTLE_INFO(k_MAX_INSTANT_MESSAGES, k_NS_PER_MESSAGE) \
<< "[THROTTLED] "
Copy link
Collaborator

@678098 678098 Apr 25, 2024

Choose a reason for hiding this comment

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

I like the idea of this macro being just near these constants

There are 3 things to consider here:

  1. I believe in similar cases we made #undef even in .cpp files, when we define some custom macro, at least for local defines
  2. Might be good to place this macro definition a few lines below, so it will be under the k_NS_PER_MESSAGE constant which it uses
  3. A small concern about LOGTHROTTLE_INFO being a substring of BALL_LOGTHROTTLE_INFO. In general, this macro name does not mention the component where it was defined, so it's a general purpose name which is not very stable when using macros

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Makes sense. Amending

@@ -74,6 +74,10 @@ const bsls::Types::Int64 k_NS_PER_MESSAGE =
bdlt::TimeUnitRatio::k_NANOSECONDS_PER_MINUTE / k_MAX_INSTANT_MESSAGES;
// Time interval between messages logged with throttling.

#define LOGTHROTTLE_INFO() \
BALL_LOGTHROTTLE_INFO(k_MAX_INSTANT_MESSAGES, k_NS_PER_MESSAGE) \
<< "[THROTTLED] "
Copy link
Collaborator

Choose a reason for hiding this comment

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

Overall, what do you thing about defining this macro in one of our helper headers, with an unique prefix?

Do we actually need to make these constants k_MAX_INSTANT_MESSAGES/k_NS_PER_MESSAGE different?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Overall, what do you thing about defining this macro in one of our helper headers, with an unique prefix?

Do we actually need to make these constants k_MAX_INSTANT_MESSAGES/k_NS_PER_MESSAGE different?

No opinion on this. For now, let's not centralize this

@dorjesinpo dorjesinpo force-pushed the fix/placate-shutdown branch from 4f8414a to add724d Compare April 25, 2024 16:36
@dorjesinpo dorjesinpo force-pushed the fix/placate-shutdown branch from add724d to 854aeca Compare April 25, 2024 19:25
@dorjesinpo dorjesinpo merged commit 88bff6f into main Apr 25, 2024
15 checks passed
alexander-e1off pushed a commit to alexander-e1off/blazingmq that referenced this pull request Oct 24, 2024
* placate shutdown logging

Signed-off-by: dorjesinpo <[email protected]>

* Adding [THROTTLED] prefix

Signed-off-by: dorjesinpo <[email protected]>

---------

Signed-off-by: dorjesinpo <[email protected]>
alexander-e1off pushed a commit to alexander-e1off/blazingmq that referenced this pull request Oct 24, 2024
* placate shutdown logging

Signed-off-by: dorjesinpo <[email protected]>

* Adding [THROTTLED] prefix

Signed-off-by: dorjesinpo <[email protected]>

---------

Signed-off-by: dorjesinpo <[email protected]>
alexander-e1off pushed a commit to alexander-e1off/blazingmq that referenced this pull request Oct 24, 2024
* placate shutdown logging

Signed-off-by: dorjesinpo <[email protected]>

* Adding [THROTTLED] prefix

Signed-off-by: dorjesinpo <[email protected]>

---------

Signed-off-by: dorjesinpo <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants