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

On local server start error says the port is already in use #740

Closed
thesillystudent opened this issue Aug 3, 2016 · 9 comments
Closed
Assignees

Comments

@thesillystudent
Copy link

thesillystudent commented Aug 3, 2016

  • While restarting the Django development server the error comes up which says that the port is already in use
  • Server should restart normally as it does on cmd
  • Server doesn't restart
  • Windows build number - 14393.10

capture

@misenesi
Copy link

misenesi commented Aug 3, 2016

When you run in another cmd.exe:

netstat -anb

Do you see the port being occupied? If you run in bash:

lsof -i :8000

Can you see who is using that port?

@dvlsg
Copy link

dvlsg commented Aug 3, 2016

I also have this issue, but with redis. lsof -i :6379 doesn't report that anything is already using the port. netstat -anb from cmd.exe confirms the same.

Output from running a newly built redis-server (with default configuration) states:
Creating server TCP listening socket *:6379: bind: Address already in use

Same OS build number (14393.10), Windows 10 x64 Anniversary Update.

@misenesi
Copy link

misenesi commented Aug 3, 2016

Could you provide repro steps along with strace please, so I can look more into it?

More here:
https://github.com/Microsoft/BashOnWindows/blob/master/CONTRIBUTING.md

@misenesi misenesi self-assigned this Aug 3, 2016
@dvlsg
Copy link

dvlsg commented Aug 3, 2016

Of course! I can open a separate ticket if you think the issues are unrelated.

Here is the gist containing the strace created with strace redis-server &> redis-server-strace.txt

https://gist.github.com/dvlsg/6232d2adde9971a3479c848ce5b2704b

And here are the steps I used to install redis (taken from their website, and slightly modified to get around some issues I ran into). So to reproduce, from start to finish:

wget http://download.redis.io/redis-stable.tar.gz
tar xvzf redis-stable.tar.gz
cd redis-stable/deps
# i had to first make each dep manually, for some reason.
make geohash-int hiredis jemalloc linenoise lua
cd ..
make
cd src
redis-server

Here's the console output from redis-server, at that point:

6878:C 03 Aug 11:55:46.998 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
6878:M 03 Aug 11:55:46.999 * Increased maximum number of open files to 10032 (it was originally set to 2048).
6878:M 03 Aug 11:55:46.999 # Creating Server TCP listening socket *:6379: bind: Address already in use

And just to reconfirm, the following two commands result in empty outputs (I also looked through the netstat by hand, just in case I was misremembering how findstr worked);

netstat -anb | findstr 6379
lsof -i :6379

@ghost ghost mentioned this issue Aug 6, 2016
@mmalek06
Copy link

mmalek06 commented Sep 2, 2016

Any info on what's the expected time of fix release? I'm experiencing the same exact issue as the guys.

@sunilmut
Copy link
Member

sunilmut commented Sep 2, 2016

This looks related to #996. Essentially, the problem is lack of full support for IPV6_V6ONLY. See #996 for detailed analysis. Apologize for the inconvinience. We are actively working with the Windows networking team to address this issue and expect it to be fixed shortly. But as a workaround, you can try using only IPV4 or different ports for IPV4 and IPV6.

From the trace shared by @dvlsg
setsockopt(4, SOL_IPV6, **IPV6_V6ONLY**, [1], 4) = 0 setsockopt(4, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0 bind(4, {sa_family=AF_INET6, sin6_port=**htons(6379),** inet_pton(AF_INET6, "::", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, 28) = 0 socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 5 setsockopt(5, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0 bind(5, {sa_family=AF_INET, sin_port=**htons(6379**), sin_addr=inet_addr("0.0.0.0")}, 16) = -1 EADDRINUSE (Address already in use)

@sunilmut
Copy link
Member

With the help of the Windows networking team, we were able to fully implement the IPV6_V6ONLY flag. I was able to get the redis-server up and running by following the repro about by @dvlsg. The fix is still in our dev branch, but should soon hit the release branch.

@sunilmut
Copy link
Member

Just FYI that the IPV6_V6ONLY issue is fixed in 14936 (see release notes)

@sunilmut sunilmut added fixed and removed fixinbound labels Sep 29, 2016
@sunilmut
Copy link
Member

Closing this out. If this is still failing for people in 14942+, do let us know.

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

5 participants