Project

General

Profile

Actions

Bug #10975

closed

[BUG] rb_sys_fail(getaddrinfo) - errno == 0 (Ruby 2.0.0)

Added by dr_gonzo (Steve Johnson) almost 7 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 2.0.0p598 (2014-11-13 revision 48408) [x86_64-linux]
[ruby-core:<unknown>]

Description

I'm not a developer and I'm not interested in upgrading Ruby as a troubleshooting step. I googled the error but have no idea if the solutions I found address this issue.

Environment: Ubuntu 14 with Ruby 2.0.0, Apache 2.4, PHP 5.6, Jekyll 2.4.0, Markdown source with some HTML in source also
Steps to reproduce:

  1. rm -rf _site
  2. bundle exec jekyll serve
  3. check-links --no-warnings .

Expected result: check-links runs without errors
Actual result: check-links starts throwing these while checking files that were authored in HTML:

Problem: ./_site/guides/m1x/other/solr-ee-patches.html
Link: http://support.magentocommerce.com/
Response: Too many open files - getaddrinfo

Note: check-links worked fine before I added the HTML-authored files to the project.

Final stack trace:

/home/stack/.rvm/rubies/ruby-2.0.0-p598/lib/ruby/2.0.0/net/http.rb:878: [BUG] rb_sys_fail(getaddrinfo) - errno == 0
ruby 2.0.0p598 (2014-11-13 revision 48408) [x86_64-linux]

(snip)

Files

bug-10975.log (20.1 KB) bug-10975.log nobu (Nobuyoshi Nakada), 03/16/2015 12:13 AM
Actions #1

Updated by nobu (Nobuyoshi Nakada) almost 7 years ago

Could you try this patch?

diff --git i/ext/socket/ipsocket.c w/ext/socket/ipsocket.c
index fa5c13c..0dd3ac5 100644
--- i/ext/socket/ipsocket.c
+++ w/ext/socket/ipsocket.c
@@ -41,6 +41,7 @@ inetsock_cleanup(struct inetsock_arg *arg)
 static VALUE
 init_inetsock_internal(struct inetsock_arg *arg)
 {
+    int error = 0;
     int type = arg->type;
     struct addrinfo *res;
     int fd, status = 0;
@@ -92,6 +93,7 @@ init_inetsock_internal(struct inetsock_arg *arg)
    }

    if (status < 0) {
+       error = errno;
        close(fd);
        arg->fd = fd = -1;
        continue;
@@ -99,7 +101,7 @@ init_inetsock_internal(struct inetsock_arg *arg)
        break;
     }
     if (status < 0) {
-   rb_sys_fail(syscall);
+   rb_syserr_fail(error, syscall);
     }

     arg->fd = -1;
@@ -107,8 +109,9 @@ init_inetsock_internal(struct inetsock_arg *arg)
     if (type == INET_SERVER) {
    status = listen(fd, SOMAXCONN);
    if (status < 0) {
+       error = errno;
        close(fd);
-            rb_sys_fail("listen(2)");
+            rb_syserr_fail(error, "listen(2)");
    }
     }

Actions #2

Updated by nobu (Nobuyoshi Nakada) almost 7 years ago

Fixed the previous patch.

diff --git a/ext/socket/ipsocket.c b/ext/socket/ipsocket.c
index fa5c13c..314825c 100644
--- a/ext/socket/ipsocket.c
+++ b/ext/socket/ipsocket.c
@@ -41,6 +41,7 @@ inetsock_cleanup(struct inetsock_arg *arg)
 static VALUE
 init_inetsock_internal(struct inetsock_arg *arg)
 {
+    int error = 0;
     int type = arg->type;
     struct addrinfo *res;
     int fd, status = 0;
@@ -66,6 +67,7 @@ init_inetsock_internal(struct inetsock_arg *arg)
    syscall = "socket(2)";
    fd = status;
    if (fd < 0) {
+       error = errno;
        continue;
    }
    arg->fd = fd;
@@ -92,6 +94,7 @@ init_inetsock_internal(struct inetsock_arg *arg)
    }

    if (status < 0) {
+       error = errno;
        close(fd);
        arg->fd = fd = -1;
        continue;
@@ -99,7 +102,7 @@ init_inetsock_internal(struct inetsock_arg *arg)
        break;
     }
     if (status < 0) {
-   rb_sys_fail(syscall);
+   rb_syserr_fail(error, syscall);
     }

     arg->fd = -1;
@@ -107,8 +110,9 @@ init_inetsock_internal(struct inetsock_arg *arg)
     if (type == INET_SERVER) {
    status = listen(fd, SOMAXCONN);
    if (status < 0) {
+       error = errno;
        close(fd);
-            rb_sys_fail("listen(2)");
+       rb_syserr_fail(error, "listen(2)");
    }
     }

Actions #3

Updated by nobu (Nobuyoshi Nakada) over 6 years ago

  • Status changed from Feedback to Closed

Applied in changeset r50404.


ipsocket.c: sys_error

  • ext/socket/ipsocket.c (init_inetsock_internal): preserve errno before other library calls and use rb_syserr_fail. [ruby-core:68531] [Bug #10975]
Actions #4

Updated by usa (Usaku NAKAMURA) over 6 years ago

  • Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN to 2.0.0: WONTFIX, 2.1: REQUIRED, 2.2: REQUIRED
Actions #5

Updated by usa (Usaku NAKAMURA) over 6 years ago

  • Backport changed from 2.0.0: WONTFIX, 2.1: REQUIRED, 2.2: REQUIRED to 2.0.0: WONTFIX, 2.1: DONE, 2.2: REQUIRED

ruby_2_1 r50578 merged revision(s) 50404,50405.

Updated by nagachika (Tomoyuki Chikanaga) over 6 years ago

  • Backport changed from 2.0.0: WONTFIX, 2.1: DONE, 2.2: REQUIRED to 2.0.0: WONTFIX, 2.1: DONE, 2.2: DONE

Backported into ruby_2_2 branch at r50626.

Actions

Also available in: Atom PDF