-
Notifications
You must be signed in to change notification settings - Fork 25
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
TransformStream does not close #36
Comments
The behavior is correct, as there is no one reading from that transform. If you call This would work: // worker.js
const { Transform } = require('stream');
async function run (opts) {
const myTransform = new Transform({
autoDestroy: true,
transform(chunk, encoding, callback) {
console.log(chunk.toString());
callback(null)
}
});
myTransform.resume()
return myTransform
}
module.exports = run Note that passing down a |
|
I don't understand. |
I have the same issue I'm using pino with a custom transport and the error happens when I call process.exit() The transport file:
The papertrail.createWriteStream function uses pumpify...
Any help would be much appreciated :) |
Having same problem here, seems this happens only when using nodejs 12.x.x, adding the line |
I've created reproducible example https://github.com/Zn250g/server/tree/tests#readme docker or podman is required The issue:
podman build -q -t ubuntu-test -f ./ubuntu.dockerfile . && \
podman run --rm --interactive --cpus=2 --memory=7g --publish 9229-9239:9229-9239 localhost/ubuntu-test:latest \
node --experimental-vm-modules ./test.js
import { fileURLToPath } from 'url'
import { dirname, join } from 'path'
import spawn from 'cross-spawn'
const ROOT = dirname(fileURLToPath(import.meta.url))
let errorsCount = 0
let server = spawn('node', [
// '--inspect-brk=0.0.0.0:9230',
join(ROOT, 'destroy.js')
])
server.stdout?.on('data', chank => {
let msg = chank.toString()
if (msg.includes('Error')) {
errorsCount += 1
console.error(msg)
} else {
console.log(chank.toString())
}
})
server.stderr?.on('data', chank => {
errorsCount += 1
console.error(chank.toString())
})
server.on('close', exit => {
console.assert(
errorsCount === 0,
`Expect errorsCount to equal 0 but got ${errorsCount}`
)
console.assert(
exit === 0 || exit === null,
`Expect exit to equal 0 or null but got ${exit}`
)
})
import pino from 'pino'
import { dirname, join } from 'path'
import { fileURLToPath } from 'url'
const __dirname = dirname(fileURLToPath(import.meta.url))
pino({
name: 'logux-server',
transport: {
pipeline: [
{
target: join(__dirname, './createPinoTransport.js'),
options: {
basepath: '/usr/src/app',
color: false
}
},
{
target: 'pino/file'
}
]
}
})
process.on('uncaughtException', console.error)
FROM ubuntu:20.04
RUN apt update
RUN apt-get install -y curl
RUN curl -fsSL https://deb.nodesource.com/setup_17.x | bash -
RUN apt-get install -y nodejs
WORKDIR /usr/src/app
RUN useradd tester
RUN chown tester /usr/src/app
RUN mkdir /home/tester
RUN chown tester /home/tester
USER tester
RUN npm config set update-notifier false
RUN mkdir /usr/src/app/.npm-global
ENV NPM_CONFIG_PREFIX=/usr/src/app/.npm-global
COPY --chown=tester package*.json ./
RUN npm ci
COPY --chown=tester . ./
ENV FORCE_COLOR=2
CMD ["node"]
|
The github repo is not accessible and |
Please provide evidence of such a claim. Pino is used within Docker by many people. |
sorry for jumping the gun, let me investigate further. thanks. |
Verdaccio occasionally hangs locally after publishing all packages. Even a process.exit doesn't help due to the following error: pinojs/thread-stream#36 Upgrading pino to v9 resolves the issue
When using this module within a
TranformStream
, it leads to this error:Adding the statement:
solve the issue, but I'm not sure it is the right path to solve because it mix the readable stream interface withing the writable stream one.
It seems the writer stream end correctly, but the reader is still alive.
The
myTransform
does not emit any events (close
,finish
etc..)I tried Node.js v16 and 14 and I get the same results.
The text was updated successfully, but these errors were encountered: