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

missing error messages from stderr #158

Open
wonderfulShrineMaidenOfParadise opened this issue Mar 8, 2023 · 10 comments
Open

missing error messages from stderr #158

wonderfulShrineMaidenOfParadise opened this issue Mar 8, 2023 · 10 comments

Comments

@wonderfulShrineMaidenOfParadise
Copy link

wonderfulShrineMaidenOfParadise commented Mar 8, 2023

Reproduction steps

Ping something which returns errors.

Expected behavior

Messages from stderr are included in the responses.

{
  inputHost: 'p.p',
  host: 'unknown',
  alive: false,
  output: 'ping: permission denied (are you root?)\n',
  time: 'unknown',
  times: [],
  min: 'unknown',
  max: 'unknown',
  avg: 'unknown',
  stddev: 'unknown',
  packetLoss: 'unknown'
}
{
  inputHost: '1.1.1.1',
  host: '1.1.1.1',
  alive: false,
  output: 'PING 1.1.1.1 (1.1.1.1): 56 data bytes\nping: permission denied (are you root?)\n',
  time: 'unknown',
  times: [],
  min: 'unknown',
  max: 'unknown',
  avg: 'unknown',
  stddev: 'unknown',
  packetLoss: 'unknown',
  numeric_host: '1.1.1.1)'
}

Actual Behavior

The responses don't have messages from stderr included.

Relevant issue: louislam/uptime-kuma#2896

{
  inputHost: 'p.p',
  host: 'unknown',
  alive: false,
  output: '',
  time: 'unknown',
  times: [],
  min: 'unknown',
  max: 'unknown',
  avg: 'unknown',
  stddev: 'unknown',
  packetLoss: 'unknown'
}
{
  inputHost: '1.1.1.1',
  host: '1.1.1.1',
  alive: false,
  output: 'PING 1.1.1.1 (1.1.1.1): 56 data bytes\n',
  time: 'unknown',
  times: [],
  min: 'unknown',
  max: 'unknown',
  avg: 'unknown',
  stddev: 'unknown',
  packetLoss: 'unknown',
  numeric_host: '1.1.1.1)'
}

Operating System and Arch

Alpine 3.17 armv7

Ping

BusyBox v1.35.0

NodeJS Version

18.14.2

@mondwan
Copy link
Collaborator

mondwan commented Mar 8, 2023

Hello, errors reported here are too generic. Please include how you run the library, actual responses, and expected responses.

As mentioned in louislam/uptime-kuma/issues/2896, please also include how your system behaved while running the system ping if you believed the errors are coming from the system instead.

@wonderfulShrineMaidenOfParadise
Copy link
Author

wonderfulShrineMaidenOfParadise commented Mar 9, 2023

I updated the thread with outputs. We can know that output is empty if there is nothing in stdout. We should also include stderr for more info for debugging issues.

@mondwan
Copy link
Collaborator

mondwan commented Mar 11, 2023

Hopefully, #159 should resolve this bug

@mondwan
Copy link
Collaborator

mondwan commented Mar 11, 2023

Try release 0.4.4

@wonderfulShrineMaidenOfParadise
Copy link
Author

{
  inputHost: 'p.p',
  host: 'bad',
  alive: false,
  output: "ping: bad address 'p.p'\n",
  time: 'unknown',
  times: [],
  min: 'unknown',
  max: 'unknown',
  avg: 'unknown',
  stddev: 'unknown',
  packetLoss: 'unknown',
  numeric_host: 'ddres'
}
{
  inputHost: '1.1.1.1',
  host: '1.1.1.1',
  alive: false,
  output: 'PING 1.1.1.1 (1.1.1.1): 56 data bytes\n' +
    'ping: permission denied (are you root?)\n',
  time: 'unknown',
  times: [],
  min: 'unknown',
  max: 'unknown',
  avg: 'unknown',
  stddev: 'unknown',
  packetLoss: 'unknown',
  numeric_host: '1.1.1.1)'
}

Thank you for fixing!

@mondwan
Copy link
Collaborator

mondwan commented Mar 12, 2023 via email

@wonderfulShrineMaidenOfParadise
Copy link
Author

Can you also show me the value of "os.platform()"?

linux. I don't really understand. Do you need to know something specific?

@mondwan
Copy link
Collaborator

mondwan commented Mar 13, 2023

I mean I would like to know the value from the module in node js os.platform().

In your captured sample, the value of the field numeric_host is 1.1.1.1), the ending bracket is something unexpected. Hopefully, we can fix this buggy value by picking a correct parser in the first place

Given that the format of ping's output depends on the underlying platform, there are 3 kinds of parsers in this library: MAC / LINUX / WINDOW. This library will pick the corresponding parser depends on the value from os.platform().

The problematic numeric_host value can be resolved as long as a MAC based parser being picked. That's why I would like to know the value of os.platform() for your underlying system. Then, I can fix the factory accordingly.

@mondwan
Copy link
Collaborator

mondwan commented Mar 13, 2023

Otherwise, I need to fix the linux parser accordingly. lol

@wonderfulShrineMaidenOfParadise
Copy link
Author

wonderfulShrineMaidenOfParadise commented Mar 13, 2023

Yes os.platform() returns linux and it seems to be correct.

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

No branches or pull requests

2 participants