question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ping result not returned for some unreachable hosts

See original GitHub issue
from ping3 import ping
res = ping('10.128.20.30')
print(res)

The code hang there for a very long time and never returns, even I set timeout and count to 2. But when I try shell command ping it can return results:

[root@host~]# ping -c 2 10.128.20.30
PING 10.228.94.234 (10.128.20.30) 56(84) bytes of data.

--- 10.128.20.30 ping statistics ---
2 packets transmitted, 0 received, 100% packet loss, time 40ms

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
kyan001commented, Jan 10, 2020

Hi all,

I think I just fixed this problem. This bug is not related to platform, and I finally reproduced it. This bug occurs when there are a lot of packets passed to your network interface in a short time and in the meantime the pinging destination address timeouts.

Thanks a lot for your helps. Please try the new version (>= 2.4.4) and tell me if this bug is fixed.

3reactions
dorty3541commented, Jan 2, 2020

Hi @Rocking80

As I run some tests on my PC, I cannot reproduce that “long hang with no returns”. If you can send the test code with your OS/version info that would be helpful. Also, you can try to run the same code with ping3.DEBUG = True, to see if there any useful output exists.

Since different platforms do different implementations of networks, and I cannot cover all of them. That’s why your feedback is important to me. Thanks.

Hi,kyan001 I have the same issue,e.g:

[root@host-192-168-23-115 mysqld]# python3
Python 3.7.1 (default, Dec 20 2018, 13:50:48)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from ping3 import ping
>>> res=ping('192.168.79.221')
^F^Z
[1]+  已停止               python3
您在 /var/spool/mail/root 中有邮件
[root@host-192-168-23-115 mysqld]# ping -c 2 192.168.79.221
PING 192.168.79.221 (192.168.79.221) 56(84) bytes of data.

--- 192.168.79.221 ping statistics ---
2 packets transmitted, 0 received, 100% packet loss, time 1000ms

[root@host-192-168-23-115 mysqld]#

OS:CentOS Linux release 7.2.1511 (Core) 3.10.0-327.el7.x86_64 Python:3.7.1

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Solve a Destination Host Unreachable Error - Lifewire
Destination host unreachable errors are often caused by a misaligned gateway due to poor internet or cable connections.
Read more >
Linksys Official Support - Learning about Ping test
Destination Network / Host unreachable – This means that the host that you are trying to ping is down or is not operating...
Read more >
FIX: Ping destination host unreachable but no packet loss
Destination Host Unreachable – this error occurs whenever there's no route between the local system and the destination; Reply from x.x.x.x: ...
Read more >
No reply for ping command. What does this mean? - Super User
It means that your ICMP packet (ping) was silently discarded with no response sent. That might happen for several ...
Read more >
How can ping know if my host is down - Server Fault
When you get a Reply From [IP address]: 'Destination Host Unreachable,' then the problem occurred at/after a remote router, whose address is ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found