Kibana 7.10.2 build from src code failing due to socket hang up

Hi,

Kibana version: 7.10.2
I am trying to build kibana-oss rpm from src code (for centos env) following the procedure from developer guide.

The required pre-req dependencies (git,gcc etc) are installed, kibana bootstrap runs successfully, however building the rpm fails at the task 'Patching platform-specific native modules'.

Cmd used: yarn build --rpm --skip-node-download --oss --skip-archives --release -v --allow-root

info [kibana-oss] Patching platform-specific native modules
   │ debg Patching re2 binaries from https://github.com/uhop/node-re2/releases/download/1.15.4/linux-x64-64.gz to /home/workspace/kibana/build/oss/kibana-7.10.2-linux-aarch64/node_modules/re2/build/Release/re2.node
   │ debg Deleting patterns: [ '/home/workspace/kibana/build/oss/kibana-7.10.2-linux-aarch64/node_modules/re2/build/Release/re2.node' ]
   │ debg Patching re2 binaries from https://github.com/uhop/node-re2/releases/download/1.15.4/darwin-x64-64.gz to /home/workspace/kibana/build/oss/kibana-7.10.2-darwin-x86_64/node_modules/re2/build/Release/re2.node
   │ debg Deleting patterns: [ '/home/workspace/kibana/build/oss/kibana-7.10.2-darwin-x86_64/node_modules/re2/build/Release/re2.node' ]
   │ debg Patching re2 binaries from https://github.com/uhop/node-re2/releases/download/1.15.4/linux-x64-64.gz to /home/workspace/kibana/build/oss/kibana-7.10.2-linux-x86_64/node_modules/re2/build/Release/re2.node
   │ debg Deleting patterns: [ '/home/workspace/kibana/build/oss/kibana-7.10.2-linux-x86_64/node_modules/re2/build/Release/re2.node' ]
   │ debg Patching re2 binaries from https://github.com/uhop/node-re2/releases/download/1.15.4/win32-x64-64.gz to /home/workspace/kibana/build/oss/kibana-7.10.2-windows-x86_64/node_modules/re2/build/Release/re2.node
   │ debg Deleting patterns: [ '/home/workspace/kibana/build/oss/kibana-7.10.2-windows-x86_64/node_modules/re2/build/Release/re2.node' ]
   │ debg Deleted 1 files/directories
   │ sill Deleted: [ '/home/workspace/kibana/build/oss/kibana-7.10.2-linux-x86_64/node_modules/re2/build/Release/re2.node' ]
   │ debg Deleted 1 files/directories
   │ sill Deleted: [ '/home/workspace/kibana/build/oss/kibana-7.10.2-windows-x86_64/node_modules/re2/build/Release/re2.node' ]
   │ debg Deleted 1 files/directories
   │ sill Deleted: [ '/home/workspace/kibana/build/oss/kibana-7.10.2-darwin-x86_64/node_modules/re2/build/Release/re2.node' ]
   │ debg Deleted 1 files/directories
   │ sill Deleted: [ '/home/workspace/kibana/build/oss/kibana-7.10.2-linux-aarch64/node_modules/re2/build/Release/re2.node' ]
   │ debg Attempting download of https://github.com/uhop/node-re2/releases/download/1.15.4/linux-x64-64.gz e743587bc96314edf10c3e659c03168bc374a5cd9a6623ee99d989251e331f28
   │ debg Attempting download of https://github.com/uhop/node-re2/releases/download/1.15.4/win32-x64-64.gz b33de62cda24fb02dc80a19fb79977d686468ac746e97cd211059d2d4c75d529
   │ debg Attempting download of https://github.com/uhop/node-re2/releases/download/1.15.4/darwin-x64-64.gz 595c6653d796493ddb288fc0732a0d1df8560099796f55a1dd242357d96bb8d6
   │ debg Attempting download of https://github.com/uhop/node-re2/releases/download/1.15.4/linux-x64-64.gz e743587bc96314edf10c3e659c03168bc374a5cd9a6623ee99d989251e331f28
   │ debg Download failed: socket hang up
   │ debg Deleting downloaded data at /home/workspace/kibana/.native_modules/re2/darwin-x64-64.gz
   │ debg Retrying - 3 attempt remaining
   │ debg Download failed: socket hang up
   │ debg Deleting downloaded data at /home/workspace/kibana/.native_modules/re2/linux-x64-64.gz
   │ debg Retrying - 3 attempt remaining
   │ debg Download failed: socket hang up
   │ debg Deleting downloaded data at /home/workspace/kibana/.native_modules/re2/linux-x64-64.gz
   │ debg Retrying - 3 attempt remaining
   │ debg Attempting download of https://github.com/uhop/node-re2/releases/download/1.15.4/darwin-x64-64.gz 595c6653d796493ddb288fc0732a0d1df8560099796f55a1dd242357d96bb8d6
   │ debg Attempting download of https://github.com/uhop/node-re2/releases/download/1.15.4/linux-x64-64.gz e743587bc96314edf10c3e659c03168bc374a5cd9a6623ee99d989251e331f28
   │ debg Attempting download of https://github.com/uhop/node-re2/releases/download/1.15.4/linux-x64-64.gz e743587bc96314edf10c3e659c03168bc374a5cd9a6623ee99d989251e331f28
   │ debg Download failed: socket hang up
   │ debg Deleting downloaded data at /home/workspace/kibana/.native_modules/re2/win32-x64-64.gz
   │ debg Retrying - 3 attempt remaining
   │ debg Attempting download of https://github.com/uhop/node-re2/releases/download/1.15.4/win32-x64-64.gz b33de62cda24fb02dc80a19fb79977d686468ac746e97cd211059d2d4c75d529
   │ debg Download failed: socket hang up
   │ debg Deleting downloaded data at /home/workspace/kibana/.native_modules/re2/darwin-x64-64.gz
   │ debg Retrying - 2 attempt remaining
   │ debg Attempting download of https://github.com/uhop/node-re2/releases/download/1.15.4/darwin-x64-64.gz 595c6653d796493ddb288fc0732a0d1df8560099796f55a1dd242357d96bb8d6
   │ debg Download failed: socket hang up
   │ debg Deleting downloaded data at /home/workspace/kibana/.native_modules/re2/linux-x64-64.gz
   │ debg Retrying - 2 attempt remaining
   │ debg Download failed: socket hang up
   │ debg Deleting downloaded data at /home/workspace/kibana/.native_modules/re2/linux-x64-64.gz
   │ debg Retrying - 2 attempt remaining
   │ debg Attempting download of https://github.com/uhop/node-re2/releases/download/1.15.4/linux-x64-64.gz e743587bc96314edf10c3e659c03168bc374a5cd9a6623ee99d989251e331f28
   │ debg Attempting download of https://github.com/uhop/node-re2/releases/download/1.15.4/linux-x64-64.gz e743587bc96314edf10c3e659c03168bc374a5cd9a6623ee99d989251e331f28
   │ debg Download failed: socket hang up
   │ debg Deleting downloaded data at /home/workspace/kibana/.native_modules/re2/win32-x64-64.gz
   │ debg Retrying - 2 attempt remaining
   │ debg Attempting download of https://github.com/uhop/node-re2/releases/download/1.15.4/win32-x64-64.gz b33de62cda24fb02dc80a19fb79977d686468ac746e97cd211059d2d4c75d529
   │ debg Download failed: socket hang up
   │ debg Deleting downloaded data at /home/workspace/kibana/.native_modules/re2/darwin-x64-64.gz
   │ debg Retrying - 1 attempt remaining
   │ debg Download failed: socket hang up
   │ debg Deleting downloaded data at /home/workspace/kibana/.native_modules/re2/linux-x64-64.gz
   │ debg Retrying - 1 attempt remaining
   │ debg Download failed: socket hang up
   │ debg Deleting downloaded data at /home/workspace/kibana/.native_modules/re2/linux-x64-64.gz
   │ debg Retrying - 1 attempt remaining
   │ debg Attempting download of https://github.com/uhop/node-re2/releases/download/1.15.4/darwin-x64-64.gz 595c6653d796493ddb288fc0732a0d1df8560099796f55a1dd242357d96bb8d6
   │ debg Attempting download of https://github.com/uhop/node-re2/releases/download/1.15.4/linux-x64-64.gz e743587bc96314edf10c3e659c03168bc374a5cd9a6623ee99d989251e331f28
   │ debg Attempting download of https://github.com/uhop/node-re2/releases/download/1.15.4/linux-x64-64.gz e743587bc96314edf10c3e659c03168bc374a5cd9a6623ee99d989251e331f28
   │ debg Download failed: socket hang up
   │ debg Deleting downloaded data at /home/workspace/kibana/.native_modules/re2/win32-x64-64.gz
   │ debg Retrying - 1 attempt remaining
   │ debg Attempting download of https://github.com/uhop/node-re2/releases/download/1.15.4/win32-x64-64.gz b33de62cda24fb02dc80a19fb79977d686468ac746e97cd211059d2d4c75d529
   │ debg Download failed: socket hang up
   │ debg Deleting downloaded data at /home/workspace/kibana/.native_modules/re2/linux-x64-64.gz
   │ERROR failure 1 sec
   │ERROR Error: socket hang up
   │          at createHangUpError (_http_client.js:332:15)
   │          at Socket.socketOnEnd (_http_client.js:435:23)
   │          at Socket.emit (events.js:203:15)
   │          at endReadableNT (_stream_readable.js:1145:12)
   │          at process._tickCallback (internal/process/next_tick.js:63:19)

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
make: *** [buildrpm] Error 1

In this machine, http & https_proxy envs are set correctly to reach the internet, npm and yarn proxy vars have also been configured. I am successfully able to download the 3 pkgs i.e. darwin-x64-64.gz, linux-x64-64.gz and win32-x64-64.gz via direct wget from the said urls.

Q1: What could be the reason for this error? Are any additional npm/yarn settings needed for this step to proceed?
(The same settings/procedure worked fine while building kibana 7.0, 7.8).

Q2: As a workaround, I tried disabling the download & gzip method in file src/dev/build/tasks/patch_native_modules_task.ts (i.e. lines 95-111)

  await deleteAll([extractPath], log);
//  await download({
//    log,
//    url: archive.url,
//    destination: downloadPath,
//    sha256: archive.sha256,
//    retries: 3,
//  });
//  switch (pkg.extractMethod) {
//    case 'gunzip':
//      await gunzip(downloadPath, extractPath);
//      break;
//    case 'untar':
//      await untar(downloadPath, extractPath);
//      break;
//    default:
//      throw new Error(`Extract method of ${pkg.extractMethod} is not supported`);
//  }

With these changes, the yarn build stage completed successfully and the rpm got built. I validated this built rpm and it seems to work fine.
Just one observation was that the rpm size increased by 30mb (as certain files in node_modules/re2 didnt get cleaned up probably due to my change here).

What is the significance of this task 'Patching platform-specific native modules'? Is it not important in this case as the rpm works fine with my changes?
If this task is not required entirely, is there a cmd line argument for yarn build that would skip this part without modifying src code the way I have done here?

Pls note - I am interested in building oss rpm only for centos env (not all platforms like windows etc).

Any pointers would be highly appreciated.
Thanks!

That step addresses CVE-2020-7016

It's possible the issue you're running into is that step does not respect the proxy you have configured. Is it possible to run this from a machine with direct internet access not requiring a proxy?

Thanks for the response.
No i cannot run this from a machine with direct access to the internet and can only work through using proxy.
I do not enable timelion in my deployments, so in that case is it okay to skip this task as the CVE fix does not impact anyways?
Also follow-up question to that, is there a better way to skip this task (than the one I have tried by commenting the mentioned lines in the code)?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.