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

tests: Avoid timeout in slirp4netns-no-unmount.sh #235

Conversation

mbargull
Copy link
Contributor

@mbargull mbargull commented Nov 25, 2020

Cherry-picked 189e1ed .
Discussion at #234 (review) :


@mbargull:

Without this the tests (also on Ubuntu) are prolonged by 40s due to the 2 x 40 x 0.5s waiting from wait_for_network_namespace and wait_for_network_device.

@AkihiroSuda

This seems to need investigation. I don't think we should need -r here.

cc @giuseppe

@giuseppe:

the user should already have enough privileges to run these tests, why does the new user namespace make a difference?

@mbargull

I have no idea, unfortunately (not my area of expertise). I only noticed this while running the tests.
I reverted the associated commit for now.
@AkihiroSuda, @giuseppe can you open an issue to track this?
(Asking you because you can give more context than unknowledgeable me.)

Signed-off-by: Marcel Bargull <marcel.bargull@udo.edu>
@AkihiroSuda
Copy link
Member

CI seems passed without unshare -r: #234

Do we still need unshare -r?

@mbargull
Copy link
Contributor Author

mbargull commented Nov 25, 2020

nsenter --preserve-credentials -U -n --target=$1 <cmd> in the loops from

function wait_for_network_namespace {
# Wait that the namespace is ready.
COUNTER=0
while [ $COUNTER -lt 40 ]; do
if nsenter --preserve-credentials -U -n --target=$1 true; then
break
else
sleep 0.5
fi
let COUNTER=COUNTER+1
done
}
function wait_for_network_device {
# Wait that the device appears.
COUNTER=0
while [ $COUNTER -lt 40 ]; do
if nsenter --preserve-credentials -U -n --target=$1 ip addr show $2; then
break
else
sleep 0.5
fi
let COUNTER=COUNTER+1
done
}

does not finish successfully when triggered at
wait_for_network_namespace $child

and
wait_for_network_device $child tun11
.

The tests complete fine because this waiting does not affected the outcome of the test, it just delays its completion.


Your preliminary conclusion was

This seems to need investigation. I don't think we should need -r here.

which makes sense given @giuseppe's comment

the user should already have enough privileges to run these tests, why does the new user namespace make a difference?


(I'm not able to help with this investigation though, unfortunately. But do feel free to discuss and amend this PR how you see fit!)

AkihiroSuda added a commit to AkihiroSuda/slirp4netns that referenced this pull request Nov 25, 2020
`nsenter` should not be called when `unshare` was called without `-r`.

Close rootless-containers#235

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
AkihiroSuda added a commit to AkihiroSuda/slirp4netns that referenced this pull request Nov 25, 2020
Close rootless-containers#235

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
AkihiroSuda added a commit to AkihiroSuda/slirp4netns that referenced this pull request Nov 25, 2020
`nsenter` should not be called when `unshare` was called without `-r`.

Close rootless-containers#235

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
AkihiroSuda added a commit to AkihiroSuda/slirp4netns that referenced this pull request Nov 25, 2020
Close rootless-containers#235

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
AkihiroSuda added a commit to AkihiroSuda/slirp4netns that referenced this pull request Nov 25, 2020
Close rootless-containers#235

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
@AkihiroSuda
Copy link
Member

nsenter was called with -U even when unshare was called without -r, and yet the failure of nsenter was not caught in the test script.

Being fixed in #239

AkihiroSuda added a commit to AkihiroSuda/slirp4netns that referenced this pull request Nov 25, 2020
`nsenter` should not be called when `unshare` was called without `-r`.

Close rootless-containers#235

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
AkihiroSuda added a commit to AkihiroSuda/slirp4netns that referenced this pull request Nov 25, 2020
Close rootless-containers#235

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
AkihiroSuda added a commit to AkihiroSuda/slirp4netns that referenced this pull request Nov 25, 2020
`nsenter` should not be called when `unshare` was called without `-r`.

Close rootless-containers#235

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
AkihiroSuda added a commit to AkihiroSuda/slirp4netns that referenced this pull request Nov 25, 2020
Close rootless-containers#235

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
@mbargull
Copy link
Contributor Author

nsenter was called with -U even when unshare was called without -r,

Out of curiosity: Is it really the -U or the --preserve-credentials (combination?) that might be the cause.
(Sorry, if this is a silly question -- I'm just trying to understand the cause without knowing much context, really.)

and yet the failure of nsenter was not caught in the test script.

Ah, it was supposed to fail -- now all of that makes much more sense to me :).

Being fixed in #239

Thanks!

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