Skip to content

[Fix][Connector-OBS] Upgrade okio to 3.6.0 to fix NoSuchFieldError: Companion#10756

Open
hyboll wants to merge 1 commit intoapache:devfrom
hyboll:dev-obs
Open

[Fix][Connector-OBS] Upgrade okio to 3.6.0 to fix NoSuchFieldError: Companion#10756
hyboll wants to merge 1 commit intoapache:devfrom
hyboll:dev-obs

Conversation

@hyboll
Copy link
Copy Markdown
Contributor

@hyboll hyboll commented Apr 13, 2026

Purpose of this pull request

Fix a NoSuchFieldError: Companion crash that occurs when initializing OBSFileSystem in the SeaTunnel Zeta engine.

Root cause:

okhttp 4.12.0 requires okio 3.x, but okio is not explicitly declared in the module's pom.xml. Without an explicit version, Maven's dependency mediation falls back to the version declared by esdk-obs-java 3.19.7.3, which references okio 1.14.0.

Caused by: org.apache.seatunnel.engine.common.exception.SeaTunnelEngineException: java.lang.NoSuchFieldError: Companion
	at okhttp3.internal.Util.<clinit>(Util.kt:70)
	at okhttp3.internal.concurrent.TaskRunner.<clinit>(TaskRunner.kt:309)
	at okhttp3.ConnectionPool.<init>(ConnectionPool.kt:41)
	at okhttp3.ConnectionPool.<init>(ConnectionPool.kt:47)
	at okhttp3.OkHttpClient$Builder.<init>(OkHttpClient.kt:471)
	at com.obs.services.internal.utils.RestUtils.initHttpClientBuilder(RestUtils.java:347)
	at com.obs.services.internal.RestStorageService.initHttpClient(RestStorageService.java:90)
	at com.obs.services.ObsClient.init(ObsClient.java:65)
	at com.obs.services.ObsClient.<init>(ObsClient.java:190)
	at org.apache.hadoop.fs.obs.ObsClientFactory$DefaultObsClientFactory.createHuaweiObsClient(ObsClientFactory.java:233)
	at org.apache.hadoop.fs.obs.ObsClientFactory$DefaultObsClientFactory.createObsClient(ObsClientFactory.java:285)
	at org.apache.hadoop.fs.obs.OBSFileSystem.initialize(OBSFileSystem.java:185)
	at org.apache.hadoop.fs.FileSystem.createFileSystem(FileSystem.java:3303)
	at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:476)
	at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:227)
	at org.apache.seatunnel.connectors.seatunnel.file.hadoop.HadoopFileSystemProxy.initialize(HadoopFileSystemProxy.java:259)
	at org.apache.seatunnel.connectors.seatunnel.file.hadoop.HadoopFileSystemProxy.<init>(HadoopFileSystemProxy.java:62)
	at org.apache.seatunnel.connectors.seatunnel.file.sink.commit.FileSinkAggregatedCommitter.init(FileSinkAggregatedCommitter.java:44)
	at org.apache.seatunnel.engine.server.task.SinkAggregatedCommitterTask.init(SinkAggregatedCommitterTask.java:118)
	at org.apache.seatunnel.engine.server.TaskExecutionService$BlockingWorker.run(TaskExecutionService.java:681)
	at org.apache.seatunnel.engine.server.TaskExecutionService$NamedTaskWrapper.run(TaskExecutionService.java:1012)
	at org.apache.seatunnel.api.tracing.MDCRunnable.run(MDCRunnable.java:43)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:750)

	at org.apache.seatunnel.core.starter.seatunnel.command.ClientExecuteCommand.execute(ClientExecuteCommand.java:258)
	... 2 more

Does this PR introduce any user-facing change?

No

How was this patch tested?

Added unit test ObsOkHttpClientCreationTest in connector-file-obs:

  • directly instantiates new OkHttpClient.Builder(), which triggers okhttp3.internal.Util.<clinit> — the exact crash site from the production stack trace. This test fails with NoSuchFieldError: Companion when okio 1.14.0 from esdk-obs-java mediation is on the classpath (because okhttp3 4.12.0 is binary-incompatible with the Companion field layout of okio 1.x), and passes after okio 3.6.0 is explicitly pinned. No real OBS credentials or network access are required.

Check list

Copy link
Copy Markdown

@DanielLeens DanielLeens left a comment

Choose a reason for hiding this comment

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

I pulled the current HEAD locally and checked both the dependency delta and the OBS runtime entry path.

Runtime chain:

ObsFileSource.prepare() / ObsFileSink.prepare()
  -> ObsConf.buildWithConfig(...)
  -> OBS SDK bootstrap
    -> OkHttpClient.Builder()

What this PR changes:

  • it pins com.squareup.okio:okio:3.6.0 in the OBS connector module
  • it adds a regression test at the exact crash site (OkHttpClient.Builder().build())

I do not see a code-path blocker in the current diff.
The remaining blocker is CI: current Build is red, and the failed job is Run / connector-file-sftp-it (11, ubuntu-latest) in the fork workflow run 24340656795. From the module boundary this looks unrelated to the OBS pom/test change, but it still needs to be rerun or cleared before merge.

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.

3 participants