point-source / dart_ping

Multi-platform network ping utility for Dart
30 stars 13 forks source link

More detailed ProcessException #33

Closed guyluz11 closed 1 year ago

guyluz11 commented 1 year ago

In my program, I am using a package (network_tools) that uses dart_ping.

It works when run normally under Linux. But while using it as a snaps (some kind of Linux executable that uses containers) I am getting an error from the dart_ping package.

Example

2022-09-29T17:05:13+03:00 cbj-hub.cbj-hub[41557]: Unhandled exception:
2022-09-29T17:05:13+03:00 cbj-hub.cbj-hub[41557]: ProcessException:
2022-09-29T17:05:13+03:00 cbj-hub.cbj-hub[41557]:   Command: ping -O -n -W 1 -i 1 -t 255 -c 1 192.168.31.199
2022-09-29T17:05:13+03:00 cbj-hub.cbj-hub[41557]: #0      _ProcessImpl._start (dart:io-patch/process_patch.dart:401)
2022-09-29T17:05:13+03:00 cbj-hub.cbj-hub[41557]: #1      Process.start (dart:io-patch/process_patch.dart:38)
2022-09-29T17:05:13+03:00 cbj-hub.cbj-hub[41557]: #2      BasePing.platformProcess (package:dart_ping/src/ping/base_ping.dart:71)
2022-09-29T17:05:13+03:00 cbj-hub.cbj-hub[41557]: #3      BasePing._onListen (package:dart_ping/src/ping/base_ping.dart:86)
2022-09-29T17:05:13+03:00 cbj-hub.cbj-hub[41557]: #4      _runGuarded (dart:async/stream_controller.dart:814)
2022-09-29T17:05:13+03:00 cbj-hub.cbj-hub[41557]: #5      _StreamController._subscribe.<anonymous closure> (dart:async/stream_controller.dart:692)
2022-09-29T17:05:13+03:00 cbj-hub.cbj-hub[41557]: #6      _BufferingStreamSubscription._guardCallback (dart:async/stream_impl.dart:415)
2022-09-29T17:05:13+03:00 cbj-hub.cbj-hub[41557]: #7      _StreamController._subscribe (dart:async/stream_controller.dart:691)
2022-09-29T17:05:13+03:00 cbj-hub.cbj-hub[41557]: #8      _ControllerStream._createSubscription (dart:async/stream_controller.dart:827)
2022-09-29T17:05:13+03:00 cbj-hub.cbj-hub[41557]: #9      _StreamImpl.listen (dart:async/stream_impl.dart:471)
2022-09-29T17:05:13+03:00 cbj-hub.cbj-hub[41557]: #10     _StreamIterator._initializeOrDone (dart:async/stream_impl.dart:942)
2022-09-29T17:05:13+03:00 cbj-hub.cbj-hub[41557]: #11     _StreamIterator.moveNext (dart:async/stream_impl.dart:918)
2022-09-29T17:05:13+03:00 cbj-hub.cbj-hub[41557]: #12     HostScanner._getHostFromPing (package:network_tools/src/host_scanner.dart)
2022-09-29T17:05:13+03:00 cbj-hub.cbj-hub[41557]: #13     HostScanner.getAllPingableDevices (package:network_tools/src/host_scanner.dart:41)
2022-09-29T17:05:13+03:00 cbj-hub.cbj-hub[41557]: <asynchronous suspension>
2022-09-29T17:05:13+03:00 cbj-hub.cbj-hub[41557]: #14     CompaniesConnectorConjector.searchPingableDevicesAndSetThemUpByHostName (package:cbj_hub/infrastructure/devices/companies_connector_conjector.dart:258)
2022-09-29T17:05:13+03:00 cbj-hub.cbj-hub[41557]: <asynchronous suspension>

The ProcessException is not so clear to me so I can't fix the problem.

Is there a way to have more detailed errors/ catch exceptions for pinging?

guyluz11 commented 1 year ago

I have found a way to solve my problem, it seemed that it surpassed the number of requests a container can do at the same time so I have just split it into two halves.

Errors from the ping command are getting back from the system so they suppose to be more detailed than what I received at the beginning.

So I will close this issue as the errors thrown back suppose to be detailed and most of the time are.