Skip to content
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

Failed converting Markdown when running inside VSCode (snap) terminal #287

Closed
zhelnio opened this issue Sep 14, 2020 · 4 comments
Closed
Labels
upstream Caused in upstream, not in this repo

Comments

@zhelnio
Copy link

zhelnio commented Sep 14, 2020

  • Ubuntu 20.04 LTS
  • chromium installed using the system default apt install (installs snap package)
  • vscode installed using snap
  • marp installed globaly
$ npm list -g --depth=0
/usr/local/lib
├── @marp-team/[email protected]
├── [email protected]
└── [email protected]

Converting in default (gnome) terminal:

marp slides_ru.md --allow-local-files --output out/slides_ru.pdf
[  INFO ] Converting 1 markdown...
[  WARN ] Insecure local file accessing is enabled for conversion from slides_ru.md.
[  WARN ] Some of the local files are missing and will be ignored. Make sure the file paths are correct.
[  INFO ] slides_ru.md => out/slides_ru.pdf

Converting in VS Code terminal:

marp slides_ru.md --allow-local-files --output out/slides_ru.pdf
[  INFO ] Converting 1 markdown...
[  WARN ] Insecure local file accessing is enabled for conversion from slides_ru.md.
[ ERROR ] Failed converting Markdown. (Puppeteer was unable to kill the process which ran the browser binary.
          This means that, on future Puppeteer launches, Puppeteer might not be able to launch the browser.
          Please check your open processes and ensure that the browser processes that Puppeteer launched have been killed.
          If you think this is a bug, please report it on the Puppeteer issue tracker.
          Error cause: Error: kill EACCES
          at ChildProcess.kill (internal/child_process.js:438:26)
          at BrowserRunner.kill (/usr/local/lib/node_modules/@marp-team/marp-cli/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserRunner.js:149:27)
          at ChromeLauncher.launch (/usr/local/lib/node_modules/@marp-team/marp-cli/node_modules/puppeteer-core/lib/cjs/puppeteer/node/Launcher.js:111:20))

P.S. the same error text was shown when I've tried to export pdf using VS Code marp extension

@yhatt
Copy link
Member

yhatt commented Sep 14, 2020

Marp CLI in a terminal seems to get working in the latest version (except warning about some missing links to local files). Thus, I think that it's VS Code's snap specific.

Is CHROME_PATH=/snap/bin/chromium marp slides_ru.md --allow-local-files --output out/slides_ru.pdf getting work in VS Code terminal?

We've confirmed it is snap specific. This error is not reproduced in VS Code installed by .deb.

marp-vscode is still throwing error because we are waiting updation of the containing CLI in the extension until new version made stable. See also: marp-team/marp-vscode#166, marp-team/marp-vscode#165

@yhatt yhatt changed the title Failed converting Markdown when running inside VSCode terminal Failed converting Markdown when running inside VSCode (snap) terminal Sep 14, 2020
@yhatt yhatt added bug Something isn't working upstream Caused in upstream, not in this repo labels Sep 14, 2020
@yhatt
Copy link
Member

yhatt commented Sep 14, 2020

Minimum reproducible example

$ echo '' | DEBUG="puppeteer:*" npx @marp-team/marp-cli -o ~/marp.pdf

[  INFO ] Converting 1 markdown...
  puppeteer:launcher Calling /usr/bin/chromium-browser --disable-background-networking --enable-features=NetworkService,NetworkServiceInProcess --disable-background-timer-throttling --disable-backgrounding-occluded-windows --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-background-pages --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=TranslateUI --disable-hang-monitor --disable-ipc-flooding-protection --disable-popup-blocking --disable-prompt-on-repost --disable-renderer-backgrounding --disable-sync --force-color-profile=srgb --metrics-recording-only --no-first-run --enable-automation --password-store=basic --use-mock-keychain --user-data-dir=/tmp/marp-cli-conversion --headless --hide-scrollbars --mute-audio about:blank --export-tagged-pdf --remote-debugging-pipe +0ms
  puppeteer:protocol:SEND ► {"method":"Target.setDiscoverTargets","params":{"discover":true},"id":1} +0ms
  puppeteer:error Error: read ECONNRESET
  puppeteer:error     at Pipe.onStreamRead (internal/stream_base_commons.js:205:27) +0ms
[ ERROR ] Failed converting Markdown. (Puppeteer was unable to kill the process which ran the browser binary.
          This means that, on future Puppeteer launches, Puppeteer might not be able to launch the browser.
          Please check your open processes and ensure that the browser processes that Puppeteer launched have been killed.
          If you think this is a bug, please report it on the Puppeteer issue tracker.
          Error cause: Error: kill EACCES
          at ChildProcess.kill (internal/child_process.js:492:26)
          at BrowserRunner.kill (/home/yhatt/.npm/_npx/12762/lib/node_modules/@marp-team/marp-cli/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserRunner.js:149:27)
          at ChromeLauncher.launch (/home/yhatt/.npm/_npx/12762/lib/node_modules/@marp-team/marp-cli/node_modules/puppeteer-core/lib/cjs/puppeteer/node/Launcher.js:111:20))

The originally reported error message shows that Puppeteer cannot close the process but it's actually not the root cause. Error: read ECONNRESET has thrown internally because unexpected closing of connection to Chromium was brought by some reason.

@yhatt
Copy link
Member

yhatt commented Sep 16, 2020

I found out the root of this issue. AppArmor profile prohibits classic snap (VS Code) from inheriting file descriptors (in Puppeteer).
https://bugs.launchpad.net/ubuntu/+source/snapd/+bug/1849753

@zhelnio It's probably insecure but CHROME_PATH="/snap/chromium/current/usr/lib/chromium-browser/chrome" marp would maybe help you.

@yhatt
Copy link
Member

yhatt commented Jun 10, 2021

Update: canonical/snapd#10029 may fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
upstream Caused in upstream, not in this repo
Projects
None yet
Development

No branches or pull requests

2 participants