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

nodejs-ex app does not work with nodejs v10 #212

Open
hhorak opened this issue Feb 15, 2019 · 6 comments
Open

nodejs-ex app does not work with nodejs v10 #212

hhorak opened this issue Feb 15, 2019 · 6 comments
Assignees

Comments

@hhorak
Copy link
Member

hhorak commented Feb 15, 2019

s2i build https://github.com/sclorg/nodejs-ex.git centos/nodejs-10-centos7 testimgnode
Your branch is up to date with 'origin/master'.
---> Installing application source ...
---> Installing all dependencies
npm WARN deprecated jade@0.26.3: Jade has been renamed to pug, please install the latest version of pug instead of jade
npm WARN deprecated minimatch@0.3.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated to-iso-string@0.0.2: to-iso-string has been deprecated, use @segment/to-iso-string instead.
npm ERR! code Z_DATA_ERROR
npm ERR! errno -3
npm ERR! invalid distance too far back
npm notice created a lockfile as package-lock.json. You should commit this file.
added 117 packages from 342 contributors in 16.2s
npm ERR! Callback called more than once.

npm ERR! A complete log of this run can be found in:
npm ERR!     /opt/app-root/src/.npm/_logs/2019-02-15T06_42_11_908Z-debug.log
Build failed
ERROR: An error occurred: non-zero (13) exit code from centos/nodejs-10-centos7
@khardix
Copy link

khardix commented Feb 15, 2019

This seems like zlib related issue. I tried it with Fedora container with newer zlib, and the problem did not manifest.

@hhorak
Copy link
Member Author

hhorak commented Feb 15, 2019

This seems like zlib related issue. I tried it with Fedora container with newer zlib, and the problem did not manifest.

Can you be more specific, please? Where is the zlib used in this case?

@khardix
Copy link

khardix commented Feb 15, 2019

The Z_DATA_ERROR is a zlib error constant that seems to propagate from the native library through node wrapper. Similar issue on FreeBSD and Node 10.3 was solved with upgrade of the bundled zlib.

Node itself bundles zlib in version 1.2.11, CentOS 7 (and the image in question) contains version 1.2.7, so I guess it may be the manifestation of the same issue as above.

@khardix
Copy link

khardix commented Feb 18, 2019

I have managed to fix it by updating zlib to 1.2.11. Steps to reproduce:

  1. Rebuild zlib from Fedora Rawhide for EPEL 7:

    $ mock -r epel-7 --resultdir epel-7 --rebuild zlib-1.2.11-15.fc30.src.rpm
  2. Upgrade build image (here, using podman/buildah):

    #!/usr/bin/bash
    
    sources=(epel-7/zlib{,-devel}-1.2.11-*.x86_64.rpm)
    working=$(buildah from nodejs-10-centos7)
    target=nodejs-10-centos7-zlib
    
    buildah copy "$working" "${sources[@]}" /tmp/zlib/
    buildah run --user=root "$working" yum -y install "${sources[@]/#epel-7//tmp/zlib}"
    buildah commit "$working" "$target"
    
    podman push localhost/"$target" docker-daemon:"$target":local
  3. Verify that the application installs cleanly

    $ s2i build https://github.com/sclorg/nodejs-ex.git nodejs-10-centos7-zlib:local testimgnode
    
    Your branch is up to date with 'origin/master'.
    ---> Installing application source ...
    ---> Installing all dependencies
    npm WARN deprecated jade@0.26.3: Jade has been renamed to pug, please install the latest version of pug instead of jade
    npm WARN deprecated to-iso-string@0.0.2: to-iso-string has been deprecated, use @segment/to-iso-string instead.
    npm WARN deprecated minimatch@0.3.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
    npm notice created a lockfile as package-lock.json. You should commit this file.
    added 117 packages from 342 contributors and audited 200 packages in 3.482s
    found 5 vulnerabilities (2 low, 1 moderate, 1 high, 1 critical)
    run `npm audit fix` to fix them, or `npm audit` for details
    ---> Building in production mode
    ---> Pruning the development dependencies
    audited 200 packages in 0.996s
    found 5 vulnerabilities (2 low, 1 moderate, 1 high, 1 critical)
    run `npm audit fix` to fix them, or `npm audit` for details
    /opt/app-root/src/.npm is not a mountpoint
    ---> Cleaning the npm cache /opt/app-root/src/.npm
    /tmp is not a mountpoint
    ---> Cleaning the /tmp/npm-*
    Build completed successfully

@khardix
Copy link

khardix commented Feb 19, 2019

Though the magic of git bisect (:heart:) I managed to isolate the fix to a single commit.

Fix inflateInit2() bug when windowBits is 16 or 32.

A windowBits value of 0, 16, or 32 gets the window bits from the
zlib header. However there is no zlib header for 16, or for 32
when the input is gzip. This commit sets the window bits for
inflate to 15 if a gzip stream is detected and windowBits was 16
or 32.

@jabinb
Copy link

jabinb commented Feb 27, 2019

Thanks @khardix upgrading to zlib 1.2.11 worked for me too.

For anyone that needs it I've made a small script that we run inside our gitlab CI for building zlib (and other RPMs) from Fedora rawhide using mmornati/docker-mock-rpmbuilder which we then install inside of our container that inherits from centos/nodejs-10-centos7:latest. The process boils down to:

$ PACKAGE=zlib PACKAGE_VERSION=1.* ARCH=x86_64 TARGET=epel-7 OUTPUT_DIR=./rpm-packages ./build-rpm.sh
COPY ./rpm-packages/ /tmp/rpm-packages/
RUN yum install -y /tmp/rpm-packages/*

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

No branches or pull requests

4 participants