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
Subject: [tarantool-patches] Re: [PATCH v2 2/2] say: take getaddrinfo() errors into account
Date: Fri, 6 Sep 2019 16:44:44 +0300	[thread overview]
Message-ID: <20190906134443.kc5anat2t3q26l3o@tkn_work_nb> (raw)
In-Reply-To: <8E98F721-601F-436D-8F0A-5E399D8F7CAB@tarantool.org>

> >> +--
> >> +-- gh-4138: check getaddrinfo() error and panic after that.
> >> +--
> >> +code=[[
> >> +local socket = require('socket')
> >> +local log = require('log')
> >> +local fio = require('fio')
> >> +
> >> +path = fio.pathjoin(fio.cwd(), 'log_unix_socket_test.sock')
> >> +unix_socket = socket('AF_UNIX', 'SOCK_DGRAM', 0)
> >> +unix_socket:bind('unix/', path)
> >> +
> >> +opt = string.format("syslog:server=non_exists_hostname:%s,identity=tarantool", path)
> >> +box.cfg{log = opt, log_nonblock=true}
> > 
> > log_nonblock is not needed here, so it is better to remove it.
> Removed.

Still no.

> > box.cfg{log = 'syslog:server=non_exists_hostname:3301'} is enough, not need to
> > form a file path, no need identity, no need requiring socket, log and fio.
> > 
> > The test passes even before the patch, so what it is intended to test? I
> > think we should write a test that verifies stderr output to find all log
> > messages we expect to appear in the case:
> > 
> > Linux:
> > 
> > | SystemError getaddrinfo: Temporary failure in name resolution: Input/output error
> > | SystemError syslog logger: Input/output error: Input/output error
> > | failed to initialize logging subsystem
> > 
> > gai_strerror() message corresponds to EAI_AGAIN.
> > 
> > Mac OS:
> > 
> > | SystemError getaddrinfo: nodename nor servname provided, or not known: Input/output error
> > | SystemError syslog logger: Input/output error: Input/output error
> > | failed to initialize logging subsystem
> > 
> > gai_strerror() message corresponds to EAI_NONAME.
> > 
> > I propose to call ffi.C.gai_strerror() right from a test to form two
> > error messages and verify that the actual input match one of them.
> > 
> > If it is hard to catch stderr, then let's proceed w/o this test. However
> > I think it is doable.
> > 
> > I also propose to test error messages in the similar way (using
> > ffi.C.gai_strerror(GAI_AGAIN) and ffi.C.gai_strerror(GAI_NONAME)) in
> > test cases in second patch of the patchset.
> We discussed that with Vova and we decided, that it is too difficult.
> It is better, to waste not time for this test. Test for PANIC is enough.

I don't see any reason to add a test case that checks that tarantool
exits in the case: it was so before the commit and nothing is changed
except the error message. I propose to delete the test case.

> >> +	/* gh-4138: Check getaddrinfo() error. */
> >> +	isnt(coio_getaddrinfo("non_exists_hostname", port, NULL, &i, 1), 0,
> >> +	     "getaddrinfo error");
> > 
> > I would say 'getaddrinfo retval' instead 'getaddrinfo error'.

I don't insist, but remind about that here if it was missed by a
mistake.

> >> +	isnt(strstr(diag_get()->last->errmsg, "getaddrinfo"), NULL,
> >> +	     "getaddrinfo error message");
> >> +
> > 
> > I propose to verify the entire error message using
> > gai_strerror(GAI_AGAIN) and gai_strerror(GAI_NONAME)—just as proposed
> > above for a log message.
> I have not found the way, how to carry this macros/enum from the libc header to Lua.

It is possible to add them into socket.c, but anyway it is not worth to
do this just for a test. Let's check for certain error messages (not for
just 'getaddrinfo: ' prefix).

  parent reply	other threads:[~2019-09-06 13:45 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-25 13:38 [tarantool-patches] [PATCH v2 0/2] " Roman Khabibov
2019-06-25 13:38 ` [tarantool-patches] [PATCH v2 2/2] say: " Roman Khabibov
2019-07-23 14:52   ` [tarantool-patches] " Alexander Turenko
2019-08-05 13:32     ` Roman Khabibov
2019-08-28 21:34       ` Alexander Turenko
2019-08-29  0:51         ` Alexander Turenko
     [not found]         ` <8E98F721-601F-436D-8F0A-5E399D8F7CAB@tarantool.org>
2019-09-06 13:44           ` Alexander Turenko [this message]
2019-09-10 12:52             ` Roman Khabibov
2019-11-01 15:19               ` [Tarantool-patches] " Alexander Turenko
2019-11-21 17:28                 ` [Tarantool-patches] [tarantool-patches] " Roman Khabibov
2019-12-08 19:48                   ` Alexander Turenko
2019-12-10 16:25                     ` Roman Khabibov
2019-12-18 15:01                       ` Alexander Turenko
2019-12-21 17:50                         ` Roman Khabibov
2019-12-23 12:56                           ` Alexander Turenko
2019-12-23 13:38                             ` Alexander Turenko
2019-12-26 17:29                               ` Roman Khabibov
2019-12-26 21:05                                 ` Alexander Turenko
2019-12-27 13:01                                   ` 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=20190906134443.kc5anat2t3q26l3o@tkn_work_nb \
    --to=alexander.turenko@tarantool.org \
    --cc=roman.habibov@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='[tarantool-patches] Re: [PATCH v2 2/2] say: take getaddrinfo() errors into account' \
    /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