OpenMetadata icon indicating copy to clipboard operation
OpenMetadata copied to clipboard

Semantic search with DJL embedding provider fails on Alpine-based server image (1.12.3)

Open edmei-maven opened this issue 8 months ago • 5 comments

Affected Module

Backend — Semantic Search / Vector Embedding initialisation (SearchRepository)

Describe the Bug

Enabling semantic search with the DJL embedding provider (EMBEDDING_PROVIDER=djl) on the official Docker image docker.getcollate.io/openmetadata/server:1.12.3 fails at startup. The DJL library attempts to download PyTorch native libraries from publish.djl.ai, but these pre-built .so files are compiled against glibc and cannot load on the Alpine Linux 3.23 base image, which uses musl libc.

The server starts and runs, but semantic search is non-functional — the SearchRepository logs the failure and falls back silently.

Error from startup logs:

ERROR [main] o.o.s.s.SearchRepository - Failed to initialize vector search service: Failed to load PyTorch native library ai.djl.engine.EngineException: Failed to load PyTorch native library at ai.djl.pytorch.engine.PtEngine.newInstance(PtEngine.java:90) at ai.djl.pytorch.engine.PtEngineProvider.getEngine(PtEngineProvider.java:41) at ai.djl.engine.Engine.getEngine(Engine.java:195) at ai.djl.Model.newInstance(Model.java:99) at ai.djl.repository.zoo.BaseModelLoader.createModel(BaseModelLoader.java:218) at ai.djl.repository.zoo.BaseModelLoader.loadModel(BaseModelLoader.java:169) at ai.djl.repository.zoo.Criteria.loadModel(Criteria.java:151) at org.openmetadata.service.search.vector.client.DjlEmbeddingClient.(DjlEmbeddingClient.java:57) at org.openmetadata.service.search.SearchRepository.initializeVectorSearchService(SearchRepository.java:405) Caused by: java.lang.UnsatisfiedLinkError: /home/openmetadata/.djl.ai/pytorch/2.7.1-cpu-linux-x86_64/libc10.so: Error loading shared library libstdc++.so.6: No such file or directory (needed by /home/openmetadata/.djl.ai/pytorch/2.7.1-cpu-linux-x86_64/libc10.so) at ai.djl.pytorch.jni.LibUtils.loadNativeLibrary(LibUtils.java:380) at ai.djl.pytorch.jni.LibUtils.loadLibTorch(LibUtils.java:171) at ai.djl.pytorch.jni.LibUtils.loadLibrary(LibUtils.java:83) at ai.djl.pytorch.engine.PtEngine.newInstance(PtEngine.java:53)

ldd output from inside the container confirms missing glibc dependencies:

Error loading shared library libstdc++.so.6: No such file or directory Error loading shared library libgcc_s.so.1: No such file or directory Error loading shared library ld-linux-x86-64.so.2: No such file or directory Error relocating libc10.so: _ZdlPvm: symbol not found Error relocating libc10.so: _Znwm: symbol not found Error relocating libc10.so: _Unwind_Resume: symbol not found ...

This is not just a missing package — installing Alpine's libstdc++ won't resolve it because the PyTorch binaries require the glibc dynamic linker (ld-linux-x86-64.so.2) and glibc-specific symbol relocations. The DJL HuggingFace tokenizer (libtokenizers.so, shipped in tokenizers-0.34.0.jar) has the same musl incompatibility (ref: deepjavalibrary/djl#2946).

This affects anyone using the default DJL provider — the only embedding option that doesn't require an external API key.

To Reproduce

  1. Deploy docker.getcollate.io/openmetadata/server:1.12.3 with OpenSearch as the search backend
  2. Set environment variables: SEMANTIC_SEARCH_ENABLED=true EMBEDDING_PROVIDER=djl
  3. Start the server
  4. Observe the Failed to initialize vector search service error in logs
  5. Semantic search via the UI or /api/v1/search/vector/query endpoint returns no results

Expected Behavior

The DJL embedding provider should initialise successfully, download the all-MiniLM-L6-v2 model, and serve semantic search queries — as documented at https://docs.open-metadata.org/v1.12.x/deployment/semantic-search.

Version

  • OS (container): Alpine Linux 3.23 (musl 1.2.5)
  • OpenMetadata version: 1.12.3
  • Image: docker.getcollate.io/openmetadata/server:1.12.3
  • DJL version (bundled): pytorch-engine-0.34.0.jar, tokenizers-0.34.0.jar
  • Deployment: Kubernetes (Helm chart openmetadata v1.12.3)

Additional Context

Root cause

The server image is based on Alpine Linux, which uses musl libc. DJL's pre-built PyTorch native libraries (downloaded at runtime from publish.djl.ai) are compiled against glibc. This is a fundamental incompatibility — not just a missing package.

The same issue affects:

So switching DJL to use the ONNX Runtime engine instead of PyTorch would not resolve this on Alpine.

Possible fixes

  1. Switch to a glibc-based image (e.g. Debian slim, Eclipse Temurin on Ubuntu, or Chainguard/Wolfi) — most reliable fix
  2. Add gcompat + libstdc++ to the Alpine image (apk add --no-cache gcompat libstdc++) — lighter change but may not be fully reliable for all symbols
  3. Bundle musl-compatible native libs — DJL does not currently publish musl builds, so this would require building from source

edmei-maven avatar Mar 23 '26 15:03 edmei-maven

Confirmed reproducible on OpenMetadata 1.13.0 with the official server image.

Environment:

  • Image: docker.getcollate.io/openmetadata/server:1.13.0
  • Base OS: Alpine Linux 3.23.4, musl libc 1.2.5
  • DJL version: 0.34.0 (pytorch-engine-0.34.0.jar)
  • PyTorch native runtime: 2.7.1-cpu-linux-x86_64
  • Deployment: OpenShift 4.x via official Helm chart

Error observed: Same UnsatisfiedLinkError — libgomp and libc10.so fail to load due to missing glibc symbols.

This was also independently reported in the community Slack #support channel against 1.13.0.

The bug has not been resolved between 1.12.3 and 1.13.0. DJL semantic search remains non-functional on the official image.

AuTyi avatar Jun 26 '26 06:06 AuTyi

I got the same issue in 1.13.1. As a workaround I have created a custom image based on https://github.com/open-metadata/OpenMetadata/blob/main/docker/docker-compose-quickstart/Dockerfile

FROM alpine:3 AS build
ARG RI_VERSION="1.13.1"
ENV RELEASE_URL="https://github.com/open-metadata/OpenMetadata/releases/download/${RI_VERSION}-release/openmetadata-${RI_VERSION}.tar.gz"

RUN mkdir -p /opt/openmetadata && \
    wget ${RELEASE_URL} && \
    tar zxvf openmetadata-*.tar.gz -C /opt/openmetadata --strip-components 1 && \
    rm openmetadata-*.tar.gz

FROM ubuntu:24.04
ARG RI_VERSION="1.13.1"
ARG BUILD_DATE
ARG COMMIT_ID
LABEL maintainer="OpenMetadata"
LABEL org.open-metadata.image.authors="[email protected]"
LABEL org.open-metadata.vendor="OpenMetadata"
LABEL org.open-metadata.release-version="$RI_VERSION"
LABEL org.open-metadata.description="OpenMetadata is an open source platform for metadata management and discovery."
LABEL org.open-metadata.url="https://open-metadata.org/"
LABEL org.open-metadata.vcs-url="https://github.com/open-metadata/OpenMetadata"
LABEL org.open-metadata.build-date=$BUILD_DATE
LABEL org.open-metadata.commit-id=$COMMIT_ID

EXPOSE 8585 8586
RUN useradd -m openmetadata && apt update && \
    apt upgrade -y && \
    apt install -y openjdk-21-jre

COPY --chown=openmetadata:openmetadata --from=build /opt/openmetadata /opt/openmetadata
COPY --chmod=755 ./openmetadata-start.sh ./
USER openmetadata

WORKDIR /opt/openmetadata
ENTRYPOINT [ "/bin/bash" ]
CMD ["/openmetadata-start.sh"]

victormacedo996 avatar Jul 31 '26 20:07 victormacedo996

Hi @pmbrull, is the fix from #32182 going to be backported to 2.0.x? 2.0.4 and 2.0.5 still ship the Alpine image, so DJL semantic search doesn't work there. If not, any rough ETA for the release that includes it?

kalecgoss avatar Oct 16 '26 05:10 kalecgoss

Sorry for necrobumping, but the v2 realeases don't seem to have this fix. When will a patch be made available? @pmbrull It might be good to reopen this issue

bolleyboll avatar Oct 26 '26 05:10 bolleyboll

Hi @pmbrull, a gentle follow-up on this one. The fix from #32182 is in 2.1.0-rc1, but 2.0.x still ships the Alpine image, so DJL semantic search still fails there. Is a backport to 2.0.x planned? If so, roughly which release? Thanks!

Witich avatar Nov 11 '26 08:11 Witich