question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Elasticdump fails with ERR_STREAM_PREMATURE_CLOSE with node.js 18.6/18.7

See original GitHub issue

Context

  • ElasticDump version: 6.84.1
  • Elasticsearch version: 7.13.3
  • Node.js version: 18.7.0
  • Full command you are having issue with (with inputs and outputs): elasticdump --input=<json_file> --output=<es_index> --limit=1000

Describe the bug When using newer versions of node.js (we’ve seen this issue with 18.6.0 and 18.7.0), elasticdump always fails when trying to write the last set of objects into ES with an ERR_STREAM_PREMATURE_CLOSE error. Older versions of node (e.g., 18.2.0) don’t have this issue.

To Reproduce Steps to reproduce the behavior:

  1. Install a newer version of node.js (we’ve seen this issue with 18.6.0 and 18.7.0).
  2. Run elasticdump to dump JSON into ES.

Current behavior The dump always fails when attempting to ingest the last set of objects from the JSON file. E.g.,

Tue, 23 Aug 2022 13:28:26 GMT | starting dump
Tue, 23 Aug 2022 13:28:26 GMT | got 1000 objects from source file (offset: 0)
Tue, 23 Aug 2022 13:28:31 GMT | sent 1000 objects to destination elasticsearch, wrote 1000
Tue, 23 Aug 2022 13:28:31 GMT | got 1000 objects from source file (offset: 1000)
Tue, 23 Aug 2022 13:28:34 GMT | sent 1000 objects to destination elasticsearch, wrote 1000
Tue, 23 Aug 2022 13:28:34 GMT | got 960 objects from source file (offset: 2000)
Tue, 23 Aug 2022 13:28:34 GMT | Error Emitted => {
  msg: 'Pipeline failed',
  err: Error [ERR_STREAM_PREMATURE_CLOSE]: Premature close
      at new NodeError (node:internal/errors:387:5)
      at Stream.<anonymous> (node:internal/streams/pipeline:352:14)
      at Stream.emit (node:events:525:35)
      at Stream.emit (node:domain:489:12)
      at stream.destroy (/opt/homebrew/lib/node_modules/elasticdump/node_modules/through/index.js:84:12)
      at _end (/opt/homebrew/lib/node_modules/elasticdump/node_modules/through/index.js:67:14)
      at stream.end (/opt/homebrew/lib/node_modules/elasticdump/node_modules/through/index.js:74:5)
      at PassThrough.onend (node:internal/streams/readable:705:10)
      at Object.onceWrapper (node:events:627:28)
      at PassThrough.emit (node:events:525:35) {
    code: 'ERR_STREAM_PREMATURE_CLOSE'
  }
}

Expected behavior The JSON -> ES dump succeeds without issues.

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:12

github_iconTop GitHub Comments

1reaction
ferronrsmithcommented, Oct 23, 2022

i haven’t used windows in years and I would rather like to avoid OS issues. Switching back to pipe works for me as well. I’ll merge this change in ASAP

1reaction
manzonifcommented, Oct 23, 2022

You’re testing the wrong branch. There is no pipeline in the branch supploied

Sorry, my bad.

npm install "https://github.com/elasticsearch-dump/elasticsearch-dump.git#feature/pipeline-to-pipe" --save -g

work like a charm.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[BUG] elasticdump v. 6.15.4 only supports Node.js 10+ #630
ElasticDump version: 6.15.4 Elasticsearch version: irrelevant Node.js version: ... --input=... on Node.js v8, I get the following error:.
Read more >
'Cannot switch to old mode now' Error in Elasticdump
Your node version is outdated. Try running node --version and if you get anything below 1.0.0 then you need to upgrade your local...
Read more >
elasticdump
If you recive an "out of memory" error, this is probably or most likely the cause. Version 2.0.0 of Elasticdump removes the bulk...
Read more >
elasticdump - Import and export tools for elasticsearch
Issues: 1) The only concern is about naming this package. I see elasticdump.js is a library and elasticdump is a wrapper to use...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found