Skip to content

java.lang.UnsatisfiedLinkError: Can't load library: /tmp/libh3-java6591047064313530667.so #97

Closed

Description

@ytdxwhy

Hi,
I have a flink job, H3Core.newInstance() is initialized in the open method , when restore from flink state , it throws an exception like this

java.lang.UnsatisfiedLinkError: Can't load library: /tmp/libh3-java6591047064313530667.so

at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1820)

at java.lang.Runtime.load0(Runtime.java:810)

at java.lang.System.load(System.java:1086)

at com.uber.h3core.H3CoreLoader.loadNatives(H3CoreLoader.java:125)

at com.uber.h3core.H3CoreLoader.loadNatives(H3CoreLoader.java:89)

at com.uber.h3core.H3Core.newInstance(H3Core.java:73)

at com.sankuai.meituan.banma.rtdw.flink.business.function.BusinessWorkStatusH3ClearRiderRichSinkFunction.open(BusinessWorkStatusH3ClearRiderRichSinkFunction.java:60)

at org.apache.flink.api.common.functions.util.FunctionUtils.openFunction(FunctionUtils.java:34)

at org.apache.flink.streaming.api.operators.AbstractUdfStreamOperator.open(AbstractUdfStreamOperator.java:102)

at org.apache.flink.streaming.api.operators.StreamSink.open(StreamSink.java:46)

at org.apache.flink.streaming.runtime.tasks.OperatorChain.initializeStateAndOpenOperators(OperatorChain.java:466)

at org.apache.flink.streaming.runtime.tasks.StreamTask.lambda$beforeInvoke$2(StreamTask.java:547)

at org.apache.flink.streaming.runtime.tasks.StreamTaskActionExecutor$1.runThrowing(StreamTaskActionExecutor.java:50)

at org.apache.flink.streaming.runtime.tasks.StreamTask.beforeInvoke(StreamTask.java:537)

at org.apache.flink.streaming.runtime.tasks.StreamTask.invoke(StreamTask.java:577)

at org.apache.flink.runtime.taskmanager.Task.doRun(Task.java:767)

at org.apache.flink.runtime.taskmanager.Task.run(Task.java:578)

at java.lang.Thread.run(Thread.java:748)

Activity

  1. TRReeve commented on Jul 26, 2022

    @TRReeve

    I had a similar problem using the H3 library in a docker container.

    java.lang.UnsatisfiedLinkError: /tmp/libh3-java2646520615962866068.so: /lib64/libm.so.6: version `GLIBC_2.29' not found (required by /tmp/libh3-java2646520615962866068.so)
    at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
    at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:388)
    at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:232)
    at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:174)
    at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2389)
    at java.base/java.lang.Runtime.load0(Runtime.java:755)
    at java.base/java.lang.System.load(System.java:1953)
    at com.uber.h3core.H3CoreLoader.loadNatives(H3CoreLoader.java:129)
    at com.uber.h3core.H3CoreLoader.loadNatives(H3CoreLoader.java:96)
    at com.uber.h3core.H3Core.newInstance(H3Core.java:79)

  2. isaacbrodsky commented on Aug 18, 2022

    @isaacbrodsky
    Collaborator

    @TRReeve Which version are you using? If you're on 3.x, could you try with the latest 4.0.0-rc4 prerelease version as the GLIBC requirement should be lower? I believe this is a different issue than @ytdxwhy's.

    @ytdxwhy Unfortunately it's a little tough to tell from that error what went wrong. My main suspect would be that the shared object file couldn't be written to the temp directory for some reason, or that the file was deleted between being written and being loaded by H3-Java. Is it possible that the application environment is different when resuming than the environment used when starting your application?

  3. dyrpsf commented on Jun 22, 2026

    @dyrpsf
    Contributor

    Hi @ytdxwhy and @TRReeve,

    I looked into the UnsatisfiedLinkError you were both encountering in Flink and Docker environments. Because distributed workers and containers can aggressively clean up or isolate the default /tmp directory, H3CoreLoader loses track of the extracted native library when the state is restored.

    To fix this, I've added an escape hatch: you can now specify a custom, stable extraction directory using the Java system property h3.native.dir (e.g., -Dh3.native.dir=/your/custom/path). If the property isn't provided, it will safely fall back to the default OS temp directory behavior.

    I have opened PR #209 with these changes. Let me know if this setup works for your infrastructure!

  4. added a commit that references this issue on Aug 18, 2026
    47dd9fd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions