Skip to content

[Bug][Zeta] SeaTunnelClient can not exit with error #9281

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

Open
wants to merge 9 commits into
base: dev
Choose a base branch
from

Conversation

CosmosNi
Copy link
Contributor

@CosmosNi CosmosNi commented May 7, 2025

SeaTunnelClient can not exit with error

close #9257

Purpose of this pull request

Does this PR introduce any user-facing change?

How was this patch tested?

Check list

@github-actions github-actions bot added core SeaTunnel core module Zeta labels May 7, 2025
@hailin0 hailin0 requested a review from Copilot May 7, 2025 01:50
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request fixes a bug where SeaTunnel components do not exit with an error by adding explicit error handling with System.exit(1) on fatal errors during Hazelcast initialization. Key changes include modifications in the server starter, Hazelcast client, and client command components to catch Errors and call System.exit(1).

Reviewed Changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.

File Description
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/SeaTunnelServerStarter.java Added try-catch block around Hazelcast initialization to log and exit on fatal errors.
seatunnel-engine/seatunnel-engine-client/src/main/java/org/apache/seatunnel/engine/client/SeaTunnelHazelcastClient.java Updated the constructor to catch Errors during client initialization and exit with an error code.
seatunnel-core/seatunnel-starter/src/main/java/org/apache/seatunnel/core/starter/seatunnel/command/ClientExecuteCommand.java Wrapped Hazelcast instance creation in a try-catch block to handle fatal errors and exit properly.
Files not reviewed (1)
  • pom.xml: Language not supported

} catch (Error e) {
log.error("Fatal error occurred during Hazelcast server initialization", e);
System.exit(1);
throw e;
Copy link
Preview

Copilot AI May 7, 2025

Choose a reason for hiding this comment

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

[nitpick] After calling System.exit(1), rethrowing the error is redundant since the JVM will terminate. Consider removing the rethrow for clarity unless it is required for testing purposes.

Suggested change
throw e;

Copilot uses AI. Check for mistakes.

} catch (Error e) {
log.error("Fatal error occurred during Hazelcast client initialization", e);
System.exit(1);
throw e;
Copy link
Preview

Copilot AI May 7, 2025

Choose a reason for hiding this comment

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

[nitpick] The rethrow after System.exit(1) is generally unnecessary since the process will terminate. Consider removing or documenting this pattern if it serves a specific testing purpose.

Suggested change
throw e;

Copilot uses AI. Check for mistakes.

} catch (Error e) {
log.error("Fatal error occurred during Hazelcast instance initialization", e);
System.exit(1);
throw e;
Copy link
Preview

Copilot AI May 7, 2025

Choose a reason for hiding this comment

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

[nitpick] Rethrowing the exception after calling System.exit(1) is redundant. Consider removing the rethrow to avoid unreachable code or adding a clarifying comment if needed for testing.

Suggested change
throw e;
// Note: The following line is unreachable due to System.exit(1).
// Uncomment for testing purposes if System.exit is mocked.
// throw e;

Copilot uses AI. Check for mistakes.

Comment on lines 285 to 288
return HazelcastInstanceFactory.newHazelcastInstance(
seaTunnelConfig.getHazelcastConfig(),
Thread.currentThread().getName(),
new SeaTunnelNodeContext(seaTunnelConfig));
Copy link
Member

Choose a reason for hiding this comment

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

create hazelcast instance is one of potential crisis. So we should handle it in

to catch all exist problem.

@github-actions github-actions bot removed the Zeta label May 7, 2025
@Hisoka-X
Copy link
Member

Hisoka-X commented May 7, 2025

wating test case passes.

@Hisoka-X
Copy link
Member

Hisoka-X commented May 9, 2025

Hi @CosmosNi , please merge from dev to disable dead link check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core SeaTunnel core module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug][Zeta] SeaTunnelClient can not exit with error
2 participants