Skip to content

KAFKA-10811: Correct the MirrorConnectorsIntegrationTest to correctly mask the exit procedures#9698

Merged
rhauch merged 1 commit intoapache:trunkfrom
rhauch:kafka-10811
Dec 7, 2020
Merged

KAFKA-10811: Correct the MirrorConnectorsIntegrationTest to correctly mask the exit procedures#9698
rhauch merged 1 commit intoapache:trunkfrom
rhauch:kafka-10811

Conversation

@rhauch
Copy link
Copy Markdown
Contributor

@rhauch rhauch commented Dec 4, 2020

Normally the EmbeddedConnectCluster class masks the Exit procedures using within the Connect worker. This normally works great when a single instance of the embedded cluster is used. However, the MirrorConnectorsIntegrationTest uses two EmbeddedConnectCluster instances, and when the first one is stopped it would reset the (static) exit procedures, and any problems during shutdown of the second embedded Connect cluster would cause the worker to shut down the JVM running the tests.

Instead, the MirrorConnectorsIntegrationTest class should mask the Exit procedures and instruct the EmbeddedConnectClusters instances (via the existing builder method) to not mask the procedures.

Ideally this should also be backported to 2.7, 2.6, and 2.5 branches.

Committer Checklist (excluded from commit message)

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation (including upgrade notes)

@rhauch
Copy link
Copy Markdown
Contributor Author

rhauch commented Dec 4, 2020

@C0urante as mentioned offline, here is my fix for the MM2 integration test frequently exiting the builds.

@C0urante
Copy link
Copy Markdown
Contributor

C0urante commented Dec 5, 2020

This is definitely an improvement not only to the flaky MM2 test but to the integration testing framework in general. ✅

As a follow-up item, could we track the unclean shutdowns for MM2 we've observed from these tests in a separate ticket? Given the flakiness that they're causing right now, it seems best to temporarily ignore them, but ideally it should be possible to run MM2 without seeing ERROR-level stack traces in logs on shutdown.

@rhauch
Copy link
Copy Markdown
Contributor Author

rhauch commented Dec 5, 2020

@C0urante is there a KAFKA issue for those stack traces? If not, please create one.

@C0urante
Copy link
Copy Markdown
Contributor

C0urante commented Dec 5, 2020

@rhauch it's not so much about the stack traces in these tests as it is about them presumably appearing when MM2 is run for real, and being caused by unclean worker shutdown. I've written up KAFKA-10812 to track the issue.

… mask the exit procedures

Normally the `EmbeddedConnectCluster` class masks the `Exit` procedures using within the Connect worker. This normally works great when a single instance of the embedded cluster is used. However, the `MirrorConnectorsIntegrationTest` uses two `EmbeddedConnectCluster` instances, and when the first one is stopped it would reset the (static) exit procedures, and any problems during shutdown of the second embedded Connect cluster would cause the worker to shut down the JVM running the tests.

Instead, the `MirrorConnectorsIntegrationTest` class should mask the `Exit` procedures and instruct the `EmbeddedConnectClusters` instances (via the existing builder method) to not mask the procedures.
@rhauch
Copy link
Copy Markdown
Contributor Author

rhauch commented Dec 6, 2020

Rebased on top of trunk to incorporate an upstream fix for the StreamsThreadTest compile error.

Copy link
Copy Markdown
Member

@mimaison mimaison left a comment

Choose a reason for hiding this comment

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

Thanks @rhauch, LGTM

Copy link
Copy Markdown
Member

@chia7712 chia7712 left a comment

Choose a reason for hiding this comment

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

@rhauch Thanks for this great fix!

private EmbeddedConnectCluster primary;
private EmbeddedConnectCluster backup;

private Exit.Procedure exitProcedure;
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.

It seems exitProcedure and haltProcedure can be local variable

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.

Perhaps, but the log messages for each is different, so IMO it's better to keep them separate.

shuttingDown = true;
try {
try {
primary.stop();
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.

How about using Utils.closeQuietly to replace this nested try-block?

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.

EmbeddedConnectCluster is not AutoCloseable, which means we can't use that. Since this PR is to fix broken builds, I'd like to minimize the additional changes, so I'll issue a followup PR.

@rhauch rhauch merged commit 8db3b1a into apache:trunk Dec 7, 2020
rhauch added a commit that referenced this pull request Dec 7, 2020
… mask the exit procedures (#9698)

Normally the `EmbeddedConnectCluster` class masks the `Exit` procedures using within the Connect worker. This normally works great when a single instance of the embedded cluster is used. However, the `MirrorConnectorsIntegrationTest` uses two `EmbeddedConnectCluster` instances, and when the first one is stopped it would reset the (static) exit procedures, and any problems during shutdown of the second embedded Connect cluster would cause the worker to shut down the JVM running the tests.

Instead, the `MirrorConnectorsIntegrationTest` class should mask the `Exit` procedures and instruct the `EmbeddedConnectClusters` instances (via the existing builder method) to not mask the procedures.

Author: Randall Hauch <rhauch@gmail.com>
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Chia-Ping Tsai <chia7712@gmail.com>
rhauch added a commit that referenced this pull request Dec 7, 2020
… mask the exit procedures (#9698)

Normally the `EmbeddedConnectCluster` class masks the `Exit` procedures using within the Connect worker. This normally works great when a single instance of the embedded cluster is used. However, the `MirrorConnectorsIntegrationTest` uses two `EmbeddedConnectCluster` instances, and when the first one is stopped it would reset the (static) exit procedures, and any problems during shutdown of the second embedded Connect cluster would cause the worker to shut down the JVM running the tests.

Instead, the `MirrorConnectorsIntegrationTest` class should mask the `Exit` procedures and instruct the `EmbeddedConnectClusters` instances (via the existing builder method) to not mask the procedures.

Author: Randall Hauch <rhauch@gmail.com>
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Chia-Ping Tsai <chia7712@gmail.com>
rhauch added a commit that referenced this pull request Dec 7, 2020
… mask the exit procedures (#9698)

Normally the `EmbeddedConnectCluster` class masks the `Exit` procedures using within the Connect worker. This normally works great when a single instance of the embedded cluster is used. However, the `MirrorConnectorsIntegrationTest` uses two `EmbeddedConnectCluster` instances, and when the first one is stopped it would reset the (static) exit procedures, and any problems during shutdown of the second embedded Connect cluster would cause the worker to shut down the JVM running the tests.

Instead, the `MirrorConnectorsIntegrationTest` class should mask the `Exit` procedures and instruct the `EmbeddedConnectClusters` instances (via the existing builder method) to not mask the procedures.

Author: Randall Hauch <rhauch@gmail.com>
Reviewers: Mickael Maison <mickael.maison@gmail.com>, Chia-Ping Tsai <chia7712@gmail.com>
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.

4 participants