Skip to content

[spark] Fix flaky SparkMultimodalITCase by binding its test metastore to a free port#8833

Closed
XiaoHongbo-Hope wants to merge 1 commit into
apache:masterfrom
XiaoHongbo-Hope:fix_hive_metastore_flaky_port
Closed

[spark] Fix flaky SparkMultimodalITCase by binding its test metastore to a free port#8833
XiaoHongbo-Hope wants to merge 1 commit into
apache:masterfrom
XiaoHongbo-Hope:fix_hive_metastore_flaky_port

Conversation

@XiaoHongbo-Hope

Copy link
Copy Markdown
Contributor

Purpose

SparkMultimodalITCase hardcodes port 9092 (which is also Kafka's default port) for its test Hive metastore, so TestHiveMetastore.start(9092) intermittently fails when the port is already taken:

java.lang.RuntimeException: Cannot start TestHiveMetastore
    at org.apache.paimon.spark.SparkMultimodalITCase.startMetastore(SparkMultimodalITCase.java:49)
[ERROR] Tests run: 196, Failures: 0, Errors: 1, Skipped: 0

This is currently flaky on master too (e.g. the UTCase and ITCase Spark 4.x job fails on several recent master pushes with the exact same error).

Start the metastore on port 0 (an OS-assigned free port, which TestHiveMetastore already resolves via getLocalPort()) and read the actual port back through a new TestHiveMetastore.getPort() for the Spark configs, so the test no longer depends on a fixed port being free.

Tests

Exercised by SparkMultimodalITCase itself; the fixed-port race can't be reproduced deterministically in a unit test.

SparkMultimodalITCase hardcodes port 9092 (also Kafka's default) for its test
Hive metastore, so TestHiveMetastore.start(9092) intermittently fails with
"Cannot start TestHiveMetastore" when the port is already taken -- currently
flaky on master too.

Start the metastore on port 0 (an OS-assigned free port) and read the actual
port back via a new TestHiveMetastore.getPort() for the Spark configs.
@XiaoHongbo-Hope XiaoHongbo-Hope changed the title [spark] Bind SparkMultimodalITCase's test metastore to a free port [spark] Fix flaky SparkMultimodalITCase by binding its test metastore to a free port Jul 23, 2026
@JingsongLi

Copy link
Copy Markdown
Contributor

Duplicated to #8820 ?

@XiaoHongbo-Hope

Copy link
Copy Markdown
Contributor Author

Duplicated to #8820 ?

ok

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.

2 participants