Skip to content

log warning when dropping messages when Artery send queue is full, #23207 - #25594

Closed
patriknw wants to merge 1 commit into
masterfrom
wip-23207-log-artery-dropped-patriknw
Closed

patriknw wants to merge 1 commit into
masterfrom
wip-23207-log-artery-dropped-patriknw

Conversation

@patriknw

Copy link
Copy Markdown
Contributor
  • including high frequency logging filter, once per 10 seconds

This is probably useful in more places.

Refs #23207

…3207

* including high frequency logging filter, once per 10 seconds
@akka-ci akka-ci added validating PR is currently being validated by Jenkins tested PR that was successfully built and tested by Jenkins and removed validating PR is currently being validated by Jenkins labels Sep 11, 2018
@akka-ci

akka-ci commented Sep 11, 2018

Copy link
Copy Markdown

Test PASSed.

@jrudolph jrudolph 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.

The functionality sounds definitely useful.

I find the API and the implementation a bit indirect so that I'm not completely sure that it works correctly in all cases or if we want to accept some edge cases. I haven't thought enough about it to suggest improvements, though.

}
}

def reset(): Unit =

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.

private

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

used from test to avoid waiting for timer to trigger it, the entire class is private[akka]

val d = discarded
val discardInfo =
if (d == 0) ""
else s" ([$d] similar log messages were discarded in last [${within.toMillis} ms])" // first time after a reset

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.

As this is logged only lazily, I guess, the statement is not quite accurate, since the time between reset and getting here again is not counted. Not sure if it is important, but I could imagine that it would get confusing in the edge case where the next message only comes in quite a bit later.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I can keep around a timestamp of when the the first message was discarded.

I was thinking about if I should log the count when the reset happens, but keeping around a previous lazy log statement is not an option and then it would have to be some general message which isn't as useful.

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.

If these aren't shared between different log purposes then the general message could be as useful if a HiFrequencyLogger has an event name e.g. N log messages were dropped for [Dropped Artery Message].

}

def reset(): Unit =
discarded = math.max(0L, count.getAndSet(0) - maxCalls)

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.

Is it really guaranteed, that discarded is already set when the next if (n == 1L) branch is taken? Maybe just setting a volatile flag here would be enough, so that the complete handling code can be in filter?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

in theory that might be possible but the result wouldn't be worse than possibly misreporting the count

in practice reset is only called from the scheduled timer, i.e. not often

don't think I can move it to filter because the count is reset to 0 here

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.

A thread in filter could see count as 0 but not see the discarded value so we could miss logging the discard info some times as d == 0 or we could log the previous discard value which would be confusing.

How about setting discard to 0 in the else of working out discardInfo and scheduling the timer after doing this so we know that it won't (due to some crazy pause) also be touching discard?

val d = discarded
val discardInfo =
if (d == 0) ""
else s" ([$d] similar log messages were discarded in last [${within.toMillis} ms])" // first time after a reset

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.

I guess there is a possibility that one thread is still busy with this branch while another already logged the second message. Probably not to bad but might still be confusing. In any case, might warrant a comment if this is a trade off that we would accept.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Right, but the alternative would be to introduce a lock (synchronized) and that is not something we would want. I don't think it will matter much. They will have very identical log timestamps. Also, the typical usage is probably to have maxCalls = 1 and then it will not happen.

} else {
droppedMessageLogging.filter { discardInfo ⇒
log.warning(
s"Dropping message [{}] from [{}] to [{}] due to quarantined system [{}]$discardInfo",

@jrudolph jrudolph Sep 12, 2018 •

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.

We might be losing the exact point of time here when the log message changes from due to {} to due to quarantined system because of the filter putting all messages into the same bin. Maybe it's not important enough but otherwise it could be confusing.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't think it's important. It was debug logging after all, and we have other important logging of quarantine events.

@akka-ci akka-ci added validating PR is currently being validated by Jenkins needs-attention Indicates a PR validation failure (set by CI infrastructure) and removed tested PR that was successfully built and tested by Jenkins validating PR is currently being validated by Jenkins labels Sep 18, 2018
@akka-ci

akka-ci commented Sep 18, 2018

Copy link
Copy Markdown

Test FAILed.

@patriknw

Copy link
Copy Markdown
Contributor Author

PLS BUILD

@akka-ci akka-ci added validating PR is currently being validated by Jenkins tested PR that was successfully built and tested by Jenkins and removed needs-attention Indicates a PR validation failure (set by CI infrastructure) validating PR is currently being validated by Jenkins labels Oct 17, 2018
@akka-ci

akka-ci commented Oct 17, 2018

Copy link
Copy Markdown

Test PASSed.

@akka-ci akka-ci added validating PR is currently being validated by Jenkins tested PR that was successfully built and tested by Jenkins and removed tested PR that was successfully built and tested by Jenkins validating PR is currently being validated by Jenkins labels Oct 22, 2018
@akka-ci

akka-ci commented Oct 22, 2018

Copy link
Copy Markdown

Test PASSed.

1 similar comment
@akka-ci

akka-ci commented Oct 22, 2018

Copy link
Copy Markdown

Test PASSed.

@akka-ci akka-ci added validating PR is currently being validated by Jenkins needs-attention Indicates a PR validation failure (set by CI infrastructure) and removed tested PR that was successfully built and tested by Jenkins validating PR is currently being validated by Jenkins labels Mar 28, 2019
@akka-ci

akka-ci commented Mar 28, 2019

Copy link
Copy Markdown

Test FAILed.

@chbatey chbatey 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.

👍 to getting this in, would prevent the need for DEBUG logs / OS send queue stats for a tricky thing to DEBUG

@patriknw

patriknw commented Jul 1, 2019

Copy link
Copy Markdown
Contributor Author

Superseded by simplified logging of Dropped in #27160

@patriknw patriknw closed this Jul 1, 2019
@patriknw
patriknw deleted the wip-23207-log-artery-dropped-patriknw branch July 1, 2019 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-attention Indicates a PR validation failure (set by CI infrastructure)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants