Closed zx9597446 closed 11 years ago
That's not rerun's issue - your previous instance did not shut down gracefully and the port is still bound. You need to either make sure it's shut down properly, and the port is released, or you need to choose a random port when you start it up.
Unfortunately this is something that rerun can't do for you.
On Fri, Jul 5, 2013 at 4:32 AM, zx9597446 notifications@github.com wrote:
sometime rerun can not continue with this problem: 2013/07/05 16:29:08 ListenAndServe: listen tcp :80: Only one usage of each socket address (protocol/network address/port) is normally permitted.
— Reply to this email directly or view it on GitHubhttps://github.com/skelterjohn/rerun/issues/6 .
I have had this issue too some times. It was caused by a panic from fsnotify, which killed rerun, but didn't kill the child process (including it's http server). Restarting rerun then failed because port 80 was in use already. @zx9597446 can you produce a more complete log of whats happening? Is rerun killed unexpectedly (panic?) or in a non-graceful way? As @skelterjohn notes: it's very likely this problem occurs because your http server wasn't stopped, and therefore port 80 is still bound.
fsnotify has some stability issues on occasion, it's true.
I'll leave this open until that's fixed.
hi, @GeertJohan sorry a little bit late. @zx9597446 can you produce a more complete log of whats happening? Is rerun killed unexpectedly (panic?) or in a non-graceful way? I don't know how to produce a more complete log, it seems rerun just complains that http.ListenAndServe error, nothing more on output, I don't know http server exit gracefully, but no panic for sure, I'm going to keep digging.
I've found a way that easy to reproduce this problem, put source in svn repos, then just run 'svn update' can reproduce. I changed source code for debug:
err := proc.Kill()
log.Println(err)
and I got these messages( by doing 'svn up' once):
E:\mycode\go\src\svr2>rerun svr2
2013/08/02 10:04:49 setting up svr2 []
2013/08/02 10:04:49 [svr2]
2013/08/02 10:04:49 init database...
2013/08/02 10:04:49 init config...
2013/08/02 10:04:49 serve websocket on /
2013/08/02 10:05:04 E:\mycode\go\src\svr2.svn
2013/08/02 10:05:04 rescanning
2013/08/02 10:05:05 E:\mycode\go\src\svr2.svn
2013/08/02 10:05:05 nil --->(this is proc.Kill() output)
2013/08/02 10:05:05 [svr2]
2013/08/02 10:05:05 rescanning
2013/08/02 10:05:05 init database...
2013/08/02 10:05:05 init config...
2013/08/02 10:05:05 serve websocket on /
2013/08/02 10:05:05 ListenAndServe: listen tcp
and BTW, can we just ignore .svn fs notifies?
This is very confusing. Put what source in svn? Rerun's? Then if it stops working that means svn did something stupid. On Aug 1, 2013 7:02 PM, "zx9597446" notifications@github.com wrote:
I've found a way that easy to reproduce this problem, put source in svn repos, then just run 'svn update' can reproduce.
— Reply to this email directly or view it on GitHubhttps://github.com/skelterjohn/rerun/issues/6#issuecomment-21982384 .
I mean put source code(my application) that rerun try to build into svn repos, then run 'svn up', rerun will rebuild and run. rerun didn't stop working, but ListenAndServe failed in my application.
this problem can be fixed by add proc.Wait() after proc.Kill() btw, how to send a pull request?
Sounds great. This might actually be an issue that I had/have rarely, but I never thought of .Wait().. So .Kill() doesnt mean that the process was dirdctly killed and so the port could still be in use according in the operating system..
To send a PR you'd have to fork rerun in the github webinterface. Clone your fork to your PC. Add the changes on your local clone. Commit the changes. Push the commit(s) to your remote (your fork on github). And issue a PR through the github webinterface. There are several more detailed guide's on this.
For go packages, it is wise to clone a repository in a gopath with the import path intact (e.g. $GOROOT/src/github.com/GeertJohan/go.linenoise ).
sometime rerun can not continue with this problem: 2013/07/05 16:29:08 ListenAndServe: listen tcp:80: Only one usage of each
socket address (protocol/network address/port) is normally permitted.