Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with running embeddings JS packages in alpine #15753

Open
PylotLight opened this issue Dec 14, 2024 · 1 comment
Open

Issues with running embeddings JS packages in alpine #15753

PylotLight opened this issue Dec 14, 2024 · 1 comment
Labels
crash An issue that could cause a crash linux An issue that occurs on Linux runtime

Comments

@PylotLight
Copy link

How can we reproduce the crash?

I have 2 main packages I'm testing which are basically getting the same stack trace:

embeddingsjs.js:

import embeddings from "@themaximalist/embeddings.js";
// defaults to local embeddings
const embedding = await embeddings("Hello World!");
// 384 dimension embedding array
console.log(embedding)

HuggingFaceTransformersEmbeddings.js:

import { HuggingFaceTransformersEmbeddings } from "@langchain/community/embeddings/hf_transformers";
const model = new HuggingFaceTransformersEmbeddings({
  model: "Xenova/all-MiniLM-L6-v2",
});
/* Embed queries */
const res = await model.embedQuery(
  "What would be a good company name for a company that makes colorful socks?"
);
console.log({ res });
/* Embed documents */
const documentRes = await model.embedDocuments(["Hello world", "Bye bye"]);
console.log({ documentRes });

Dockerfile:

FROM oven/bun:alpine AS base
WORKDIR /usr/src/app

FROM base AS install
RUN mkdir -p /temp/dev
COPY package.json bun.lockb /temp/dev/
RUN cd /temp/dev && bun install --frozen-lockfile
# install with --production (exclude devDependencies)
RUN mkdir -p /temp/prod
COPY package.json bun.lockb /temp/prod/
RUN cd /temp/prod && bun install --frozen-lockfile --production
# copy node_modules from temp directory
# then copy all (non-ignored) project files into the image
FROM base AS prerelease
COPY --from=install /temp/dev/node_modules node_modules
COPY . .
# copy production dependencies and source code into final image
FROM base AS release
# RUN apk add --no-cache gcompat python3 make gcc g++ glibc-2.35-r1.apk wget
RUN apk add --no-cache \
    gcompat \
    libc6-compat \
    python3 \
    make \
    gcc \
    g++ \
    bash \
    libstdc++ \
    musl-dev \
    wget
# RUN wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub && \
#     wget -q https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.35-r0/glibc-2.35-r0.apk && \
#     apk add glibc-2.35-r0.apk && \
#     rm glibc-2.35-r0.apk

COPY --from=install /temp/prod/node_modules node_modules
COPY --from=prerelease /usr/src/app/*.js .
COPY --from=prerelease /usr/src/app/package.json .
# RUN ldd /usr/src/app/node_modules/onnxruntime-node/bin/napi-v3/linux/x64/libonnxruntime.so.1.14.0
# run the app
USER bun
# EXPOSE 3000/tcp
ENTRYPOINT [ "bun", "run", "embeddingsjs.js" ]

Relevant log output

============================================================
Bun v1.1.38 (bf2f153f) Linux x64 (baseline)
Linux Kernel v6.11.9 | musl
CPU: sse42 popcnt avx avx2
Args: "bun" "run" "embeddingsjs.js"
Features: jsc napi_module_register(2) process_dlopen 
Builtins: "bun:main" "detect-libc" "node:child_process" "node:events" "node:fs" "node:os" "node:path" "node:stream" "node:string_decoder" "node:tty" "node:url" "node:util" "node:util/types" "node-fetch" 
Elapsed: 133ms | User: 242ms | Sys: 80ms
RSS: 1.07GB | Peak: 120.94MB | Commit: 1.07GB | Faults: 12

panic(main thread): A C++ exception occurred
oh no: Bun has crashed. This indicates a bug in Bun, not your code.

To send a redacted crash report to Bun's team,
please file a GitHub issue using the link below:

 https://bun.report/1.1.38/Br1bf2f153wBgggEg0v1gDA0eNpzVHDW1lZIrUhOLSjJzM9TyE9OLi0qSk0BAF13CGE
==========================================
Bun v1.1.38 (bf2f153f) Linux x64 (baseline)
Linux Kernel v6.11.9 | musl
CPU: sse42 popcnt avx avx2
Args: "bun" "run" "HuggingFaceTransformersEmbeddings.js"
Features: jsc tsconfig napi_module_register 
Builtins: "bun:main" "node:fs" "node:path" "node:string_decoder" "node:url" "node:util/types" 
Elapsed: 60ms | User: 143ms | Sys: 35ms
RSS: 1.01GB | Peak: 91.41MB | Commit: 1.01GB | Faults: 1

panic(main thread): A C++ exception occurred
oh no: Bun has crashed. This indicates a bug in Bun, not your code.

To send a redacted crash report to Bun's team,
please file a GitHub issue using the link below:

 https://bun.report/1.1.38/Br1bf2f153QgggkggCg0v1gDA0eNpzVHDW1lZIrUhOLSjJzM9TyE9OLi0qSk0BAF13CGE

Stack Trace (bun.report)

Bun v1.1.38 (bf2f153) on linux x86_64_baseline [RunCommand]

panic: A C++ exception occurred

Features: napi_module_register, jsc, tsconfig

@PylotLight PylotLight added the crash An issue that could cause a crash label Dec 14, 2024
@github-actions github-actions bot added linux An issue that occurs on Linux runtime labels Dec 14, 2024
Copy link
Contributor

Thank you for reporting this crash.

For Bun's internal tracking, this issue is BUN-9RK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crash An issue that could cause a crash linux An issue that occurs on Linux runtime
Projects
None yet
Development

No branches or pull requests

1 participant