apache / couchdb-fauxton

Fauxton is the new Web UI for CouchDB
https://github.com/apache/couchdb-fauxton
Apache License 2.0
377 stars 225 forks source link

Error in build for ppc64le under qemu, debian stretch #1234

Open wohali opened 4 years ago

wohali commented 4 years ago

Logfile output after applying the patch in #1233 πŸ‘

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! fauxton@1.2.1 webpack:release: `webpack --optimize-minimize --debug --progress --colors --config ./webpack.config.release.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the fauxton@1.2.1 webpack:release script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/jenkins/.npm/_logs/2019-10-10T23_08_15_712Z-debug.log
Warning: Command failed: npm run webpack:release
/home/jenkins/couchdb/src/fauxton/node_modules/webpack-cli/bin/cli.js:93
                                throw err;
                                ^

RangeError [ERR_OUT_OF_RANGE]: The value of "fd" is out of range. It must be >= 0 && <= 2147483647. Received 5.104235503814077e+38
    at createHandle (net.js:99:3)
    at new Socket (net.js:266:20)
    at createWritableStdioStream (/home/jenkins/couchdb/src/fauxton/node_modules/debug/src/node.js:194:16)
    at Object.<anonymous> (/home/jenkins/couchdb/src/fauxton/node_modules/debug/src/node.js:69:14)
    at Module._compile (/home/jenkins/couchdb/src/fauxton/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (/home/jenkins/couchdb/src/fauxton/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
    at Object.<anonymous> (/home/jenkins/couchdb/src/fauxton/node_modules/debug/src/index.js:9:20)
    at Module._compile (/home/jenkins/couchdb/src/fauxton/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (/home/jenkins/couchdb/src/fauxton/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
    at Object.<anonymous> (/home/jenkins/couchdb/src/fauxton/node_modules/snapdragon/lib/compiler.js:5:13)
    at Module._compile (/home/jenkins/couchdb/src/fauxton/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (/home/jenkins/couchdb/src/fauxton/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
    at Object.<anonymous> (/home/jenkins/couchdb/src/fauxton/node_modules/snapdragon/index.js:5:16)
    at Module._compile (/home/jenkins/couchdb/src/fauxton/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! fauxton@1.2.1 webpack:release: `webpack --optimize-minimize --debug --progress --colors --config ./webpack.config.release.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the fauxton@1.2.1 webpack:release script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Logfile attached, not much to see there.

2019-10-10T20_54_24_219Z-debug.log

Split from #1229

Antonio-Maranhao commented 4 years ago

This is a weird one.

Using the couchdbdev/ppc64le-debian-stretch-erlang-20.3.8.22-1 image, I tried different things and got errors from different packages that referenced this same 5.104235503814077e+38 value.

After more digging, I figure out that parseInt() and similar functions are returning this value when it should be returning NaN for non-integer inputs. Since NaN is a falsy in JS, you can imagine this can cause a ton of issues. Unfortunately I couldn't find out why this is happening nor any solutions. Maybe it's Docker related?

On couchdbdev/ppc64le-debian-stretch-erlang-20.3.8.22-1:

> root@b7f5e29e134c:/usr/src/couchdb-fauxton# node -v
v10.16.3
root@b7f5e29e134c:/usr/src/couchdb-fauxton# node
> parseInt('', 10)
5.104235503814077e+38
> parseFloat('')
5.104235503814077e+38
>

On my Mac:

➜  node -v
v10.16.3
➜  node
> parseInt('', 10)
NaN
> parseFloat('')
NaN
>
wohali commented 4 years ago

Were you running this on an Intel CPU or on a POWER platform?

My guess is it's a bug in qemu. I have on my plate to try a newer qemu (build from source) but I can't confirm.

willholley commented 4 years ago

It seems upgrading to node 12 is one workaround. I tested with the following Dockerfile:

FROM node:12-stretch-slim

RUN apt-get update && apt-get install -y git; \
    git clone https://github.com/apache/couchdb-fauxton.git; \
    cd couchdb-fauxton; \
    npm install --production && ./node_modules/grunt-cli/bin/grunt couchdb

Using base image node:10-stretch-slim results in the ERR_OUT_OF_RANGE error.

Also confirmed the workaround using our CI image created by NODEVERSION=12 ./build.sh platform debian-stretch and the following Dockerfile:

FROM couchdbdev/debian-stretch-erlang-20.3.8.22-1:latest

WORKDIR /usr/src

USER root

RUN apt-get update && apt-get install -y git; \
    git clone https://github.com/apache/couchdb-fauxton.git; \
    cd couchdb-fauxton; \
    npm install --production && ./node_modules/grunt-cli/bin/grunt couchdb