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

OSX Teamcity tests leave nc process running #3496

Closed
whyrusleeping opened this issue Dec 9, 2016 · 9 comments
Closed

OSX Teamcity tests leave nc process running #3496

whyrusleeping opened this issue Dec 9, 2016 · 9 comments
Assignees
Labels
topic/test failure Topic test failure

Comments

@whyrusleeping
Copy link
Member

The OSX teamcity tests will occasionally all start failling because some test run failed to clean up a netcat listener (on port 5005 I think). We should figure out where/why this is happening and fix it.

@whyrusleeping whyrusleeping added the topic/test failure Topic test failure label Dec 9, 2016
@whyrusleeping
Copy link
Member Author

This appears to be in t0235:

14:     go-sleep 0.5s | nc -l 5005 > nc_out &

I'm not 100% sure, but i don't believe processes necessarily get killed if their input process dies.

@ghost
Copy link

ghost commented Dec 9, 2016

Might need -o pipefail

@whyrusleeping
Copy link
Member Author

@lgierth i don't think that would do it. The problem is that the nc process just isnt dying. setting pipefail would make just make it return non-zero when it exits if go-sleep returns a non-zero exit code.

@whyrusleeping
Copy link
Member Author

cc @chriscool and @Kubuxu

@Kubuxu
Copy link
Member

Kubuxu commented Dec 9, 2016

we can have test after it that always kills it.

but apart from that we should have teamcity run some sort of containers (docker, lxc, lxd, manual cgroups, whatever I don't care), and scrap the whole container after test is done.

@whyrusleeping
Copy link
Member Author

@Kubuxu Yeah, we should be. But i'm not aware of any containerization stuff that works on OSX. I read that docker supports osx 'natively' but i'm not sure whether or not that means the OS inside the container will still be osx.

@chriscool
Copy link
Contributor

I would suggest killing the process explicitly like this:

test_expect_success "can start nc server" '
	nc -l 5005 > nc_out &
'

test_expect_success "can make http request against nc server" '
	NC_PID=$! &&
	( ipfs cat /ipfs/Qmabcdef --api /ip4/127.0.0.1/tcp/5005 || true ) &&
	go-sleep 0.5s &&
	test_kill_repeat_10_sec $NC_PID
'

@whyrusleeping whyrusleeping added the status/ready Ready to be worked label Dec 12, 2016
@Kubuxu
Copy link
Member

Kubuxu commented Dec 16, 2016

@Kubuxu
Copy link
Member

Kubuxu commented Dec 17, 2016

This might be also general solution for those sorts of problems:

trap "exit" INT TERM
trap "kill 0" EXIT

@whyrusleeping whyrusleeping removed the status/ready Ready to be worked label Dec 21, 2016
@Kubuxu Kubuxu self-assigned this Feb 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic/test failure Topic test failure
Projects
None yet
Development

No branches or pull requests

3 participants