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

**URL:** <https://discuss.elastic.co/t/kibana-7-10-2-build-from-src-code-failing-due-to-socket-hang-up/278982>\
**Category:** Kibana\
**Created:** [July 18, 2021, 8:45am UTC](https://discuss.elastic.co/t/kibana-7-10-2-build-from-src-code-failing-due-to-socket-hang-up/278982 "2021-07-18T08:45:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![shivani\_aggarwal](https://avatars.discourse-cdn.com/v4/letter/s/22d042/32.png) [@shivani\_aggarwal](https://discuss.elastic.co/u/shivani_aggarwal)\
**Post date:** [July 18, 2021, 8:45am UTC](https://discuss.elastic.co/t/kibana-7-10-2-build-from-src-code-failing-due-to-socket-hang-up/278982/1 "2021-07-18T08:45:45Z")

</div>

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](https://www.elastic.co/guide/en/kibana/master/development-getting-started.html).

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`

```auto
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)

```auto
  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!

---

<div class="post-metadata">

**Author:** ![tylersmalley](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tylersmalley/32/8833_2.png) [@tylersmalley](https://discuss.elastic.co/u/tylersmalley)\
**Post date:** [July 19, 2021, 8:24pm UTC](https://discuss.elastic.co/t/kibana-7-10-2-build-from-src-code-failing-due-to-socket-hang-up/278982/2 "2021-07-19T20:24:29Z")

</div>

That step addresses [CVE-2020-7016](https://cve.mitre.org/cgi-bin/cvename.cgi?name=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?

---

<div class="post-metadata">

**Author:** ![shivani\_aggarwal](https://avatars.discourse-cdn.com/v4/letter/s/22d042/32.png) [@shivani\_aggarwal](https://discuss.elastic.co/u/shivani_aggarwal)\
**Post date:** [July 21, 2021, 5:13am UTC](https://discuss.elastic.co/t/kibana-7-10-2-build-from-src-code-failing-due-to-socket-hang-up/278982/3 "2021-07-21T05:13:10Z")

</div>

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)?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 18, 2021, 5:13am UTC](https://discuss.elastic.co/t/kibana-7-10-2-build-from-src-code-failing-due-to-socket-hang-up/278982/4 "2021-08-18T05:13:16Z")

</div>

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