Unitech / Unitech/pm2

PDF Export Process using Grover + Puppeteer fails under PM2

Open
#4,955 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
43.3k
Forks
2.7k
PR merge metrics
No merged PRs in 30d

Description

What's going wrong?

There's this rails application that uses Grover and Puppetter to generate PDF prints from the webviews.

When using PM2 to start puma server, the PDF exports fail, but without PM2, it simply works.

The Puppeteer component used in PDF export process is a NodeJS module and uses a local server Chromium installation to perform the conversion. I wonder if there might be some known relation here that could cause this weird issue.

The exception comes out from Grover module, with the message Grover::Error: Worker process failed, but as mentioned earlier, it happpens only when started from PM2.

I have not yet started to debug the issue, but there's clearly something in PM2 affecting the chain.

Any thoughts?


Update:
The issue seeem related to "Broken EPIPE error" in the operating system. There might be a case where Grover create a temp file in the filesystem, but still have no further details. I will update this as soon as I get more info.

How could we reproduce this issue?

Any Rails application, using Grover and Puppetteer (NodeJS) to export the webview as PDF will cause the failure.

Supporting information

PM2 | 2021-01-07T04:02:13: PM2 log: PM2 PID file : /home/ubuntu/.pm2/pm2.pid
PM2 | 2021-01-07T04:02:13: PM2 log: RPC socket file : /home/ubuntu/.pm2/rpc.sock
PM2 | 2021-01-07T04:02:13: PM2 log: BUS socket file : /home/ubuntu/.pm2/pub.sock
PM2 | 2021-01-07T04:02:13: PM2 log: Application log path : /home/ubuntu/.pm2/logs
PM2 | 2021-01-07T04:02:13: PM2 log: Worker Interval : 30000
PM2 | 2021-01-07T04:02:13: PM2 log: Process dump file : /home/ubuntu/.pm2/dump.pm2
PM2 | 2021-01-07T04:02:13: PM2 log: Concurrent actions : 2
PM2 | 2021-01-07T04:02:13: PM2 log: SIGTERM timeout : 1600
PM2 | 2021-01-07T04:02:13: PM2 log: ===============================================================================
PM2 | 2021-01-07T04:02:13: PM2 log: [Watch] Start watching web
PM2 | 2021-01-07T04:02:13: PM2 log: App [web:0] starting in -fork mode-
PM2 | 2021-01-07T04:02:13: PM2 log: [Watch] Start watching sidekiq
PM2 | 2021-01-07T04:02:13: PM2 log: App [sidekiq:1] starting in -fork mode-
PM2 | 2021-01-07T04:02:13: PM2 log: App [web:0] online
PM2 | 2021-01-07T04:02:13: PM2 log: App [sidekiq:1] online
PM2 | 2021-01-07T04:02:13: PM2 log: [Watch] Start watching warehouse
PM2 | 2021-01-07T04:02:13: PM2 log: App [warehouse:2] starting in -fork mode-
PM2 | 2021-01-07T04:02:13: PM2 log: App [warehouse:2] online
PM2 | 2021-01-07T04:02:13: PM2 log: App [pm2-papertrail:3] starting in -fork mode-
PM2 | 2021-01-07T04:02:13: PM2 log: App [pm2-papertrail:3] online

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 PDF export in a Rails application using Grover and Puppeteer, comparing direct Puma startup with startup under PM2. Start with the PM2 logs and the reported Broken EPIPE error; the issue is done when the export succeeds under PM2 or the failing process interaction is identified.

Written by the indexing model from the issue text.

Assessment

Tech stack
nodejs, rails
Domain
backend, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.