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

Nginx not start #68

Closed
exileed opened this issue Apr 8, 2016 · 58 comments
Closed

Nginx not start #68

exileed opened this issue Apr 8, 2016 · 58 comments
Labels

Comments

@exileed
Copy link

exileed commented Apr 8, 2016

2016/04/08 11:34:44 [emerg] 10843#0: setsockopt(IPV6_V6ONLY) [::]:80 failed, ignored (22: Invalid argument) 2016/04/08 11:34:44 [emerg] 10843#0: bind() to [::]:80 failed (22: Invalid argument)

@deyvisonrocha
Copy link

If you comment the second line of listen works. But, not work on Windows accessing the localhost:. =/

@hungys
Copy link

hungys commented Apr 10, 2016

Same here. I guess the IPv6 is not fully implemented.
However, after commenting out the IPv6 config in /etc/nginx/sites-available/default, I got another error:

2016/04/10 18:03:54 [emerg] 594#0: setsockopt(IPV6_V6ONLY) [::]:80 failed, ignored (22: Invalid argument)
2016/04/10 18:03:54 [emerg] 594#0: bind() to [::]:80 failed (22: Invalid argument)
2016/04/10 18:06:52 [alert] 661#0: ioctl(FIONBIO) failed while spawning "worker process" (22: Invalid argument)
2016/04/10 18:06:52 [alert] 661#0: ioctl(FIONBIO) failed while spawning "worker process" (22: Invalid argument)
2016/04/10 18:06:52 [alert] 661#0: ioctl(FIONBIO) failed while spawning "worker process" (22: Invalid argument)
2016/04/10 18:06:52 [alert] 661#0: ioctl(FIONBIO) failed while spawning "worker process" (22: Invalid argument)

@sunilmut
Copy link
Member

Can confirm from our side that the socket option IPPROTO_IPV6\IPV6_V6ONLY is not yet implemented. We have opened a bug on our side to track this. No ETA at this time.

@luisfavila
Copy link

@sunilmut What about accessing nginx from Windows? I've got it running, but http://localhost won't work.

@sunilmut
Copy link
Member

@luisfavila If the nginx server is listening on the port, then you should be able to connect from Windows. 'netstat' is probably currently broken on WSL. Can you try 'netstat' on Windows to see if anyone is listening on the server port? If nginx is listening on the server port, you can also check your firewall settings (or disable it) to see if that makes any difference?

@luisfavila
Copy link

@sunilmut Actually, nginx wasn't started at all. It did not show any error when starting, but reading logs it was due to IPV6, which is disabled now. It won't start anyway, though, showing the following error:
ioctl(FIONBIO) failed while spawning "worker process" (22: Invalid argument)
Apache2 seems to work, while presenting the following warning (after disabling IPv6, with IPv6 enabled will show one more warning):
Invalid argument: AH00076: Failed to enable APR_TCP_DEFER_ACCEPT

@sunilmut
Copy link
Member

@luisfavila Regarding "ioctl(FIONBIO)" error, do you know on which file it is calling that IOCTL?

@sunilmut
Copy link
Member

@luisfavila - Also, glad to know that you got apache to work. We are working on getting support for IPV6_V6ONLY. Hopefully, you should see that light up soon.

@afridlund85
Copy link

@luisfavila did you get apache to work? I get ipv6 errors but I didn't manage to disable it, all guides on how to disable ipv6 on ubuntu refered to config files that did not exists or didn't change anything when edited. How did you disable ipv6?

@luisfavila
Copy link

@afridlund85 Edited /etc/apache2/ports.conf and changed Listen 80 to Listen 0.0.0.0:80

Regarding "ioctl(FIONBIO)" error, do you know on which file it is calling that IOCTL?

@sunilmut No idea, it doesn't tell

Also, glad to know that you got apache to work. We are working on getting support for IPV6_V6ONLY. Hopefully, you should see that light up soon.

@sunilmut Great! Looking forward to test it!

@Geeknux
Copy link

Geeknux commented Apr 17, 2016

I compile nginx without enabling IPv6 support bot it doesn't start either

i got this error:
nginx: [emerg] bind() to 0.0.0.0:80 failed (22: Invalid argument)

i compile nginx with this command:
/usr/local/nginx/sbin/nginx -V

nginx version: nginx/1.8.1
built by gcc 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.1)
configure arguments: --prefix=/usr/local/nginx --without-http_autoindex_module --without-http_userid_module --without-http_auth_basic_module --without-http_fastcgi_module --without-http_empty_gif_module --without-mail_pop3_module --without-mail_imap_module --without-mail_smtp_module

@luisfavila
Copy link

luisfavila commented Apr 17, 2016

@Geeknux Have you disabled IPv6 following my instructions? They were for Apache2; the way to do it in Nginx is different: edit the file /etc/nginx/sites-enabled/default and comment the line listen [::]:80 default_server ipv6only=on;, leaving only the listen 80 default_server; line.

@Geeknux
Copy link

Geeknux commented Apr 18, 2016

@luisfavila Yes i did that, but it didn't resolve the problem, at least not for me

Update:
it seams Skype is The problem:
Skype automatically updated itself, and turned the "use port 80" option back on.
after disabling that on skype i can start nginx without any error but it doesn't respond in any way.

@luisfavila
Copy link

@Geeknux I didn't get nginx to work either, only apache2. Nginx seemed load fine, but checking the error log in /var/log/nginx presented me ioctl(FIONBIO) failed while spawning "worker process" (22: Invalid argument) as I said above in this thread

@hungys
Copy link

hungys commented Apr 23, 2016

Still encounter the same issue on the latest build.

ioctl(FIONBIO) failed while spawning "worker process" (22: Invalid argument)

@kjhughes097
Copy link

Same issue.

Initially did not bind, so I removed the IPV6 config item. Now I'm getting the
ioctl(FIONBIO) failed while spawning 'worker process' (22: Invalid argument)
error

@sunilmut
Copy link
Member

sunilmut commented May 5, 2016

I have verified that with IPV6ONLY fix and the fix to return EADDRINUSE in bind() when a port is already in use, apache2 starts fine (although it emits a warning around APR_TCP_DEFER_ACCEPT). I was able to connect to the apache webserver port using a browser and access the default page. These fixes should show up soon in the insider builds. Thanks for trying out WSL and providing feedback!

@adityanag
Copy link

Confirmed that apache2 is working in the latest build with no need to edit any config files.

However, nginx still doesn't work. I get a slightly different error (FIOASYNC)

2016/05/12 04:07:38 [alert] 354#0: ioctl(FIOASYNC) failed while spawning "worker process" (22: Invalid argument)

@sunilmut
Copy link
Member

I took a deeper look at 'Nginx'. It first binds to an IPv4 address and then to an IPv6 address (to the same port by default) using the IPV6_V6ONLY option. Unfortunately, we are not able to support the scenario immediately and we have a bug tracking this.
As an alternative, there are couple of options as workarounds:
Edit the default configuration of Nginx to start at different ports on IPv4 and IPv6. Or, use either IPv4 or IPv6. The port configuration for Nginx is stored in '/etc/nginx/sites-enabled/default'. I was able to verify that both these workarounds work and the Nginx server starts successfully on build 14342. We know its not ideal, but at least gets your one step further.
Meanwhile, we have an understanding of the bug on our side, but unfortunately, it might take some time to fix it because of dependencies outside of WSL.

@paladox
Copy link

paladox commented May 27, 2016

@sunilmut nginx still dosent start.

Shows this error now

2016/05/27 20:06:36 [alert] 79#0: ioctl(FIOASYNC) failed while spawning "worker process" (22: Invalid argument)
2016/05/27 20:06:36 [alert] 79#0: ioctl(FIOASYNC) failed while spawning "worker process" (22: Invalid argument)
2016/05/27 20:06:36 [alert] 79#0: ioctl(FIOASYNC) failed while spawning "worker process" (22: Invalid argument)
2016/05/27 20:06:36 [alert] 79#0: ioctl(FIOASYNC) failed while spawning "worker process" (22: Invalid argument)

I'm using the latest windows 10 build insider as of today.

@roydejong
Copy link

+1, nginx is still broken even when ipv6 is disabled:

2016/05/28 16:39:56 [alert] 53#0: ioctl(FIOASYNC) failed while spawning "worker process" (22: Invalid argument)

@xyzith
Copy link

xyzith commented May 30, 2016

The windows HTTP Kernel-mode driver also block port 80.
http://flummox-engineering.blogspot.com/2015/08/apache-cannot-run-on-port-80-on-windows.html

After I disabled the HTTP Kernel-mode, I got the same error in error.log
ioctl(FIOASYNC) failed while spawning "worker process" (22: Invalid argument)

@chrisboylan
Copy link

Yes, I'm on 14352, and even after setting:
listen 8080 default_server;
listen [::]:8081 default_server;
When I curl http://localhost:8080, the request never completes, and error.log has 4 lines of:
[alert] 9832#9832: ioctl(FIOASYNC) failed while spawning "worker process" (22: Invalid argument)

@sunilmut - Can we remove the "workaround-available" tag since the workaround doesn't work?

@Heerozh
Copy link

Heerozh commented Jun 10, 2016

Add this to nginx.conf will let u able to run nginx, enough for development environment:
master_process off;
daemon off;

@wizardist
Copy link

@dumindaxsb it works indeed. I could manage to start Nginx using pretty much the same steps. But I failed to do so at port 80. Is it blocked or what?

@PeterDraex
Copy link

@wizardist It works for me on port 80. You can use netstat in powershell to find out what's blocking your 80.

@Pilskalns
Copy link

Even after long search, I have not found clear answer for choose between Unix socket and TCP when using Nginx+PHP-FPM.

  • In case of Unix socket I get nginx error:
    2016/08/19 14:21:49 [alert] 412#0: *3 connect() failed (22: Invalid argument) while connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "localhost:8080"
  • In case of TCP port it works, but /var/log/php5-fpm.log every second gets line of:
    [19-Aug-2016 14:31:50] ERROR: failed to retrieve TCP_INFO for socket: Invalid argument (22)
    This is not production, but I can't turn it off with php settings, at some point silently spamming, that file will grow huge.

My setup from clean installation:

  • /etc/nginx/nginx.conf:
    user www-data; master_process off; ... fastcgi_pass {with port or socket};
  • /etc/php5/fpm/pool.d/www.conf:
    listen.mode = 0660 listen = 127.0.0.1:9009 or listen = /var/run/php5-fpm.sock

If I spoil permissions, then error is different. What would you advise?

@sunilmut
Copy link
Member

With the help of the Windows networking team, we were able to fully implement the IPV6_V6ONLY flag. Hopefully this should resolve a bunch of issues here. The fix is still in our dev branch, but should soon hit the release branch.

@wizardist
Copy link

@dumindaxsb it works indeed. I could manage to start Nginx using pretty much the same steps. But I failed to do so at port 80. Is it blocked or what?

Just in case, Skype occupied port 80. Turning that feature of Skype off helped.

@bitcrazed
Copy link
Contributor

Should now be fixed in build 14936. Please let us know if you see this issue persist.

@hanlinking
Copy link

I still have this issue in build 14942 with Ubuntu 16.04. whatever port I want bind return error, port is in using.I try every solution above but It still not work.on the othersides, I run a dotnet core web sample and the kestrel also return could not bind the port,I have tryso many port.

@zhaorenjie110
Copy link

@hanlinking i am also 14942 with 16.04 , you can try it ,it work for me.
image

@hanlinking
Copy link

@zhaorenjie110 哥们不行啊。我这么做了之后确实没有报错了。但是windows这边还是连接不了nginx,我试了几个端口了,确定没有被使用。

@kundralaci
Copy link

I'm still facing problems with ERR_CONTENT_LENGTH_MISMATCH.

@Mocilol advised output_buffers 2 10m; but it makes no difference for me.

My two additional observations:

  • On Windows clients (Chrome) I don't get this error (strange!), only on Linux (Chrome), Android (Chrome), and iOS (Safari).
  • This error always occurs, if the requested file is > 256k. In this case, only the first 256k is received, nginx stops sending and finally timeouts (based on the send_timeout 2; value - it can be 10, 20, ... whatever value), so the browser fails with length mismatch.

I have also tested this with several nginx config files, one of them is the built-in default, and it haven't worked in any circumstances.

Win10 version: 14393.321 (1607)
nginx version: 1.10.1
Chrome version: 53.x

My questions:

  • Should I open a new issue? Since nginx starts, but won't serve files larger than 256k.
  • Does it also happen to others?
  • Does anyone know a workaround?

@aseering
Copy link
Contributor

Is this perhaps related to #610 ?

@kundralaci
Copy link

The root of the problem seems similar for me!

@magic007
Copy link

加上这2个master_process off; daemon off;,把运行方式改为TCP模式9000,确实可以运行。不过PHP页面速度太慢,还不如访问虚拟机的速度。

@misenesi
Copy link

misenesi commented Dec 7, 2016

The FIOASYNC is a duplicate of this bug bug. It is lack of support for socket async I/O notifications.

@stehufntdev
Copy link
Collaborator

After adding signal driven IO support for unix stream sockets, I was able to run nginx locally and load the default site. Also confirmed that the errors were gone from the nginx error log.

The fix should be out in insider builds soon.

@hanlinking
Copy link

@stehufntdev Can you tell me how to do for this "signal driven IO support for unix stream sockets"?

@stehufntdev
Copy link
Collaborator

@hanlinking sorry didn't quite follow your reply, could you please clarify?

By "signal driven IO support for unix stream sockets", I was referring to nginx's use of FIOASYNC with F_SETOWNER on a unix stream socket. This combination of syscalls enables SIGIO to be delivered when interesting events happen on the socket. That fix seems to have been the last thing blocking nginx's default configuration from starting and should be out in an insider build soon.

@samayo
Copy link

samayo commented Jan 27, 2017

Still having the same problem. The solution from @dumindaxsb doesn't work, since I can't restart, stop, start nginx afterwards. It just gets stuck

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests