Open bieron opened 3 years ago
Hi Maximiliano, this is Franco from Cribl. I'm seeing the same issue JB reported earlier but, in my case, it fails on the first requests:
> log-collection@1.0.0 start /home/goat/workspace/interviews/log_collection
> node dist/src/index.js
internal/validators.js:92
throw new ERR_INVALID_ARG_TYPE(name, 'number', value);
^
TypeError [ERR_INVALID_ARG_TYPE]: The "fd" argument must be of type number. Received null
at Object.read (fs.js:485:3)
at LogReadable._read (/home/goat/workspace/interviews/log_collection/dist/src/controllers/LogRedable.js:44:12)
at LogReadable.Readable.read (_stream_readable.js:481:10)
at resume_ (_stream_readable.js:968:12)
at processTicksAndRejections (internal/process/task_queues.js:80:21) {
code: 'ERR_INVALID_ARG_TYPE'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! log-collection@1.0.0 start: `node dist/src/index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the log-collection@1.0.0 start 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/goat/.npm/_logs/2021-09-01T12_24_40_943Z-debug.log
Node version: 14.15.1
This issue was due to a race condition on the construction of LogReadable. fd may not be assign when _read is call. More recent master version ( after commit 3a94521380eb656e98507427c2be672d463dd92f ) implements LogReadable using fs/promises instead of callbacks, removing this issue.
Hello Maximiliano. Thanks for taking on the assignment!
after 3-4 of requests to
/events?file=apt/history.log
:Does not have to be apt/history.log, I can reproduce it with any valid file, after 2-4 requests.