Tarantool development patches archive
 help / color / mirror / Atom feed
From: Alexander Turenko <alexander.turenko@tarantool.org>
To: Roman Khabibov <roman.habibov@tarantool.org>
Cc: tarantool-patches@freelists.org,
	Vladimir Davydov <vdavydov.dev@gmail.com>
Subject: Re: [tarantool-patches] Re: [PATCH v2 1/2] lua: return getaddrinfo() errors
Date: Fri, 26 Jul 2019 16:48:04 +0300	[thread overview]
Message-ID: <20190726134803.45ocugh3ukupyyis@tkn_work_nb> (raw)
In-Reply-To: <20190723123954.dgtfsetqlmjhued3@tkn_work_nb>

On Tue, Jul 23, 2019 at 03:39:54PM +0300, Alexander Turenko wrote:
> Please, split Mac OS specific fix (I think both coio_task.c and say.c
> can be fixed in one commit) from OS independent Lua change (that just
> pass received error to a user).
> 
> Returning either `nil` or `nil, err` still look strange for me. Please,
> try to implement the following way: set an additional field in a socket
> object (we have '_errno', let's add another one: say, '_error') with a
> message from a diagnostics and return it from socket_error() if it
> exists. Don't forget to flush it when update any of those two fields (I
> guess an auxiliary function to set _errno and _error).
> 
> Don't sure how should we check whether a diag is set. Maybe flush it
> before a call to C and then check whether it was set afterwards.
> 
> There are places where strerror() is called directly to return `nil,
> err`. They should be replaced with socket_error().
> 
> I think it worth to introduce socket_clear_error() and
> socket_set_error() in a separate commit w/o any logic change.
> 
> CCed Vladimir, because we discussed possible approaches with him.
> 
> WBR, Alexander Turenko.

We look into the code with Roman together and now I understood that the
proposed way does not work: we have no a socket object in getaddrinfo()
Lua function to save _error into it.

We should return a text error message as retvals anyway.

There is the question about constructions like so:

local val, err = foo(<...>)
if val == nil then
    if err == nil then
        return boxerrno.strerror()
    else
        return err
    end
end

I think foo() should either always return `nil, string` at an error or
always set an errno. I propose to try to implement this way and compare
whther it will be simper.

WBR, Alexander Turenko.

  reply	other threads:[~2019-07-26 13:48 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-15 16:58 [tarantool-patches] [PATCH] " Roman Khabibov
2019-06-23 20:31 ` [tarantool-patches] " Alexander Turenko
2019-06-25 13:38   ` [tarantool-patches] Re: [PATCH v2 1/2] " Roman Khabibov
2019-07-09  8:04     ` Alexander Turenko
2019-07-10  2:16       ` Roman Khabibov
2019-07-23 12:39         ` Alexander Turenko
2019-07-26 13:48           ` Alexander Turenko [this message]
2019-08-05 13:36           ` Roman Khabibov
2019-08-29  0:45             ` Alexander Turenko
     [not found]               ` <868EAF2C-A491-46C9-AD37-7512D6CAB213@tarantool.org>
2019-09-06 13:45                 ` [tarantool-patches] Re: [server-dev] " Alexander Turenko
2019-09-10 12:54                   ` Roman Khabibov
2019-11-01 14:39                     ` [Tarantool-patches] [server-dev] Re: [tarantool-patches] " Alexander Turenko
2019-11-21 17:27                       ` [Tarantool-patches] [tarantool-patches] [server-dev] " Roman Khabibov
2019-12-08 19:48                         ` Alexander Turenko
2019-12-10 16:25                           ` Roman Khabibov
2019-12-18 14:58                             ` Alexander Turenko
2019-12-21 17:50                               ` Roman Khabibov
2019-12-23 13:36                                 ` Alexander Turenko
2019-12-26 17:29                                   ` Roman Khabibov
2020-02-18 13:55                                     ` [Tarantool-patches] Fwd: " Roman Khabibov

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=20190726134803.45ocugh3ukupyyis@tkn_work_nb \
    --to=alexander.turenko@tarantool.org \
    --cc=roman.habibov@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=vdavydov.dev@gmail.com \
    --subject='Re: [tarantool-patches] Re: [PATCH v2 1/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