Skip to content

Commit

Permalink
Problem: ping: invalid value (2.0' near .0') (#688)
Browse files Browse the repository at this point in the history
Symptoms:
Could not allocate a VM on some ubuntu server because the
wait_for_init/ping
was failing

```
2024-09-03 12:18:47,259 | DEBUG | command: ping -c 1 -W 2.0 172.16.4.2
2024-09-03 12:18:47,259 | ERROR | Command failed with error code 1:
    stdin = None
    command = ['ping', '-c', '1', '-W', '2.0', '172.16.4.2']
    stdout = b"ping: invalid value (`2.0' near `.0')\n"
2024-09-03 12:18:47,260 | ERROR |
Traceback (most recent call last):
  File "/home/olivier/pycharm/aleph-vm/src/aleph/vm/utils/__init__.py", line 186, in ping
    await run_in_subprocess(["ping", "-c", str(packets), "-W", str(timeout), host], check=True)
  File "/home/olivier/pycharm/aleph-vm/src/aleph/vm/utils/__init__.py", line 121, in run_in_subprocess
    raise subprocess.CalledProcessError(process.returncode, str(command), stderr.decode())
subprocess.CalledProcessError: Command '['ping', '-c', '1', '-W', '2.0', '172.16.4.2']' returned non-zero exit status 1.
```

Causes:
The root cause seems to be that the ping command from the  deb package
inetutils-ping 2.5-3ubuntu4 doesn't accept a float for it's -W argument

While the ping command  from the package 'iputils-ping' which we use on
other server accept it.

Solution:
Convert the argument to a int since we didn't use the float part
This allow compatibility with both version of the binary
  • Loading branch information
olethanh authored Sep 3, 2024
1 parent 46063fb commit 91d6027
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/aleph/vm/controllers/firecracker/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ async def wait_for_init(self) -> None:
ip = ip.split("/", 1)[0]

attempts = 30
timeout_seconds = 2.0
timeout_seconds = 2

for attempt in range(attempts):
try:
Expand Down
2 changes: 1 addition & 1 deletion src/aleph/vm/controllers/qemu/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ async def wait_for_init(self) -> None:
ip = ip.split("/", 1)[0]

attempts = 30
timeout_seconds = 2.0
timeout_seconds = 2

for attempt in range(attempts):
try:
Expand Down
2 changes: 1 addition & 1 deletion src/aleph/vm/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ class HostNotFoundError(Exception):
pass


async def ping(host: str, packets: int, timeout: float):
async def ping(host: str, packets: int, timeout: int):
"""
Waits for a host to respond to a ping request.
"""
Expand Down

0 comments on commit 91d6027

Please sign in to comment.