Project

General

Profile

Actions

Bug #9697

closed

rb_sys_fail(getaddrinfo) - errno == 0 crashes ruby

Added by pskumarsrec88@gmail.com (Saravana kumar) over 10 years ago. Updated over 10 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 1.9.3p545
[ruby-core:61820]

Description

/home/deploysearch/.rvm/rubies/ruby-1.9.3-p545/lib/ruby/1.9.1/net/http.rb:763: [BUG] rb_sys_fail(getaddrinfo) - errno == 0
ruby 1.9.3p545 (2014-02-24 revision 45159) [x86_64-linux]

-- Control frame information -----------------------------------------------
c:0064 p:---- s:0279 b:0279 l:000278 d:000278 CFUNC :initialize
c:0063 p:---- s:0277 b:0277 l:000276 d:000276 CFUNC :open
c:0062 p:0029 s:0272 b:0272 l:0001b0 d:000271 BLOCK /home/deploysearch/.rvm/rubies/ruby-1.9.3-p545/lib/ruby/1.9.1/net/http.rb:763
c:0061 p:0031 s:0270 b:0270 l:000269 d:000269 METHOD /home/deploysearch/.rvm/rubies/ruby-1.9.3-p545/lib/ruby/1.9.1/timeout.rb:55
c:0060 p:0026 s:0258 b:0258 l:000257 d:000257 METHOD /home/deploysearch/.rvm/rubies/ruby-1.9.3-p545/lib/ruby/1.9.1/timeout.rb:100
c:0059 p:0038 s:0252 b:0252 l:0001b0 d:0001b0 METHOD /home/deploysearch/.rvm/rubies/ruby-1.9.3-p545/lib/ruby/1.9.1/net/http.rb:763
c:0058 p:0011 s:0244 b:0244 l:000243 d:000243 METHOD /home/deploysearch/.rvm/rubies/ruby-1.9.3-p545/lib/ruby/1.9.1/net/http.rb:756
c:0057 p:0048 s:0241 b:0241 l:000240 d:000240 METHOD /home/deploysearch/.rvm/rubies/ruby-1.9.3-p545/lib/ruby/1.9.1/net/http.rb:745
c:0056 p:0182 s:0238 b:0238 l:000237 d:000237 METHOD /home/deploysearch/.rvm/rubies/ruby-1.9.3-p545/lib/ruby/1.9.1/net/http.rb:557
c:0055 p:0040 s:0225 b:0225 l:000fb8 d:000fb8 METHOD /var/www/apps/searchfuse/current/lib/searchfuse/analysis/utils/http_resource_size_calculator.rb:10
c:0054 p:0086 s:0220 b:0210 l:000201 d:000209 BLOCK /var/www/apps/searchfuse/current/app/contexts/images/update_or_create_context.rb:17
c:0053 p:---- s:0207 b:0207 l:000206 d:000206 FINISH
c:0052 p:---- s:0205 b:0205 l:000204 d:000204 CFUNC :map
c:0051 p:0037 s:0202 b:0202 l:000201 d:000201 METHOD /var/www/apps/searchfuse/current/app/contexts/images/update_or_create_context.rb:12
c:0050 p:0028 s:0197 b:0197 l:000188 d:000196 BLOCK /var/www/apps/searchfuse/current/app/services/project_image_resource_discovery_service.rb:11
c:0049 p:---- s:0194 b:0194 l:000193 d:000193 FINISH
c:0048 p:---- s:0192 b:0192 l:000191 d:000191 CFUNC :each
c:0047 p:0026 s:0189 b:0189 l:000188 d:000188 METHOD /var/www/apps/searchfuse/current/app/services/project_image_resource_discovery_service.rb:10
c:0046 p:0046 s:0185 b:0185 l:000184 d:000184 METHOD /var/www/apps/searchfuse/current/app/workers/project_image_resource_discovery_worker.rb:8
c:0045 p:0025 s:0181 b:0181 l:001200 d:000180 BLOCK /home/deploysearch/ruby/1.9.1/gems/sidekiq-2.13.0/lib/sidekiq/processor.rb:48
c:0044 p:---- s:0179 b:0179 l:000178 d:000178 FINISH
c:0043 p:---- s:0177 b:0177 l:000176 d:000176 CFUNC :call
c:0042 p:0024 s:0174 b:0174 l:000588 d:000173 BLOCK /home/deploysearch/ruby/1.9.1/gems/sidekiq-2.13.0/lib/sidekiq/middleware/chain.rb:109
c:0041 p:0056 s:0172 b:0172 l:000171 d:000171 METHOD /home/deploysearch/ruby/1.9.1/bundler/gems/sidekiq-status-d61e1d47071a/lib/sidekiq-status/server_middleware.rb:30
c:0040 p:0049 s:0166 b:0166 l:000588 d:000165 BLOCK /home/deploysearch/ruby/1.9.1/gems/sidekiq-2.13.0/lib/sidekiq/middleware/chain.rb:111
c:0039 p:0005 s:0164 b:0164 l:0019b8 d:000163 BLOCK /home/deploysearch/ruby/1.9.1/bundler/gems/sidekiq-throttler-8bc8154bb77e/lib/sidekiq/throttler.rb:29
c:0038 p:---- s:0162 b:0162 l:000161 d:000161 FINISH
c:0037 p:---- s:0160 b:0160 l:000159 d:000159 CFUNC :call
c:0036 p:0024 s:0157 b:0157 l:000156 d:000156 METHOD /home/deploysearch/ruby/1.9.1/bundler/gems/sidekiq-throttler-8bc8154bb77e/lib/sidekiq/throttler/rate_limit.rb:137
c:0035 p:0061 s:0154 b:0154 l:0019b8 d:0019b8 METHOD /home/deploysearch/ruby/1.9.1/bundler/gems/sidekiq-throttler-8bc8154bb77e/lib/sidekiq/throttler.rb:36
c:0034 p:0049 s:0147 b:0147 l:000588 d:000146 BLOCK /home/deploysearch/ruby/1.9.1/gems/sidekiq-2.13.0/lib/sidekiq/middleware/chain.rb:111
c:0033 p:0005 s:0145 b:0145 l:000b90 d:000144 BLOCK /home/deploysearch/ruby/1.9.1/gems/newrelic_rpm-3.6.5.130/lib/new_relic/agent/instrumentation/sidekiq.rb:25
c:0032 p:0581 s:0143 b:0143 l:000142 d:000142 METHOD /home/deploysearch/ruby/1.9.1/gems/newrelic_rpm-3.6.5.130/lib/new_relic/agent/instrumentation/controller_instrumentation.rb:318
c:0031 p:0029 s:0127 b:0127 l:000b90 d:000b90 METHOD /home/deploysearch/ruby/1.9.1/gems/newrelic_rpm-3.6.5.130/lib/new_relic/agent/instrumentation/sidekiq.rb:24
c:0030 p:0049 s:0121 b:0121 l:000588 d:000120 BLOCK /home/deploysearch/ruby/1.9.1/gems/sidekiq-2.13.0/lib/sidekiq/middleware/chain.rb:111
c:0029 p:0009 s:0119 b:0119 l:000118 d:000118 METHOD /home/deploysearch/ruby/1.9.1/bundler/gems/sidekiq-superworker-fafd18ef9819/lib/sidekiq/superworker/server/middleware.rb:11
c:0028 p:0049 s:0111 b:0111 l:000588 d:000110 BLOCK /home/deploysearch/ruby/1.9.1/gems/sidekiq-2.13.0/lib/sidekiq/middleware/chain.rb:111
c:0027 p:0019 s:0109 b:0109 l:000108 d:000108 METHOD /home/deploysearch/ruby/1.9.1/gems/sidekiq-failures-0.2.1/lib/sidekiq/failures/middleware.rb:10
c:0026 p:0049 s:0101 b:0101 l:000588 d:000100 BLOCK /home/deploysearch/ruby/1.9.1/gems/sidekiq-2.13.0/lib/sidekiq/middleware/chain.rb:111
c:0025 p:0007 s:0099 b:0099 l:000098 d:000098 METHOD /home/deploysearch/ruby/1.9.1/gems/sidekiq-2.13.0/lib/sidekiq/middleware/server/active_record.rb:6
c:0024 p:0049 s:0095 b:0095 l:000588 d:000094 BLOCK /home/deploysearch/ruby/1.9.1/gems/sidekiq-2.13.0/lib/sidekiq/middleware/chain.rb:111
c:0023 p:0007 s:0093 b:0093 l:000092 d:000092 METHOD /home/deploysearch/ruby/1.9.1/gems/sidekiq-2.13.0/lib/sidekiq/middleware/server/retry_jobs.rb:49
c:0022 p:0049 s:0081 b:0081 l:000588 d:000080 BLOCK /home/deploysearch/ruby/1.9.1/gems/sidekiq-2.13.0/lib/sidekiq/middleware/chain.rb:111
c:0021 p:0041 s:0079 b:0079 l:000730 d:0007b0 BLOCK /home/deploysearch/ruby/1.9.1/gems/sidekiq-2.13.0/lib/sidekiq/middleware/server/logging.rb:11
c:0020 p:0037 s:0076 b:0076 l:000075 d:000075 METHOD /home/deploysearch/ruby/1.9.1/gems/sidekiq-2.13.0/lib/sidekiq/logging.rb:22
c:0019 p:0045 s:0072 b:0072 l:000730 d:000730 METHOD /home/deploysearch/ruby/1.9.1/gems/sidekiq-2.13.0/lib/sidekiq/middleware/server/logging.rb:7
c:0018 p:0049 s:0066 b:0066 l:000588 d:000065 LAMBDA /home/deploysearch/ruby/1.9.1/gems/sidekiq-2.13.0/lib/sidekiq/middleware/chain.rb:111
c:0017 p:---- s:0064 b:0064 l:000063 d:000063 FINISH
c:0016 p:---- s:0062 b:0062 l:000061 d:000061 CFUNC :call
c:0015 p:0040 s:0059 b:0059 l:000588 d:000588 METHOD /home/deploysearch/ruby/1.9.1/gems/sidekiq-2.13.0/lib/sidekiq/middleware/chain.rb:114
c:0014 p:0030 s:0052 b:0052 l:001200 d:000448 BLOCK /home/deploysearch/ruby/1.9.1/gems/sidekiq-2.13.0/lib/sidekiq/processor.rb:47
c:0013 p:0021 s:0050 b:0050 l:001780 d:001780 METHOD /home/deploysearch/ruby/1.9.1/gems/sidekiq-2.13.0/lib/sidekiq/processor.rb:102
c:0012 p:0130 s:0044 b:0044 l:001200 d:001698 BLOCK /home/deploysearch/ruby/1.9.1/gems/sidekiq-2.13.0/lib/sidekiq/processor.rb:46
c:0011 p:---- s:0038 b:0038 l:000037 d:000037 FINISH
c:0010 p:---- s:0036 b:0036 l:000035 d:000035 CFUNC :call
c:0009 p:---- s:0034 b:0034 l:000033 d:000033 CFUNC :public_send
c:0008 p:0040 s:0030 b:0030 l:000029 d:000029 METHOD /home/deploysearch/ruby/1.9.1/gems/celluloid-0.14.1/lib/celluloid/calls.rb:25
c:0007 p:0039 s:0022 b:0022 l:000021 d:000021 METHOD /home/deploysearch/ruby/1.9.1/gems/celluloid-0.14.1/lib/celluloid/calls.rb:67
c:0006 p:0066 s:0016 b:0016 l:002700 d:000015 BLOCK /home/deploysearch/ruby/1.9.1/gems/celluloid-0.14.1/lib/celluloid/future.rb:15
c:0005 p:---- s:0013 b:0013 l:000012 d:000012 FINISH
c:0004 p:---- s:0011 b:0011 l:000010 d:000010 CFUNC :call
c:0003 p:0021 s:0008 b:0008 l:0004c8 d:000007 BLOCK /home/deploysearch/ruby/1.9.1/gems/celluloid-0.14.1/lib/celluloid/internal_pool.rb:59
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:---- s:0002 b:0002 l:000001 d:000001 TOP

Updated by pskumarsrec88@gmail.com (Saravana kumar) over 10 years ago

My Envoronment is ubuntu 13.10
Ruby - 1.9.3
Patch - 535

Actions #2

Updated by phasis68 (Heesob Park) over 10 years ago

It seems that this issue is somewhat similar to the bug #8627( https://bugs.ruby-lang.org/issues/8627 ).
But the bug #8627 was fixed and backported to 1.9.3 already( https://bugs.ruby-lang.org/projects/ruby-193/repository/revisions/44933 )

Could you attach strace log for more info?

Updated by pskumarsrec88@gmail.com (Saravana kumar) over 10 years ago

-- Ruby level backtrace information ----------------------------------------
/home/deploysearch/ruby/1.9.1/gems/celluloid-0.14.1/lib/celluloid/internal_pool.rb:59:in block in create' /home/deploysearch/ruby/1.9.1/gems/celluloid-0.14.1/lib/celluloid/internal_pool.rb:59:in call'
/home/deploysearch/ruby/1.9.1/gems/celluloid-0.14.1/lib/celluloid/future.rb:15:in block in new' /home/deploysearch/ruby/1.9.1/gems/celluloid-0.14.1/lib/celluloid/calls.rb:67:in dispatch'
/home/deploysearch/ruby/1.9.1/gems/celluloid-0.14.1/lib/celluloid/calls.rb:25:in dispatch' /home/deploysearch/ruby/1.9.1/gems/celluloid-0.14.1/lib/celluloid/calls.rb:25:in public_send'
/home/deploysearch/ruby/1.9.1/gems/celluloid-0.14.1/lib/celluloid/calls.rb:25:in call' /home/deploysearch/ruby/1.9.1/gems/sidekiq-2.13.0/lib/sidekiq/processor.rb:46:in block in process'
/home/deploysearch/ruby/1.9.1/gems/sidekiq-2.13.0/lib/sidekiq/processor.rb:102:in stats' /home/deploysearch/ruby/1.9.1/gems/sidekiq-2.13.0/lib/sidekiq/processor.rb:47:in block (2 levels) in process'
/home/deploysearch/ruby/1.9.1/gems/sidekiq-2.13.0/lib/sidekiq/middleware/chain.rb:114:in invoke' /home/deploysearch/ruby/1.9.1/gems/sidekiq-2.13.0/lib/sidekiq/middleware/chain.rb:114:in call'
/home/deploysearch/ruby/1.9.1/gems/sidekiq-2.13.0/lib/sidekiq/middleware/chain.rb:111:in block in invoke' /home/deploysearch/ruby/1.9.1/gems/sidekiq-2.13.0/lib/sidekiq/middleware/server/logging.rb:7:in call'
/home/deploysearch/ruby/1.9.1/gems/sidekiq-2.13.0/lib/sidekiq/logging.rb:22:in with_context' /home/deploysearch/ruby/1.9.1/gems/sidekiq-2.13.0/lib/sidekiq/middleware/server/logging.rb:11:in block in call'
/home/deploysearch/ruby/1.9.1/gems/sidekiq-2.13.0/lib/sidekiq/middleware/chain.rb:111:in block in invoke' /home/deploysearch/ruby/1.9.1/gems/sidekiq-2.13.0/lib/sidekiq/middleware/server/retry_jobs.rb:49:in call'
/home/deploysearch/ruby/1.9.1/gems/sidekiq-2.13.0/lib/sidekiq/middleware/chain.rb:111:in block in invoke' /home/deploysearch/ruby/1.9.1/gems/sidekiq-2.13.0/lib/sidekiq/middleware/server/active_record.rb:6:in call'
/home/deploysearch/ruby/1.9.1/gems/sidekiq-2.13.0/lib/sidekiq/middleware/chain.rb:111:in block in invoke' /home/deploysearch/ruby/1.9.1/gems/sidekiq-failures-0.2.1/lib/sidekiq/failures/middleware.rb:10:in call'
/home/deploysearch/ruby/1.9.1/gems/sidekiq-2.13.0/lib/sidekiq/middleware/chain.rb:111:in block in invoke' /home/deploysearch/ruby/1.9.1/bundler/gems/sidekiq-superworker-fafd18ef9819/lib/sidekiq/superworker/server/middleware.rb:11:in call'
/home/deploysearch/ruby/1.9.1/gems/sidekiq-2.13.0/lib/sidekiq/middleware/chain.rb:111:in block in invoke' /home/deploysearch/ruby/1.9.1/gems/newrelic_rpm-3.6.5.130/lib/new_relic/agent/instrumentation/sidekiq.rb:24:in call'
/home/deploysearch/ruby/1.9.1/gems/newrelic_rpm-3.6.5.130/lib/new_relic/agent/instrumentation/controller_instrumentation.rb:318:in perform_action_with_newrelic_trace' /home/deploysearch/ruby/1.9.1/gems/newrelic_rpm-3.6.5.130/lib/new_relic/agent/instrumentation/sidekiq.rb:25:in block in call'
/home/deploysearch/ruby/1.9.1/gems/sidekiq-2.13.0/lib/sidekiq/middleware/chain.rb:111:in block in invoke' /home/deploysearch/ruby/1.9.1/bundler/gems/sidekiq-throttler-8bc8154bb77e/lib/sidekiq/throttler.rb:36:in call'
/home/deploysearch/ruby/1.9.1/bundler/gems/sidekiq-throttler-8bc8154bb77e/lib/sidekiq/throttler/rate_limit.rb:137:in execute' /home/deploysearch/ruby/1.9.1/bundler/gems/sidekiq-throttler-8bc8154bb77e/lib/sidekiq/throttler/rate_limit.rb:137:in call'
/home/deploysearch/ruby/1.9.1/bundler/gems/sidekiq-throttler-8bc8154bb77e/lib/sidekiq/throttler.rb:29:in block in call' /home/deploysearch/ruby/1.9.1/gems/sidekiq-2.13.0/lib/sidekiq/middleware/chain.rb:111:in block in invoke'
/home/deploysearch/ruby/1.9.1/bundler/gems/sidekiq-status-d61e1d47071a/lib/sidekiq-status/server_middleware.rb:30:in call' /home/deploysearch/ruby/1.9.1/gems/sidekiq-2.13.0/lib/sidekiq/middleware/chain.rb:109:in block in invoke'
/home/deploysearch/ruby/1.9.1/gems/sidekiq-2.13.0/lib/sidekiq/middleware/chain.rb:109:in call' /home/deploysearch/ruby/1.9.1/gems/sidekiq-2.13.0/lib/sidekiq/processor.rb:48:in block (3 levels) in process'
/var/www/apps/searchfuse/current/app/workers/project_image_resource_discovery_worker.rb:8:in perform' /var/www/apps/searchfuse/current/app/services/project_image_resource_discovery_service.rb:10:in execute'
/var/www/apps/searchfuse/current/app/services/project_image_resource_discovery_service.rb:10:in each' /var/www/apps/searchfuse/current/app/services/project_image_resource_discovery_service.rb:11:in block in execute'
/var/www/apps/searchfuse/current/app/contexts/images/update_or_create_context.rb:12:in execute' /var/www/apps/searchfuse/current/app/contexts/images/update_or_create_context.rb:12:in map'
/var/www/apps/searchfuse/current/app/contexts/images/update_or_create_context.rb:16:in block in execute' /var/www/apps/searchfuse/current/app/contexts/images/update_or_create_context.rb:25:in broken_link?'
/var/www/apps/searchfuse/current/lib/searchfuse/analysis/spider/link_checker.rb:8:in available?' /home/deploysearch/.rvm/rubies/ruby-1.9.3-p545/lib/ruby/1.9.1/net/http.rb:745:in start'
/home/deploysearch/.rvm/rubies/ruby-1.9.3-p545/lib/ruby/1.9.1/net/http.rb:756:in do_start' /home/deploysearch/.rvm/rubies/ruby-1.9.3-p545/lib/ruby/1.9.1/net/http.rb:763:in connect'
/home/deploysearch/.rvm/rubies/ruby-1.9.3-p545/lib/ruby/1.9.1/timeout.rb:100:in timeout' /home/deploysearch/.rvm/rubies/ruby-1.9.3-p545/lib/ruby/1.9.1/timeout.rb:55:in timeout'
/home/deploysearch/.rvm/rubies/ruby-1.9.3-p545/lib/ruby/1.9.1/net/http.rb:763:in block in connect' /home/deploysearch/.rvm/rubies/ruby-1.9.3-p545/lib/ruby/1.9.1/net/http.rb:763:in open'
/home/deploysearch/.rvm/rubies/ruby-1.9.3-p545/lib/ruby/1.9.1/net/http.rb:763:in `initialize'

Updated by pskumarsrec88@gmail.com (Saravana kumar) over 10 years ago

So Which version of ruby patch i should use for this issue?

My current patch is 1.9.3-p545

Updated by phasis68 (Heesob Park) over 10 years ago

The ruby 1.9.3-p545 is the patch applied version.
Thus, this issue is not the same bug with bug #8627.

I guess the getaddrinfo call returns EAI_SYSTEM and errno is not ENOENT in your case.
Could you attach strace log or a simple reproducible code?

Updated by pskumarsrec88@gmail.com (Saravana kumar) over 10 years ago

This is the line am geting the error

http = Net::HTTP.start(host, port)

Its not occuring for all hosts and ports, Some of the hosts and ports are getting error.

Actually am looping 100k hosts and ports to run this code. So am not able to find the exact host and port detail.

Updated by phasis68 (Heesob Park) over 10 years ago

I found the errno is needed for rb_sys_fail function but it is cleared with the rb_freeaddrinfo function call.

Here is a patch

diff --git a/socket.c b/socket.c
index 67bfcb3..6b145ac 100644
--- a/socket.c
+++ b/socket.c
@@ -1346,7 +1346,7 @@ sock_s_getnameinfo(int argc, VALUE *argv)
     int fl;
     struct rb_addrinfo *res = NULL;
     struct addrinfo hints, *r;
-    int error;
+    int error, saved_errno;
     union_sockaddr ss;
     struct sockaddr *sap;
     socklen_t salen;
@@ -1460,11 +1460,15 @@ sock_s_getnameinfo(int argc, VALUE *argv)
     return rb_assoc_new(rb_str_new2(hbuf), rb_str_new2(pbuf));
 
   error_exit_addr:
+    saved_errno = errno;
     if (res) rb_freeaddrinfo(res);
+    errno = saved_errno;
     rsock_raise_socket_error("getaddrinfo", error);
 
   error_exit_name:
+    saved_errno = errno;
     if (res) rb_freeaddrinfo(res);
+    errno = saved_errno;
     rsock_raise_socket_error("getnameinfo", error);
 
     UNREACHABLE; 
Actions #8

Updated by akr (Akira Tanaka) over 10 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

Applied in changeset r45530.


Updated by nagachika (Tomoyuki Chikanaga) over 10 years ago

  • Backport set to 1.9.3: REQUIRED, 2.0.0: REQUIRED, 2.1: REQUIRED

Updated by nagachika (Tomoyuki Chikanaga) over 10 years ago

  • Backport changed from 1.9.3: REQUIRED, 2.0.0: REQUIRED, 2.1: REQUIRED to 1.9.3: REQUIRED, 2.0.0: REQUIRED, 2.1: DONE

r45045, r45046 and r45530 were backported into ruby_2_1 branch at r46054.

Updated by usa (Usaku NAKAMURA) over 10 years ago

  • Backport changed from 1.9.3: REQUIRED, 2.0.0: REQUIRED, 2.1: DONE to 1.9.3: REQUIRED, 2.0.0: DONE, 2.1: DONE

r39239, r45045 and r45530 were backported into ruby_2_0_0 at r46510.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0