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

/usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.29' not found #221

Open
justjake opened this issue Dec 20, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@justjake
Copy link

justjake commented Dec 20, 2024

Environment Information

  • OS [e.g. Mac, Arch, Windows 10]: linux container based on node:18.17.0-bullseye-slim
  • Node Version [e.g. 8.2.1]: 18.17.0
  • NPM Version [e.g. 5.4.2]: N/A
  • C++ Toolchain [e.g. Visual Studio, llvm, g++]: ldd (Debian GLIBC 2.31-13+deb11u6) 2.31
  • confluent-kafka-javascript version [e.g. 2.3.3]: 1.0.0

Steps to Reproduce

Create this dockerfile:

FROM node:18.17.0-bullseye-slim
WORKDIR /app
RUN ldd --version
RUN npm install @confluentinc/kafka-javascript@1.0.0
RUN node -r @confluentinc/kafka-javascript

Then run a docker build:

$ docker build . --no-cache --progress=plain

#1 [internal] load .dockerignore
#1 transferring context: 2B done
#1 DONE 0.0s

#2 [internal] load build definition from Dockerfile
#2 transferring dockerfile: 235B done
#2 DONE 0.0s

#3 [internal] load metadata for docker.io/library/node:18.17.0-bullseye-slim
#3 DONE 0.0s

#4 [1/5] FROM docker.io/library/node:18.17.0-bullseye-slim
#4 DONE 0.0s

#5 [2/5] WORKDIR /app
#5 CACHED

#6 [3/5] RUN ldd --version
#6 0.171 ldd (Debian GLIBC 2.31-13+deb11u6) 2.31
#6 0.171 Copyright (C) 2020 Free Software Foundation, Inc.
#6 0.171 This is free software; see the source for copying conditions.  There is NO
#6 0.171 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#6 0.171 Written by Roland McGrath and Ulrich Drepper.
#6 DONE 0.2s

#7 [4/5] RUN npm install @confluentinc/kafka-javascript@1.0.0
#7 1.987 npm WARN deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
#7 2.010 npm WARN deprecated are-we-there-yet@2.0.0: This package is no longer supported.
#7 2.036 npm WARN deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
#7 2.036 npm WARN deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
#7 2.041 npm WARN deprecated npmlog@5.0.1: This package is no longer supported.
#7 2.042 npm WARN deprecated gauge@3.0.2: This package is no longer supported.
#7 3.134 
#7 3.134 added 61 packages in 3s
#7 3.134 
#7 3.134 4 packages are looking for funding
#7 3.134   run `npm fund` for details
#7 3.135 npm notice 
#7 3.135 npm notice New major version of npm available! 9.6.7 -> 11.0.0
#7 3.135 npm notice Changelog: <https://github.com/npm/cli/releases/tag/v11.0.0>
#7 3.135 npm notice Run `npm install -g npm@11.0.0` to update!
#7 3.135 npm notice 
#7 DONE 3.3s

#8 [5/5] RUN node -r @confluentinc/kafka-javascript
#8 0.243 /app/node_modules/bindings/bindings.js:121
#8 0.243         throw e;
#8 0.243         ^
#8 0.243 
#8 0.243 Error: /lib/aarch64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /app/node_modules/@confluentinc/kafka-javascript/build/Release/confluent-kafka-javascript.node)
#8 0.243     at Module._extensions..node (node:internal/modules/cjs/loader:1340:18)
#8 0.243     at Module.load (node:internal/modules/cjs/loader:1119:32)
#8 0.243     at Module._load (node:internal/modules/cjs/loader:960:12)
#8 0.243     at Module.require (node:internal/modules/cjs/loader:1143:19)
#8 0.243     at require (node:internal/modules/cjs/helpers:110:18)
#8 0.243     at bindings (/app/node_modules/bindings/bindings.js:112:48)
#8 0.243     at Object.<anonymous> (/app/node_modules/@confluentinc/kafka-javascript/librdkafka.js:10:32)
#8 0.243     at Module._compile (node:internal/modules/cjs/loader:1256:14)
#8 0.243     at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
#8 0.243     at Module.load (node:internal/modules/cjs/loader:1119:32) {
#8 0.243   code: 'ERR_DLOPEN_FAILED'
#8 0.243 }
#8 0.243 
#8 0.243 Node.js v18.17.0
#8 ERROR: process "/bin/sh -c node -r @confluentinc/kafka-javascript" did not complete successfully: exit code: 1
------
 > [5/5] RUN node -r @confluentinc/kafka-javascript:
#8 0.243     at require (node:internal/modules/cjs/helpers:110:18)
#8 0.243     at bindings (/app/node_modules/bindings/bindings.js:112:48)
#8 0.243     at Object.<anonymous> (/app/node_modules/@confluentinc/kafka-javascript/librdkafka.js:10:32)
#8 0.243     at Module._compile (node:internal/modules/cjs/loader:1256:14)
#8 0.243     at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
#8 0.243     at Module.load (node:internal/modules/cjs/loader:1119:32) {
#8 0.243   code: 'ERR_DLOPEN_FAILED'
#8 0.243 }
#8 0.243 
#8 0.243 Node.js v18.17.0
------
Dockerfile:5
--------------------
   3 |     RUN ldd --version
   4 |     RUN npm install @confluentinc/kafka-javascript@1.0.0
   5 | >>> RUN node -r @confluentinc/kafka-javascript
   6 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c node -r @confluentinc/kafka-javascript" did not complete successfully: exit code: 1

confluent-kafka-javascript Configuration Settings: N/A

Additional context: I guess 0.5.1 -> 1.0.0 is a breaking change after all

@milindl
Copy link
Contributor

milindl commented Dec 20, 2024

Thanks for filing this.

I think I know the issue. For node v23, they've made C++20 mandatory for addons, and we updated our toolchain to compile with that standard. We do compile the prebuilt binaries statically to avoid these issues, but glibc is still always dynamically linked because of how it is.

At least for now, I don't see an easy workaround (besides using bookworm rather than bullseye, which I'm guessing isn't a simple change, or updating the libc version within docker, which is also challenging).

For the next release, I'll see what I can do about this. Maybe revert the <22 node versions compilation to our older toolchain.

@milindl milindl added the bug Something isn't working label Dec 20, 2024
@fadi-quader-mox
Copy link

I'm having the exact issue with node:18.20.4-alpine image.

@milindl
Copy link
Contributor

milindl commented Dec 20, 2024

@fadi-quader-mox , this issue shouldn't come for the alpine image since the build process for that isn't changed (and they don't use glibc). For me I get this:

$ docker run --rm -it --entrypoint /bin/sh node:18.20.4-alpine
/ # mkdir app
/ # cd app
/app # npm init -y
Wrote to /app/package.json:

{
  "name": "app",
  "version": "1.0.0",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "description": ""
}



/app # npm install @confluentinc/kafka-javascript@1.0.0
npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
npm warn deprecated are-we-there-yet@2.0.0: This package is no longer supported.
npm warn deprecated gauge@3.0.2: This package is no longer supported.
npm warn deprecated npmlog@5.0.1: This package is no longer supported.
npm warn deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported

added 61 packages, and audited 62 packages in 11s

4 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
/app # node
Welcome to Node.js v18.20.4.
Type ".help" for more information.
> require('@confluentinc/kafka-javascript').features
[
  'gzip',             'snappy',
  'ssl',              'sasl',
  'regex',            'lz4',
  'sasl_plain',       'sasl_scram',
  'plugins',          'zstd',
  'sasl_oauthbearer', 'http',
  'oidc'
]
>
/app #

Could you attach your logs for the alpine case?

@fadi-quader-mox
Copy link

@milindl I use circleci cimg/node:18.20.4 image to install dependancies and build the app. Then, i build a docker image from this docker file with everything installed.

It seems the circleci node image uses glibc as its standard C library while alpine uses something else.

FROM node:18.20.4-alpine
WORKDIR /code

ENV NODE_PORT 8080
EXPOSE 8080
ENTRYPOINT [ "yarn", "start" ]

so running that image on the Kubernetes cluster fails with this error

Error: Error loading shared library ld-linux-x86-64.so.2: No such file or directory (needed by /code/node_modules/@confluentinc/kafka-javascript/build/Release/confluent-kafka-javascript.node)
at Module._extensions..node (node:internal/modules/cjs/loader:1460:18)
at Module.load (node:internal/modules/cjs/loader:1203:32)
at Module._load (node:internal/modules/cjs/loader:1019:12)
at Module.require (node:internal/modules/cjs/loader:1231:19)
at Hook.Module.require (/code/node_modules/dd-trace/packages/dd-trace/src/ritm.js:97:33)
at require (node:internal/modules/helpers:177:18)
at bindings (/code/node_modules/bindings/bindings.js:112:48)
at Object.<anonymous> (/code/node_modules/@confluentinc/kafka-javascript/librdkafka.js:10:32)
at Module._compile (node:internal/modules/cjs/loader:1364:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1422:10) {
code: 'ERR_DLOPEN_FAILED'

@milindl
Copy link
Contributor

milindl commented Dec 20, 2024

@fadi-quader-mox , this is a different issue, please see #48 . TL;DR, the binary of the wrong architecture/libc/OS gets copied into the docker container.

To prevent this, in the Dockerfile, delete node_modules/@confluentinc/kafka-javascript and run npm install (or the yarn equivalent) while after this deletion, it'll fetch the right binary.

@fadi-quader-mox
Copy link

@milindl This fixed it

WORKDIR /code/node_modules/@confluentinc/kafka-javascript
RUN rm -rf ./build/
RUN npm run install
WORKDIR /code

but kafka client times out when it's trying to connect.

Error: Local: Timed out
    at Function.createLibrdkafkaError [as create] (lib/error.js:459:10)
    at lib/client.js:464:28
    at callbackTrampoline (node:internal/async_hooks:128:17)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants