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

Fix Audit Message Logging Interceptor Race Condition #938

Merged
merged 18 commits into from
Sep 7, 2020
Merged

Fix Audit Message Logging Interceptor Race Condition #938

merged 18 commits into from
Sep 7, 2020

Conversation

mrzzy
Copy link
Collaborator

@mrzzy mrzzy commented Aug 7, 2020

Why we need it:
Under load the GrpcMessageInterceptor will throw IllegalStateException due to a race condition:

  • GrpcMessageInterceptor expects that onMessage(), onHalfClose(), close() are called in that order.
  • Under load this does not hold and we observe that close() is being called before onMessage(), causing the MessageAuditLogEntry to be missing request, causing IllegalStateException when .build() is called.

What this PR does:
Fixes GrpcMessageInterceptor's race condition by allowing closed() to be called before onMessage()

  • defaults message to an empty protobuf if not set by onMessage().

Adds an integration test CoreLoggingIT to verify that Message Audit Logs are produced correctly.

Which issue(s) this PR fixes:

Fixes #

Does this PR introduce a user-facing change?:

NONE

@mrzzy
Copy link
Collaborator Author

mrzzy commented Aug 7, 2020

/test test-end-to-end-redis-cluster

@mrzzy
Copy link
Collaborator Author

mrzzy commented Aug 7, 2020

/test test-end-to-end-batch

@mrzzy
Copy link
Collaborator Author

mrzzy commented Aug 7, 2020

/test test-end-to-end-redis-cluster

@mrzzy
Copy link
Collaborator Author

mrzzy commented Aug 7, 2020

/test test-end-to-end-batch-dataflow

@mrzzy
Copy link
Collaborator Author

mrzzy commented Aug 7, 2020

/test test-end-to-end

@mrzzy mrzzy changed the title WIP: Fix Audit Message Logging Interceptor Race Condition Fix Audit Message Logging Interceptor Race Condition Aug 7, 2020
@mrzzy
Copy link
Collaborator Author

mrzzy commented Aug 7, 2020

/test test-end-to-end-redis-cluster

call =
new SimpleForwardingServerCall<ReqT, RespT>(call) {
@Override
public void sendMessage(RespT message) {
// 2. Track the response & Log entry to audit logger
// Track the response & Log entry to audit logger
super.sendMessage(message);
Copy link
Member

Choose a reason for hiding this comment

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

Should this super.sendMessage(message); not be the last call that is made?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was done to ensure that logging code, as much as possible stays out of the way of the rest of message (ie exceptions in logging code do not disrupt message handling.) Going to try as last call to see if it fixes the concurrency issue.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

From my testing, moving the location of statements does not resolve the issue.

@mrzzy mrzzy changed the title Fix Audit Message Logging Interceptor Race Condition WIP: Fix Audit Message Logging Interceptor Race Condition Aug 17, 2020
@mrzzy
Copy link
Collaborator Author

mrzzy commented Aug 20, 2020

/test test-end-to-end-batch-dataflow

@mrzzy mrzzy changed the title WIP: Fix Audit Message Logging Interceptor Race Condition Fix Audit Message Logging Interceptor Race Condition Aug 27, 2020
@feast-ci-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mrzzy, woop

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@woop
Copy link
Member

woop commented Sep 6, 2020

/lgtm

@mrzzy
Copy link
Collaborator Author

mrzzy commented Sep 7, 2020

/test test-end-to-end-redis-cluster

@feast-ci-bot feast-ci-bot merged commit e1f6ab7 into feast-dev:master Sep 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants