Skip to content

Conversation

@olethanh
Copy link
Collaborator

JIRA: ALEPH-115

Problem:
When reusing an existing stale network interface, the following error would occasionally occur:

Unknown exception while deleting address 2a01:4f8:171:787:1:63fa:f8b5:db10/124 to interface vmtap...

See details in Sentry: https://alephim.sentry.io/issues/5993120643/?project=4506303231819776

Analysis:
This error occurred during the process of cleaning up an old interface (that was not deleted after usage for various possible reasons). The code was attempting to delete the IP addresses associated with this interface (as calculated in the code). However, when these IP addresses did not exist, an error was raised.

Solution:
Our initial approach was to use the IPRoute module to list the IP addresses associated with the network interface and then delete them instead of calculating their names in the Python code as is done presently.

After experimentation, we determined that deleting the interface directly also removes the associated IP addresses. Therefore, it is unnecessary to delete them manually, which simplifies the code.

To test:
Create and stop Program
Create network interface

sudo ip tuntap add dev vmtap4 mode tap

and attach ip to them

sudo ip addr add 1.1.1.1/30 dev  vmtap4

Try different combinaison and validate that everything still work correctly

To check the networks interfaces use the following command to list them

sudo ip link

and to list the ip address use:

sudo ip addr

@codecov
Copy link

codecov bot commented Dec 16, 2024

Codecov Report

Attention: Patch coverage is 20.00000% with 8 lines in your changes missing coverage. Please review.

Project coverage is 62.38%. Comparing base (db356af) to head (2540724).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
src/aleph/vm/network/interfaces.py 20.00% 7 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #731      +/-   ##
==========================================
- Coverage   62.49%   62.38%   -0.11%     
==========================================
  Files          70       70              
  Lines        6231     6235       +4     
  Branches      506      507       +1     
==========================================
- Hits         3894     3890       -4     
- Misses       2179     2187       +8     
  Partials      158      158              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

JIRA: ALEPH-115

**Problem**:
When reusing an existing stale network interface, the following error would occasionally occur:

```
Unknown exception while deleting address 2a01:4f8:171:787:1:63fa:f8b5:db10/124 to interface vmtap...
```

See details in Sentry: [https://alephim.sentry.io/issues/5993120643/?project=4506303231819776](https://alephim.sentry.io/issues/5993120643/?project=4506303231819776)

**Analysis**:
This error occurred during the process of cleaning up an old interface (that was not deleted after usage for various possible reasons). The code was attempting to delete the IP addresses associated with this interface (as calculated in the code). However, when these IP addresses did not exist, an error was raised.

**Solution**:
Our initial approach was to use the `IPRoute` module to list the IP addresses associated with the network interface and then delete them instead of calculating their names in the Python code as is done presently.

After experimentation, we determined that deleting the interface directly also removes the associated IP addresses. Therefore, it is unnecessary to delete them manually, which simplifies the code.

**To test**:
Create and stop Program
Create network interface
```bash
sudo ip tuntap add dev vmtap4 mode tap
```
and attach ip to them
```bash
sudo ip addr add 1.1.1.1/30 dev  vmtap4
```

Try different combinaison and validate that everything still work
correctly

To check the networks interfaces use the following command to list them
```bash
sudo ip link
```

and to list the ip address use:
```
sudo ip addr
```
mainly to improve code coverage
@olethanh olethanh force-pushed the ol-ALEPH-115-interface-deletion-error branch from 5340348 to 67101e1 Compare December 16, 2024 11:58
Copy link
Member

@nesitor nesitor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We cannot remove that method because it is needed to avoid having different interfaces with the same IP addresses. Instead, we need to handle the error or maybe ensure that the interface have the address before trying to delete it.

@olethanh
Copy link
Collaborator Author

After discussion with @nesitor he told me he had to add the ip deleting code a while back to fix some corner cases issue.

Thus I modified the PR to instead list all the ip linked to the interface and delete them, which will prevent trying to delete inexsiting addresses.

@olethanh olethanh requested a review from nesitor December 16, 2024 13:10
@olethanh olethanh merged commit 2ef3b89 into main Dec 16, 2024
20 of 22 checks passed
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

Successfully merging this pull request may close these issues.

2 participants