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

router: make AddLinkType acquire the DataPlane mutex #4614

Merged
merged 1 commit into from
Sep 12, 2024

Conversation

jcp19
Copy link
Contributor

@jcp19 jcp19 commented Sep 11, 2024

Fixes #4282

With this change, the implementation of AddLinkType matches that of the other setters and the comment that precedes it.

@jiceatscion
Copy link
Contributor

This change is Reviewable

@jcp19
Copy link
Contributor Author

jcp19 commented Sep 11, 2024

I am aware of the current failure, I will look into it

@jcp19 jcp19 marked this pull request as draft September 11, 2024 17:41
Copy link
Contributor

@jiceatscion jiceatscion left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @jcp19)

Copy link
Contributor

@jiceatscion jiceatscion left a comment

Choose a reason for hiding this comment

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

Thanks!

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @jcp19)

Copy link
Contributor

@jiceatscion jiceatscion left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @jcp19)

Copy link
Contributor

@jiceatscion jiceatscion left a comment

Choose a reason for hiding this comment

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

Actually, the test failure made me realize that this cannot work as-is. AddLinkType is called by AddExternalInterface, which takes the same Mutex. So we need an un-safe version of addLinkType. Since AddLinkType doesn't seem to be called from anywhere else, I wonder if we actually need an exported (and safe) version at all.

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @jcp19)

Copy link
Contributor

@jiceatscion jiceatscion left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @jcp19)


router/dataplane.go line 408 at r1 (raw file):

// be called on a not yet running dataplane.
func (d *DataPlane) AddLinkType(ifID uint16, linkTo topology.LinkType) error {
	d.mtx.Lock()

Mutex is already held by only caller.

@jcp19
Copy link
Contributor Author

jcp19 commented Sep 12, 2024

Good point. By the same token, I guess that AddNeighborIA cannot work as-is and should also be replaced by a private unsafe method

Copy link
Contributor

@jiceatscion jiceatscion left a comment

Choose a reason for hiding this comment

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

Gotta wait for Dominik's input on that one. It might be intended to support a configuration API.

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @jcp19)

Copy link
Contributor

@jiceatscion jiceatscion left a comment

Choose a reason for hiding this comment

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

Oh...wait. How come AddExternalInterface doesn't already deadlock on AddNeighborIA? Does go support recursive mutexes by default?

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @jcp19)

Copy link
Contributor

@jiceatscion jiceatscion left a comment

Choose a reason for hiding this comment

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

Nevermind.... these are different mutexes. I should read the code more carefully.

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @jcp19)

Copy link
Contributor

@jiceatscion jiceatscion left a comment

Choose a reason for hiding this comment

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

...and the same is true in the case of AddLinkType, so my initial objection was wrong. Apologies. I also don't know why the end-to-end test fails, though.

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @jcp19)

@jcp19
Copy link
Contributor Author

jcp19 commented Sep 12, 2024

...and the same is true in the case of AddLinkType, so my initial objection was wrong. Apologies. I also don't know why the end-to-end test fails, though.

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @jcp19)

No worries, I also missed the fact that they are different mutexes at first 😅

@jcp19 jcp19 marked this pull request as ready for review September 12, 2024 13:03
@jcp19
Copy link
Contributor Author

jcp19 commented Sep 12, 2024

The checks went through this time and it is unclear why. It is strange that they failed before, maybe the timeouts are too tight?

PS: similar failures were reported in runs of the CI for different PRs, so I assume that the cause of the error is independent of these changes

@jiceatscion
Copy link
Contributor

jiceatscion commented Sep 12, 2024 via email

@jiceatscion jiceatscion merged commit a9e9256 into scionproto:master Sep 12, 2024
6 checks passed
@jcp19 jcp19 deleted the fix-4282 branch September 12, 2024 17:49
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.

router: AddLinkType does not acquire the DataPlane mutex
2 participants