Skip to content

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

Open

Description

@hhorak
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

Activity

  1. khardix commented on Feb 15, 2019

    @khardix

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

  2. hhorak commented on Feb 15, 2019

    @hhorak
    MemberAuthor

    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?

  3. khardix commented on Feb 15, 2019

    @khardix

    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.

  4. khardix commented on Feb 18, 2019

    @khardix

    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
  5. khardix commented on Feb 19, 2019

    @khardix

    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.

  6. jabinb commented on Feb 27, 2019

    @jabinb

    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

Metadata

Metadata

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