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

Bug Report #1006

Open
nsanthoshkumar opened this issue Oct 10, 2024 · 9 comments
Open

Bug Report #1006

nsanthoshkumar opened this issue Oct 10, 2024 · 9 comments

Comments

@nsanthoshkumar
Copy link

Please provide below information while opening an issue to understand your problem

  • Operating System Name where ibm_db is installed: Linux Docker Container
  • Target Db2 Server Version or output of db2level command from Db2 database system: DB2 Warehouse

Please provide below problem specific info:

=========================================

For Installation related issue

I am trying to deploy a node app using docker with the following information in the Dockerfile. The docker build used to work previously for versions 18 and below and I updated the following node versions to 20 and changed the python to 3 instead of 2.7
and it is currently hanging before downloading the driver file. Any help is really appreciated? Thank you.

FROM registry.access.redhat.com/ubi8/nodejs-20

USER 0

WORKDIR /usr/src/app

COPY . /usr/src/app



# Install prerequisites for ibm_db
RUN yum install -y gcc python3 make gcc gcc-c++ openssl-devel bzip2-devel
RUN npm install

RUN rm -rf /usr/src/app/node_modules/ibm_db/installer/clidriver
RUN ls && cd node_modules/ibm_db && npm install --unsafe-perm 
RUN npm install 

I am using the following command to build the docker image

docker build --platform linux/amd64 -t <app_name:version>  .
image
@nsanthoshkumar
Copy link
Author

@bimaljha Can you please let me know if you have any insight or any help is really appreciated?

@bimalkjha
Copy link
Member

@nsanthoshkumar Problem that you see is: hanging before downloading the driver file while installation.
Installation messages on screen for successful installation looks like below:

> [email protected] install
> node installer/driverInstall.js

platform = linux, arch = x64, node.js version = v20.16.0
make version =GNU Make 4.2.1

****************************************
....

We can see that before downloading clidriver, driverInstall.js file is trying to find the version of make by executing make -v command. I think it is hanging in printMakeVersion() function of https://github.com/ibmdb/node-ibm_db/blob/master/installer/driverInstall.js#L819 while calling execSync API of child_process package. i.e. hanging before trying to download clidriver.
To reproduce the issue, you can paste the code of printMakeVersion() function in a test file run it. Share the result.
Run make -v manually and see if it is working or not. These tests should help us to move forward towards resolution. Thanks.

@nsanthoshkumar
Copy link
Author

nsanthoshkumar commented Oct 15, 2024

Thank you @bimalkjha for the reply, Below are the results of the testing
On the local machine running make -v
image

Ran from the node.js test code below

var os = require('os');
var silentInstallation = false;

function printMakeVersion() {
    console.log("I am triggered");
    var platform = os.platform();
  if (platform != 'win32') {
    try {
      var makeVersion = execSync('make -v').toString();
      makeVersion = makeVersion.split('\n')[0];
      if( downloadProgress == 0 ) printMsg("make version =" + makeVersion);
    } catch (e) {
      printMsg("Unable to find 'make' in PATH. Installation may fail!");
    }
  }
}

function printMsg(msg) {
    if (!silentInstallation) {
        console.log(msg);
    }
}
printMakeVersion();
image

I checked the pafth and added the following line to the path /usr/local/opt/make/libexec/gnubin and still the same error.

I edited the docker file and I tried running the make version on the docker. It also gets the same error as above.

Please let me know if any of these helps .

@bimalkjha
Copy link
Member

@nsanthoshkumar Your issue looks similar to https://stackoverflow.com/questions/43763494/make-command-not-found-in-docker-container
Add build-essential too in your yum install command and try. Your dockerfile should have below code:

# Install prerequisites for ibm_db
RUN yum update
RUN yum install -y build-essential gcc python3 make gcc gcc-c++ openssl-devel bzip2-devel
RUN make -v
RUN npm install

Thanks.

@nsanthoshkumar
Copy link
Author

@bimalkjha I don't think build-essential exists on the Redhat image. Also, the issue is happening only in the docker image creation process and the process is hanging at execSync. I changed it to print node version. It also hangs there.

@bimalkjha
Copy link
Member

bimalkjha commented Oct 21, 2024

@nsanthoshkumar Update your dockerfile to run a command node -e "console.log(require('child_process').execSync('node -v').toString())" after yum install. If it hangs or fails, ibm_db installation too will fail. If it works for you, please share result here.
Your dockerfile should as below:

# Install prerequisites for ibm_db
RUN yum update
RUN yum install -y gcc python3 make gcc gcc-c++ openssl-devel bzip2-devel
RUN npm install child_process
RUN node -e "console.log(require('child_process').execSync('node -v').toString())"
RUN make -v
RUN node -e "console.log(require('child_process').execSync('make -v').toString())"
RUN npm install

If it fails, then you need to open issue in https://github.com/nodejs/node/issues mentioning that command node -e "console.log(require('child_process').execSync('node -v').toString())" hangs in docker environment as it is issue with child_process, not with ibm_db and child_process is in-built package of nodejs. You can try using older version of nodejs too in docker that may not have this isuse.
Thanks.

@bimalkjha
Copy link
Member

@nsanthoshkumar Usually, we can find make as /usr/bin/make in the systems post installation. Since, it is at different location, node is unable to find it. you need to add /usr/local/opt/make/libexec/gnubin in PATH in docker script.
You mentioned that make -v is working locally. Since, you are using dockerfile, so any command working locally is irrelevant as it need to work inside docker.
I checked my docker linux image and can see /usr/bin/make file. Not sure why it is installed at different location for you.
I would suggest to update your dockerfile as below and then run:

# Install prerequisites for ibm_db
RUN yum update
RUN yum install -y gcc python3 make gcc gcc-c++ openssl-devel bzip2-devel
RUN make -v
RUN export PATH= /usr/local/opt/make/libexec/gnubin:$PATH
RUN which make
RUN make -v
RUN npm install

Please let us know if command node -e "console.log(require('child_process').execSync('node -v').toString())" is working for you or not. Thanks.

@nsanthoshkumar
Copy link
Author

@bimalkjha Thanks for the update and sorry for the delay
I tried the following and it did not work
#1006 (comment)

I will try the following #1006 (comment) and update you.

@bimalkjha
Copy link
Member

bimalkjha commented Nov 23, 2024

@nsanthoshkumar Any update?

If command node -e "console.log(require('child_process').execSync('node -v').toString())" is not working for you, then it is a bug with child_process package of nodejs itself and not and issue with ibm_db. Try using different version of node.js and issue still exists, you should open an issue here: https://github.com/nodejs/node/issues
Thanks.

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

2 participants