Tarantool development patches archive
 help / color / mirror / Atom feed
From: Alexander Turenko <alexander.turenko@tarantool.org>
To: Sergey Ostanevich <sergos@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH v2 2/2] lua: return getaddrinfo() errors
Date: Sun, 29 Mar 2020 12:25:49 +0300	[thread overview]
Message-ID: <20200329092549.pbxzho57kn3hdn47@tkn_work_nb> (raw)
In-Reply-To: <20200329090718.GD328@tarantool.org>

> > diff --git a/src/lua/socket.lua b/src/lua/socket.lua
> > index a334ad45b..ce6dab301 100644
> > --- a/src/lua/socket.lua
> > +++ b/src/lua/socket.lua
> > @@ -1041,9 +1041,12 @@ local function tcp_connect(host, port, timeout)
> >      end
> >      local timeout = timeout or TIMEOUT_INFINITY
> >      local stop = fiber.clock() + timeout
> > -    local dns = getaddrinfo(host, port, timeout, { type = 'SOCK_STREAM',
> > +    local dns, err = getaddrinfo(host, port, timeout, { type = 'SOCK_STREAM',
> >          protocol = 'tcp' })
> > -    if dns == nil or #dns == 0 then
> > +    if dns == nil then
> > +        return nil, err
> You explicitly put error here...
> 
> > +    end
> > +    if #dns == 0 then
> >          boxerrno(boxerrno.EINVAL)
> >          return nil
> ... and not here. Why do you keep using two versions of error passing,
> not one? I would agree you need boxerrno for backward compatibility, but
> to start moving towards {res, err} you have to introduce it everywhere. 

Seems logical.

> > +-- gh-4138 Check getaddrinfo() error from socket:connect() only.
> > +-- Error code and error message returned by getaddrinfo() depends
> > +-- on system's gai_strerror().
> > +test_run:cmd("setopt delimiter ';'")
> > +function check_err(err)
> > +    if err == 'getaddrinfo: nodename nor servname provided, or not known' or
> > +       err == 'getaddrinfo: Servname not supported for ai_socktype' or
> > +       err == 'getaddrinfo: Name or service not known' or
> > +       err == 'getaddrinfo: hostname nor servname provided, or not known' or
> > +       err == 'getaddrinfo: Temporary failure in name resolution' or
> > +       err == 'getaddrinfo: Name could not be resolved at this time' then
> > +        return true
> > +    end
> > +    return false
> > +end;
> I really doubt that different error messages from the set above will appear 
> for the same error on different platforms. Could you please check for particular 
> output for each case you trigger below?

It is so. It varies even for the same system connected to different
networks.

  reply	other threads:[~2020-03-29  9:25 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-12 10:24 [Tarantool-patches] [PATCH v2 0/2] Return " Roman Khabibov
2020-03-12 10:24 ` [Tarantool-patches] [PATCH v2 1/2] coio/say: fix getaddrinfo error handling on macOS Roman Khabibov
2020-03-29  8:51   ` Sergey Ostanevich
2020-03-29  9:12     ` Alexander Turenko
2020-04-06  2:07     ` Roman Khabibov
2020-04-17  9:37       ` Sergey Ostanevich
2020-04-24 11:32         ` Roman Khabibov
2020-06-23 13:27         ` Roman Khabibov
2020-07-23 14:12           ` Sergey Ostanevich
2020-07-28  9:26             ` Roman Khabibov
2020-04-26 17:20   ` Vladislav Shpilevoy
2020-03-12 10:24 ` [Tarantool-patches] [PATCH v2 2/2] lua: return getaddrinfo() errors Roman Khabibov
2020-03-29  9:07   ` Sergey Ostanevich
2020-03-29  9:25     ` Alexander Turenko [this message]
2020-04-06  2:08     ` Roman Khabibov
2020-04-16 10:27       ` Sergey Ostanevich
2020-04-24 11:42         ` Roman Khabibov
2020-04-24 17:18           ` Sergey Ostanevich
2020-04-26  3:16             ` Roman Khabibov
2020-04-26 15:46               ` Alexander Turenko
2020-04-26 16:26                 ` Roman Khabibov
2020-07-13  9:51                   ` sergos
2020-07-28 14:08 ` [Tarantool-patches] [PATCH v2 0/2] Return " Kirill Yukhin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200329092549.pbxzho57kn3hdn47@tkn_work_nb \
    --to=alexander.turenko@tarantool.org \
    --cc=sergos@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v2 2/2] lua: return getaddrinfo() errors' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox