Repository navigation
Closed
Labels
Description
Microsoft Windows [Version 10.0.15063]
Clean installed rails 5.0.2 on Ruby 2.4.0 through rebenv 1.1.0-2-g4f8925a.
Went into a directory owned by Windows. Created a new project and started the server with rails s. The command was extremely slow to start and once it showed the following output, I made a simple GET request to localhost:3000.
/home/arsalan/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.0.2/lib/rails/app_loader.rb:40: warning: Insecure world writable dir /home/arsalan/.rbenv/versions in PATH, mode 040777
=> Booting Puma
=> Rails 5.0.2 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
Puma starting in single mode...
* Version 3.8.1 (ruby 2.4.0-p0), codename: Sassy Salamander
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://0.0.0.0:3000
Use Ctrl-C to stop
On making the GET request, the following error showed up.
2017-04-22 11:40:02 +0500: Read error: #<Errno::ENOPROTOOPT: Protocol not available - getsockopt(2)>
/home/arsalan/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/puma-3.8.1/lib/puma/server.rb:124:in `getsockopt'
/home/arsalan/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/puma-3.8.1/lib/puma/server.rb:124:in `closed_socket?'
/home/arsalan/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/puma-3.8.1/lib/puma/server.rb:563:in `handle_request'
/home/arsalan/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/puma-3.8.1/lib/puma/server.rb:425:in `process_client'
/home/arsalan/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/puma-3.8.1/lib/puma/server.rb:289:in `block in run'
/home/arsalan/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/puma-3.8.1/lib/puma/thread_pool.rb:120:in `block in spawn_thread'
I don't know if strace of this command will be useful as it keeps continuously spitting out lines at the speed of light. Never exits.
The relevant error-throwing line from puma seems to be
socket.getsockopt(Socket::SOL_TCP, Socket::TCP_INFO)Reacted by suzuki.sh, TheWhoAreYouPerson and Thomas Hauschild
Activity
ArsalanDotMe commentedon Apr 22, 2017
It looks like the TCP_INFO option on the linux getsockopt(2) is not supported at this point.
Please see: TCP Options
TCP_INFO (since Linux 2.4)
Used to collect information about this socket. The kernel
returns a struct tcp_info as defined in the file
/usr/include/linux/tcp.h. This option should not be used in
code intended to be portable.
sunilmut commentedon Apr 22, 2017
Arsalan Ahmad (@ArsalanDotMe) - Thanks for reporting the issue and the detailed information. Very helpful. Yes, we don't need the whole trace. You have already provided the relevant pieces. I can confirm that WSL currently does not implement the TCP_INFO socket option.
I have opened a task at our end to track this. Thanks again for trying WSL and providing feedback.
guenard commentedon Jun 6, 2017
Just wanted to add that I got a similar log from PHP-FPM 5.6. ~ one line per second is written in
/var/log/php5.6-fpm.log(TCP_INFO for socket: Protocol not available). Same as #2090.adamluzsi commentedon Jun 12, 2017
+1
laughloudlylovelife commentedon Jul 20, 2017
+1
sunilmut commentedon Jul 20, 2017
Can someone share clear (and if possible targeted) repro steps for this? I am looking into it right now and need that for validation.
ArsalanDotMe commentedon Jul 21, 2017
I'm happy to provide more detailed reproduction steps, but looking at the first message in the thread, what do you think is missing in detail to reproduce the error? I tried to provide exact version numbers and steps for all software involved.
sunilmut commentedon Jul 21, 2017
Arsalan Ahmad (@ArsalanDotMe) - Thanks. Yes, the first thread does provide the exact versions, but I was hoping to get exact instructions since I am not familiar with rails. That way, I can copy paste the instructions for the repro and focus on fixing the issue.
ArsalanDotMe commentedon Jul 22, 2017
The guide I followed is this one: https://gorails.com/setup/windows/10
You don't need to setup mysql or postgres, otherwise the guide is the same.
adamluzsi commentedon Jul 22, 2017
Hy Sunil Muthuswamy (@sunilmut) ,
Here is a example repo where all you need is to install and run (or if you have both ruby and bundler all you need is to start the app).
I tried to create an install script but I couldn't test it because I'm not in wsl/ubuntu now.
I met with this too and the problem is about a yet not implemented socket protocol.
I can't confirm that the bug stills on, but if you clone the repo and run it and try call it with some http requests, than you can reproduce the problem.
Marthyn commentedon Jul 26, 2017
👍
Ruby 2.2.4
Rails 4.2.7.1
Running
bundle exec unicorn -p 5001Results in
Protocol not available- setsockopt(2) (Errno::ENOPROTOOPT)bitcrazed commentedon Mar 30, 2018
Arsalan Ahmad (@ArsalanDotMe) Could you try repro'ing on a recent Insiders build? I am running build 17364, and cannot repro your scenario - all looks good to me!
I installed rvm using DigitalOcean's instructions, and then installed rails, and created a new rails templated site using
rails new ./rubytest. I then ranrails sto build & serve the site, and navigated to its URL:Please let us know if your issue persists.
therealkenc commentedon Mar 31, 2018
I think this got picked up with #393 #68. AFAIK, Rails has worked for a while (there would be more noise if it didn't). Best Sunil Muthuswamy (@sunilmut) weigh in on the status of
TCP_INFO. Caveat being, stuff is being worked around upstream, and it is hard to tell whether the surface was fixed or just dealt with. There is no mention ofTCP_INFOfor some time. Nothing in the release notes (natch).10 remaining items
maatinito commentedon Oct 20, 2018
So to resume:
Unicorn doesn't work on WSL and there are two problems:
Waiting for more support, as Unicorn is just a way to laucnh multiple rails server for performance, for the dev, I removed the dependency on Unicorn in file Gemfile, uninstall unicorn using
sudo gem uninstall unicornand everything works fine :-)WSL is very promising, very exciting so good luck guys and thanks :-)
lustremedia commentedon May 21, 2019
Unicorn is still not working for me, ruby 2.4.0 rails 4.2.8
jobs-git commentedon Dec 30, 2019
Which windows version has this been solved?
I got a way to skip the error for PHP working for 1803. Use unix socket instead of tcp https://www.nginx.com/resources/wiki/start/topics/examples/phpfcgi/ & fastcgi_buffering off
However, a proper fix to tcp should be done since other applications relies on TCP_INFO.
Morgy93 commentedon Feb 17, 2020
Any update on this one?
Seems to be the same case for symfony:
SamSaffron commentedon Feb 18, 2020
strongly recommend just closing this issue as "is fixed with WSL2, will not be fixed with WSL1"
No point carrying it around forever.
Yay295 commentedon Feb 18, 2020
It would be nice if it were fixed in WSL1 though.
sarim commentedon Jun 5, 2020
Sam (@SamSaffron) why? Did Microsoft announced WSL1 as abandoned, deprecated product already? As far as I remember when announcing WSL2, they said both wsl1 and wsl2 would be maintained. I'd like to see msft continuing to make wsl1 as complete as possible, which means implementing
TCP_INFOsomewhere in the future.Morgy93 commentedon Jun 6, 2020
You're right. In fact there are even official exceptions for using WSL 1 rather than WSL 2
But to answer the question:
sarim commentedon Jun 6, 2020
well if existing valid issue about wsl1 keep getting closed with
fixed-in-ws2tag, I don't see much hope for msft fixing wsl1 issues. Sad.jobs-git commentedon Jun 28, 2020
My hardware has driver problem with recent windows 10 releases so I am using wsl1. I hope they get it fixed there.
privatehosting commentedon Aug 24, 2020
James Guana (@jobs-git) Install Update KB4566116 for Windows 10 1909 and set wsl to version 2. Then you can continue your work.
abdulrehman3222 commentedon Feb 22, 2022
I was having a similar issue with
WSL:
1, Ruby:2.5.0, Rails:4.2.1, and Puma:3.8.0my rails s was working I was getting the following error whenever I send a Get request:
I struggle a lot for fixing that issue even I try the above solution but that didn't work either.
at last, I found a simple solution that I need to update my Pum from 3.8 to 3.12+ and it works perfectly for me.