[Bug] Emoji triggers PDF-export crash and restarts container (CodiMD 2.6.0)
還沒有人認領這個 Issue。
- #1953 來自 @lakshay122007 —— 已關閉,未合併
評估
- 難度
- 5/5
- 預估耗時
- 一週以上
- 新手友好度
- 35/100
- Issue 類型
- 缺陷
- 描述清晰度
- 需要釐清
- 活躍度
- 停滯
- 技術堆疊
- docker-compose, javascript, nodejs
研究方向
首先,使用一個 emoji 重現 PDF 匯出,並檢查記錄中顯示的 node_modules/markdown-pdf/phantom/render.js 的 PhantomJS 呼叫。比較可用的 PDF 引擎選項和相依套件版本,然後驗證包含 emoji 的筆記能夠成功產生 PDF,且不會導致 PhantomJS 當機或容器重新啟動。
由索引模型根據 Issue 內容生成。
描述
Describe the bug
Exporting a note to PDF in CodiMD 2.6.0 crashes PhantomJS whenever the note contains certain emoji characters, which restarts the whole container.
To Reproduce
- Create or edit a note.
- Insert any emoji (e.g. 😀).
- Click Export → PDF.
- The request hangs and the container restarts.
Expected behavior
- A PDF should be generated successfully.
- The service should remain online.
Actual behavior
- PDF generation fails.
docker logsshow PhantomJS crashing withSIGFPE.- The CodiMD container restarts automatically.
Environment
| Item | Value |
|---|---|
| CodiMD ver. | 2.6.0 |
| Deployment | docker-compose |
| Node ver. | 16.20.2 (image default) |
| Base OS | Debian Buster |
| PDF engine | markdown-pdf + PhantomJS |
docker-compose excerpt (masked)
click to expand
services:
codimd:
image: <PRIVATE_REGISTRY>/hackmdio/hackmd:2.6.0
environment:
CMD_URL_PATH: codimd
CMD_DOMAIN: <YOUR_DOMAIN>
CMD_PROTOCOL_USESSL: "true"
QT_QPA_PLATFORM: ""
# Database
CMD_DB_URL: postgres://codimd:<MASKED_PW>@codimd_db/codimd
# Misc
CMD_EMAIL: "false"
CMD_PLANTUML_SERVER: https://<YOUR_DOMAIN>/plantuml
CMD_ALLOW_ANONYMOUS: "false"
CMD_ALLOW_ANONYMOUS_EDITS: "false"
CMD_CSP_ENABLE: "false"
Logs (full excerpt)
2025-07-09T06:13:04.445Z info: <MASKED_IP> - - [09/Jul/2025:06:13:04 +0000] "GET /me HTTP/1.1" 304 - "https://<YOUR_DOMAIN>/codimd/ixLMZtInSNiOnrbOkQ-Q_w" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36 Edg/138.0.0.0"
2025-07-09T06:13:06.517Z info: <MASKED_IP> - - [09/Jul/2025:06:13:06 +0000] "GET /uploads/upload_845dbee74d2337302b91fb126a4691db.png HTTP/1.1" 200 32405 "https://<YOUR_DOMAIN>/codimd/ixLMZtInSNiOnrbOkQ-Q_w" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36 Edg/138.0.0.0"
2025-07-09T06:13:20.968Z info: deserializeUser: c35f23dd-2732-46b7-9283-15b14eac234b
2025-07-09T06:13:21.478Z error: uncaughtException: Command failed: /home/hackmd/app/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs /home/hackmd/app/node_modules/markdown-pdf/phantom/render.js /tmp/tmp-<MASKED>.html /tmp/tmp-<MASKED>.pdf /home/hackmd/app /home/hackmd/app/node_modules/markdown-pdf/runnings.js /home/hackmd/app/node_modules/markdown-pdf/css/pdf.css /home/hackmd/app/node_modules/highlight.js/styles/github-gist.css A4 portrait 2cm 0 10000
PhantomJS has crashed. Please read the bug reporting guide at
<http://phantomjs.org/bug-reporting.html> and file a bug report.
Error: Command failed: /home/hackmd/app/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs /home/hackmd/app/node_modules/markdown-pdf/phantom/render.js /tmp/tmp-<MASKED>.html /tmp/tmp-<MASKED>.pdf /home/hackmd/app /home/hackmd/app/node_modules/markdown-pdf/runnings.js /home/hackmd/app/node_modules/markdown-pdf/css/pdf.css /home/hackmd/app/node_modules/highlight.js/styles/github-gist.css A4 portrait 2cm 0 10000
PhantomJS has crashed. Please read the bug reporting guide at
<http://phantomjs.org/bug-reporting.html> and file a bug report.
at ChildProcess.exithandler (node:child_process:402:12)
at ChildProcess.emit (node:events:513:28)
at maybeClose (node:internal/child_process:1100:16)
at Socket.<anonymous> (node:internal/child_process:458:11)
at Socket.emit (node:events:513:28)
at Pipe.<anonymous> (node:net:301:12)
2025-07-09T06:13:21.481Z error: Process will exit now.
Info: try to connect to tcp://codimd_db in port 5432
2025/07/09 06:13:22 portchecker.go:56: dial tcp codimd_db:5432: connect: connection success
Possible cause / context
- Matches https://github.com/hajareshyam/pdf-creator-node/issues/45 — PhantomJS cannot render certain emoji/Unicode glyphs.
- Removing all emoji lets the export succeed → strong evidence of an encoding issue.
- PhantomJS is unmaintained; CodiMD relies on it via
markdown-pdf.
Potential solutions
- Upgrade to CodiMD 3.x (if it has moved to a Chromium/Puppeteer backend).
- Replace PhantomJS with Puppeteer/Playwright in a custom build.
- Test latest
phantomjs-prebuiltpatch to confirm whether the crash persists.
Help wanted
- Can maintainers reproduce this crash with an emoji-containing note?
- Is there an official plan to migrate away from PhantomJS?
- Any patch or workaround would be greatly appreciated.
- 主要語言
- JavaScript
- 星號
- 10.2k
- 分支
- 1.1k
- PR 合併指標
- 30 天內沒有已合併 PR
環境準備
在瀏覽器裡用你自己的 GitHub 帳號啟動這個專案的開發容器。
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
hackmdio/codimd 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 72/100
-
難度 3/5 1-2 天 新手友好度 48/100
-
unable to login未關閉
難度 2/5 1-3 小時 新手友好度 28/100
-
難度 3/5 1-2 天 新手友好度 45/100
-
edu-hub未關閉
難度 5/5 一週以上 新手友好度 20/100
相似的 Issue
-
bug good first issue
難度 2/5 1-3 小時 新手友好度 85/100
shuxiachai/academic-commercialization-agent#531 ·
維護者通常 1 天內回覆
-
Bug Nethernet Tests
難度 2/5 1-3 小時 新手友好度 78/100
JSPrismarine/JSPrismarine#3949 · 1 則留言 · 1 個 reaction ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 88/100
ardatan/graphql-tools#8713 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
andromarces/agent-loops#2080 ·
維護者通常 1 天內回覆
-
priority: low server testing
難度 2/5 1-3 小時 新手友好度 78/100
blamechris/chroxy#9388 ·
維護者通常 1 天內回覆