Skip to content

Fix Audit Message Logging Interceptor Race Condition - #938

Merged
feast-ci-bot merged 18 commits into
feast-dev:masterfrom
mrzzy:fix-logging-interceptor-race-condition
Sep 7, 2020
Merged

Fix Audit Message Logging Interceptor Race Condition#938
feast-ci-bot merged 18 commits into
feast-dev:masterfrom
mrzzy:fix-logging-interceptor-race-condition

Conversation

@mrzzy

@mrzzy mrzzy commented Aug 7, 2020

Copy link
Copy Markdown
Collaborator

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

mrzzy commented Aug 7, 2020

Copy link
Copy Markdown
Collaborator Author

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

@mrzzy

mrzzy commented Aug 7, 2020

Copy link
Copy Markdown
Collaborator Author

/test test-end-to-end-batch

@mrzzy

mrzzy commented Aug 7, 2020

Copy link
Copy Markdown
Collaborator Author

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

@mrzzy

mrzzy commented Aug 7, 2020

Copy link
Copy Markdown
Collaborator Author

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

@mrzzy

mrzzy commented Aug 7, 2020

Copy link
Copy Markdown
Collaborator Author

/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

mrzzy commented Aug 7, 2020

Copy link
Copy Markdown
Collaborator Author

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

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

mrzzy commented Aug 20, 2020

Copy link
Copy Markdown
Collaborator Author

/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
Comment thread core/src/test/java/feast/core/logging/CoreLoggingIT.java Outdated
Comment thread core/src/test/java/feast/core/logging/CoreLoggingIT.java Outdated
@feast-ci-bot

Copy link
Copy Markdown
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

Details 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

woop commented Sep 6, 2020

Copy link
Copy Markdown
Member

/lgtm

@mrzzy

mrzzy commented Sep 7, 2020

Copy link
Copy Markdown
Collaborator Author

/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