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

Reclaim TCP connection of dead HTTP Fetches #5

Open
philpennock opened this issue Jan 20, 2013 · 1 comment
Open

Reclaim TCP connection of dead HTTP Fetches #5

philpennock opened this issue Jan 20, 2013 · 1 comment
Assignees

Comments

@philpennock
Copy link
Owner

In resolving issue #3 I used a timeout to early-return and avoid waiting forever on a TCP connection that's dead. Unfortunately, that still leaves the TCP connection held in a stale go-routine.

Either find a way to kill the go-routine and drop things that way, or use exec.Command() on BSDs to invoke sudo tcpdrop and write a sudo rule to permit this, and figure out a way to make that secure against arbitrary drops (small races probably acceptable).

@ghost ghost assigned philpennock Jan 20, 2013
@philpennock
Copy link
Owner Author

Responding to Dave Cheney on golang-nuts, I realised that it'll be cleaner and safer to use

exec.Command("sudo", "tcpdrop-port-11371", strconv.Itoa(os.Getpid()))

and have tcpdrop-port-11371 be a script which invokes lsof on the pid provided, checks that it's owned by the SKS runtime user, look for remote connections on port 11371 and then invoke tcpdrop on each of those.

Of course, that would kill all outstanding connections, so either give it two parameters, second being a particular IP, or just flag that this will be needed, and later if the flag is set after spidering is complete, then invoke the script and clean them all at once.

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

No branches or pull requests

1 participant