Unitech / Unitech/pm2

pm2-docker splits logs every 65356 bytes with newlines. Breaks JSON output.

Open
#2,613 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

P4: Low S: Open for PR SYS: Docker T: Bug
Dominant language
JavaScript
Stars
43.3k
Forks
2.7k
PR merge metrics
No merged PRs in 30d

Description

If we have a script which console.log's 66k json file it will be split with newline at 65536 byte even in pm2-docker --raw mode.

Expected behaviour

pm2-docker --raw print_66k_JSON.js
should only output one line with JSON.

Actual behaviour

Outputs 2 lines split at 65356 bytes.

Steps to reproduce

Create print_66k_JSON.js:

const fs = require('fs')
console.log(fs.readFileSync('./66k.txt', 'utf8'))
setTimeout(() => {}, 1000 * 60 * 60 * 30) // to avoid auto-restart by pm2

Create ./66k.txt file with 66 text in it.
Run pm2-docker --raw print_66k_JSON.js

Observe line break at 65356 byte

Software versions used
OS         : Tried MacOS 10.12.2 and official docker image `node:7.2.0`
node.js    : 6.3.0 or 7.2.0 (tried both)
PM2        : 2.2.2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with pm2-docker --raw using print_66k_JSON.js and 66k.txt, then inspect the raw-output path handling large console output. Done means the 66k JSON content is emitted as one line without an inserted newline, while normal output behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, javascript, nodejs
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.