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

Error in parsing output from probe-cli #1384

Closed
sarathms opened this issue Mar 10, 2021 · 2 comments
Closed

Error in parsing output from probe-cli #1384

sarathms opened this issue Mar 10, 2021 · 2 comments

Comments

@sarathms
Copy link

Describe the bug
Sometimes, when probe-desktop reads the output from running ooniprobe run <test> --batch as a ReadableStream, the on('data') event handler receives non-JSON data. In this case, it was this error message:

2021/03/10 12:18:22 failed to sufficiently increase receive buffer size (was: 208 kiB, wanted: 2048 kiB, got: 416 kiB). See https://github.com/lucas-clemente/quic-go/wiki/UDP-Receive-Buffer-Size for details.

It seems to swallow a small amount of data that would otherwise be shown in the UI when the test is running. This doesn't happen when it is run directly from the terminal with/without the --batch flag.

To Reproduce
This sample code can reproduce the bug. Although it happens intermittently.

const { spawn } = require('child_process')
const split2 = require('split2')

const pathToOONI = '/usr/bin/ooniprobe'

const cli = spawn(pathToOONI, ['--batch', 'run', 'middlebox'], { stdio: ['pipe', 'pipe', 'pipe'] })

cli.stderr.pipe(split2()).on('data', line => {
  try {
    console.log(`line: ${line.toString('utf8')}`)
    const msg = JSON.parse(line.toString('utf8'))
    // console.log('msg: ', msg)
  } catch (e) {
    console.error(e)
  }
})

Expected behavior
Errors are expected on stdout in batch mode where we do not attempt to JSON.parse the content.

System information (please complete the following information):

  • OS: Linux
  • Version: probe-cli 3.7.0
@bassosimone
Copy link
Contributor

This is intermittent because it depends on which resolver is selected. We see this warning only when http3 is used. We are now using http3 to reach some dns-over-https resolvers. The right fix to me seems to use stdout for JSON messages and stderr for everything else that is not related to messages. I can confirm by manually running a test program that the error you are talking about is emitted by a dependency and is indeed emitted onto the standard error. So, I'll just change ooniprobe to emit JSON on the stdout.

bassosimone added a commit to ooni/probe-cli that referenced this issue Mar 24, 2021
Rationale explained in detail in a documentation comment.

Reference issue: ooni/probe#1384.
bassosimone added a commit to ooni/probe-cli that referenced this issue Mar 24, 2021
Rationale explained in detail in a documentation comment.

Reference issue: ooni/probe#1384.
@bassosimone
Copy link
Contributor

All done!

ainghazal pushed a commit to ainghazal/probe-cli that referenced this issue Mar 8, 2022
Rationale explained in detail in a documentation comment.

Reference issue: ooni/probe#1384.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants