Unexpected error while processing request: An operation was attempted on something that is not a socket.

Added by Ivan Cenov almost 5 years ago

My system: Redmine 2.6.1, many plugins, thin 1.6.3

Sometimes our Redmine hangs up and should be restarted. While investigating this, I found following message that I have never seen before:

Unexpected error while processing request: An operation was attempted on something that is not a socket.

What does it mean? Where do I have to search for the causes of this message?

Full error log is here:

Unexpected error while processing request: An operation was attempted on something that is not a socket. - E:/data/redmi
ne/public/plugin_assets/wiking/javascripts/wiking.js
        c:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib/rack/file.rb:121:in `read'
        c:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib/rack/file.rb:121:in `block in each'
        c:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib/rack/file.rb:117:in `open'
        c:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib/rack/file.rb:117:in `each'
        c:/Ruby193/lib/ruby/gems/1.9.1/gems/thin-1.6.3/lib/thin/response.rb:96:in `each'
        c:/Ruby193/lib/ruby/gems/1.9.1/gems/thin-1.6.3/lib/thin/connection.rb:114:in `post_process'
        c:/Ruby193/lib/ruby/gems/1.9.1/gems/thin-1.6.3/lib/thin/connection.rb:53:in `process'
        c:/Ruby193/lib/ruby/gems/1.9.1/gems/thin-1.6.3/lib/thin/connection.rb:39:in `receive_data'
        c:/Ruby193/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.4/lib/eventmachine.rb:187:in `run_machine'
        c:/Ruby193/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.4/lib/eventmachine.rb:187:in `run'
        c:/Ruby193/lib/ruby/gems/1.9.1/gems/thin-1.6.3/lib/thin/backends/base.rb:73:in `start'
        c:/Ruby193/lib/ruby/gems/1.9.1/gems/thin-1.6.3/lib/thin/server.rb:162:in `start'
        c:/Ruby193/lib/ruby/gems/1.9.1/gems/thin-1.6.3/lib/thin/controllers/controller.rb:87:in `start'
        c:/Ruby193/lib/ruby/gems/1.9.1/gems/thin-1.6.3/lib/thin/runner.rb:200:in `run_command'
        c:/Ruby193/lib/ruby/gems/1.9.1/gems/thin-1.6.3/lib/thin/runner.rb:156:in `run!'
        c:/Ruby193/lib/ruby/gems/1.9.1/gems/thin-1.6.3/bin/thin:6:in `<top (required)>'
        c:/Ruby193/bin/thin:23:in `load'
        c:/Ruby193/bin/thin:23:in `<main>'

Also in the logfile I found (after the browser showed "Internal Error"):

Errno::ENOTSOCK (An operation was attempted on something that is not a socket. - E:/data/redmine/app/views/welcome/index.html.erb):
  config/initializers/10-patches.rb:51:in `block in find_all'
  config/initializers/10-patches.rb:46:in `find_all'

Replies (11)

RE: Unexpected error while processing request: An operation was attempted on something that is not a socket. - Added by Ivan Cenov almost 5 years ago

More about the environment

Environment:
  Redmine version                2.6.1.stable
  Ruby version                   1.9.3-p194 (2012-04-20) [i386-mingw32]
  Rails version                  3.2.21
  Environment                    production
  Database adapter               Mysql2
SCM:
  Subversion                     1.8.11
  Filesystem                     
Redmine plugins:
  clipboard_image_paste          1.9
  projects_tree_view             0.0.8
  redmine_checklists             3.0.2
  redmine_code_review            0.6.4
  redmine_didyoumean             1.2.0
  redmine_favourite_projects     0.7
  redmine_issue_detailed_tabs_time 0.1.0
  redmine_issue_templates        0.0.9
  redmine_lightbox2              0.1.1
  redmine_local_avatars          0.1.1
  redmine_pastebin               0.2.0
  redmine_plugin_views_revisions 0.0.1
  redmine_theme_changer          0.1.0
  redmine_user_issues            0.0.2
  redmine_wiki_gchart_formula    0.0.5
  redmine_xls_export             0.2.1
  redmine_youtube                0.0.1
  sidebar_hide                   0.0.6
  wiking                         1.0.0b

RE: Unexpected error while processing request: An operation was attempted on something that is not a socket. - Added by Ivan Cenov almost 5 years ago

Errno::ENOTSOCK (An operation was attempted on something that is not a socket. - E:/data/redmine/app/views/wiki/history.html.erb):
  config/initializers/10-patches.rb:51:in `block in find_all'
  config/initializers/10-patches.rb:46:in `find_all'

RE: Replacing thin might be a solution - Added by Andreas Deininger almost 5 years ago

I was confronted with more or less similar error message(s) after upgrading my redmine instances to version 2.6.1.
I decided to replace thin with the latest release of puma and haven't had any problems since then.
Maybe this is a solution for you, too. Good luck!

RE: Unexpected error while processing request: An operation was attempted on something that is not a socket. - Added by Ivan Cenov almost 5 years ago

I resolved this with a little help from the eventmachine author:

you can use this in a Gemfile:
gem 'eventmachine', :github => 'eventmachine/eventmachine', :ref => 'b7d9ef8'

If you have installed eventmachine 1.0.4 (potentially bad one), do not uninstall it. Let it stay at its place. This is so bebecause patched version in github is the same 1.0.4 version. In my case (Windows NT server) I added
gem 'eventmachine', :git => 'https://github.com/eventmachine/eventmachine', :ref => 'b7d9ef8'
in my Gemfile.local file.

May this help you.

RE: Replacing thin might be a solution - Added by Ivan Cenov almost 5 years ago

Andreas Deininger wrote:

I was confronted with more or less similar error message(s) after upgrading my Redmine instances to version 2.6.1.
I decided to replace thin with the latest release of puma and haven't had any problems since then.
Maybe this is a solution for you, too. Good luck!

Yes, I prefer puma, but since some time in the past it refused to install and I switched to thin without investigating the problem.

RE: Unexpected error while processing request: An operation was attempted on something that is not a socket. - Added by Ivan Cenov almost 5 years ago

In fact, the problem is:

E:\data\redmine>gem install puma
Fetching: puma-2.11.0.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing puma:
        ERROR: Failed to build gem native extension.

        c:/Ruby193/bin/ruby.exe extconf.rb
checking for BIO_read() in -lcrypto... no
checking for BIO_read() in -llibeay32... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

RE: Unexpected error while processing request: An operation was attempted on something that is not a socket. - Added by Ivan Cenov almost 5 years ago

Thanks, the installation succeeded!

D:\apps\redmine_svn>gem install puma -- --with-opt-dir=d:\openssl
Building native extensions with: '--with-opt-dir=d:\openssl'
This could take a while...
Successfully installed puma-2.11.0
Installing ri documentation for puma-2.11.0
1 gem installed

RE: Unexpected error while processing request: An operation was attempted on something that is not a socket. - Added by Alan Liu almost 5 years ago

How to run puma for sub-path (/redmine) with additional parameter like 'thin' (--prefix /redmine)?

RE: Unexpected error while processing request: An operation was attempted on something that is not a socket. - Added by Alan Liu over 4 years ago

Revise config.ru as

map '/redmine' do
    run RedmineApp::Application
end

(1-11/11)