Closed ebyhr closed 2 months ago
Timeout waiting for connection from pool
looks like we may be leaking connections (https://github.com/trinodb/trino/pull/22138#issuecomment-2133623525, cc @wendigo )
https://github.com/trinodb/trino/actions/runs/9294322023/job/25579300297
Error: io.trino.plugin.iceberg.TestIcebergMinioOrcConnectorTest.testOptimizeTimePartitionedTable -- Time elapsed: 304.7 s <<< ERROR!
io.trino.testing.QueryFailedException: Failed to open file: s3://test-iceberg-orc-uefiw4zbt3/iceberg_data/tpch/test_optimize_time_partitioned_timestamp6withtimezone_days-c2e6f5bda0c34b46b66f809c6f5b7cd7/metadata/f9b587a8-44f3-4ceb-b4ec-18b19188888c-m0.avro
at io.trino.testing.AbstractTestingTrinoClient.execute(AbstractTestingTrinoClient.java:133)
at io.trino.testing.DistributedQueryRunner.executeInternal(DistributedQueryRunner.java:554)
at io.trino.testing.DistributedQueryRunner.executeWithPlan(DistributedQueryRunner.java:543)
at io.trino.testing.QueryAssertions.assertDistributedUpdate(QueryAssertions.java:108)
at io.trino.testing.QueryAssertions.assertUpdate(QueryAssertions.java:62)
at io.trino.testing.AbstractTestQueryFramework.assertUpdate(AbstractTestQueryFramework.java:410)
at io.trino.plugin.iceberg.BaseIcebergConnectorTest.testOptimizeTimePartitionedTable(BaseIcebergConnectorTest.java:5163)
at io.trino.plugin.iceberg.BaseIcebergConnectorTest.testOptimizeTimePartitionedTable(BaseIcebergConnectorTest.java:5122)
The timeout happens at the following line in IcebergMetadata#finishOptimize
:
https://github.com/trinodb/trino/blob/8b2c12e83c039025c2cbac28987d5b9829560538/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/IcebergMetadata.java#L1528
The RewriteFiles rewriteFiles
tries creating Math.max(2, Runtime.getRuntime().availableProcessors())
threads and leads to timeout because the max allowed connection is 2 in the test.
https://github.com/apache/iceberg/blob/b6c949cd86c372a87a4d43a557c19dd310af80d8/core/src/main/java/org/apache/iceberg/SystemConfigs.java#L38-L43
I think this flaky test can be fixed by setting an executor like below:
RewriteFiles rewriteFiles = transaction.newRewrite()
.scanManifestsWith(...);
https://github.com/trinodb/trino/actions/runs/8868062958/job/24347265601