A partial archive of https://discourse-mediawiki.wmflabs.org as of Saturday May 21, 2022.

Debugging Parsoid using Google Chrome Developer Tools

Osnard

Does anybody have experience with using the Google Chrome Developer Tools to debug Parsoid? I’ve tried by starting Parsoid with node --debug-brk bin/server.js and then connecting the Developer Tools. The debugger stopped at the application entrypoint and I was able to step through the first invoked source code file. But when I add additional breakpoints in other source code files, they are never reached. I believe the reason for this is, that VisualEditor can not communicate with Parsoid anymore (curl error: 7) once it is connected to the debugger. Any hint on this? How do the core developers debug?

cscott

Typically I use the chrome dev tools to debug the command-cli CLI (bin/parse.js and friends), not the server itself. But there seem to be tips for your exact use case in https://www.mediawiki.org/wiki/Parsoid/Debugging#Stepping_through_the_ParsoidService.js

Probably we should make this wiki page easier to find! Suggestions/edits welcome.

Osnard

Thanks for the hint!

Osnard

Using node --inspect-brk bin/server.js -n 0 did not work :frowning:. Debugger connects on the entrypoint but no breakpoint in other source files is reached. But at least VisualEditor can talk to Parsoid again (no curl error: 7), so I guess I am on the right track.

cscott

Arlo: this is probably due to the fork mechanism in service-runner? Is there an option like --useWorker=false that works for service-runner?

cscott

Arlo replied via email, but it appears not to have been mirrored here. He said:

| Is there an option like --useWorker=false that works for service-runner?
Yup, use --config and set things there.

num_workers: 0
services:
  - module: lib/index.js
    entrypoint: apiServiceWorker
    conf:
        useWorker: false
        ...
Arlolra

Yup, use --config and set things there.

num_workers: 0
services:
 - module: lib/index.js
   entrypoint: apiServiceWorker
   conf:
	useWorker: false
       ...