From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp38.i.mail.ru (smtp38.i.mail.ru [94.100.177.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 67118445320 for ; Mon, 13 Jul 2020 12:51:47 +0300 (MSK) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) From: "sergos@tarantool.org" In-Reply-To: <2A673E1E-AEFC-4912-8782-7B88AEA049C2@tarantool.org> Date: Mon, 13 Jul 2020 12:51:45 +0300 Content-Transfer-Encoding: quoted-printable Message-Id: <4F276B77-8F58-4282-A10A-2C63BFA10F0F@tarantool.org> References: <20200312102434.97300-1-roman.habibov@tarantool.org> <20200312102434.97300-3-roman.habibov@tarantool.org> <20200329090718.GD328@tarantool.org> <20200416102750.GA3110@tarantool.org> <451C0FA3-84FE-456A-86A2-77240532C63B@tarantool.org> <20200424171844.GE112@tarantool.org> <05B1078E-1CD3-44D7-9CC7-D8CE7399FD48@tarantool.org> <20200426154623.3trqdm7xhly6rxwe@tkn_work_nb> <2A673E1E-AEFC-4912-8782-7B88AEA049C2@tarantool.org> Subject: Re: [Tarantool-patches] [PATCH v2 2/2] lua: return getaddrinfo() errors List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Roman Khabibov Cc: tarantool-patches@dev.tarantool.org, Alexander Turenko Hi! Sorry for dropping out.=20 My initial concern was that we put a bunch of errors, such as EAI_NONAME = and=20 another bunch of messages, which can appear differently depending on OS = or=20 network conditions, into one bowl and mix them up. I believe there should be a better approach, such as for each error a = particular=20 set of messages can appear.=20 Now I tend to understand your statement as =E2=80=98an messages can = appear for each error=E2=80=99. Is it right?=20 Regards, Sergos > On 26 Apr 2020, at 19:26, Roman Khabibov = wrote: >=20 >=20 >=20 >> On Apr 26, 2020, at 18:46, Alexander Turenko = wrote: >>=20 >> On Sun, Apr 26, 2020 at 06:16:29AM +0300, Roman Khabibov wrote: >>>=20 >>>=20 >>>> On Apr 24, 2020, at 20:18, Sergey Ostanevich = wrote: >>>>=20 >>>> On 24 =D0=B0=D0=BF=D1=80 14:42, Roman Khabibov wrote: >>>>> Hi! Thanks for the review. >>>>>=20 >>>>>> On Apr 16, 2020, at 13:27, Sergey Ostanevich = wrote: >>>>>>=20 >>>>>> On 06 =D0=B0=D0=BF=D1=80 05:08, Roman Khabibov wrote: >>>>>>>>> +test_run:cmd("setopt delimiter ';'") >>>>>>>>> +function check_err(err) >>>>>>>>> + if err =3D=3D 'getaddrinfo: nodename nor servname = provided, or not known' or >>>>>>>>> + err =3D=3D 'getaddrinfo: Servname not supported for = ai_socktype' or >>>>>>>>> + err =3D=3D 'getaddrinfo: Name or service not known' or >>>>>>>>> + err =3D=3D 'getaddrinfo: hostname nor servname = provided, or not known' or >>>>>>>>> + err =3D=3D 'getaddrinfo: Temporary failure in name = resolution' or >>>>>>>>> + err =3D=3D '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=20 >>>>>>>> for the same error on different platforms. Could you please = check for particular=20 >>>>>>>> output for each case you trigger below? >>>>>>> Look at that: >>>>>>> = https://travis-ci.org/github/tarantool/tarantool/jobs/546115892#L3581 - = Linux failed >>>>>>> = https://travis-ci.org/github/tarantool/tarantool/jobs/546115893#L3100 - = macOS isn=E2=80=99t >>>>>>>=20 >>>>>>=20 >>>>>> Exactly, this means for the error EAI_NONAME those OSes have = differnet >>>>>> messages. But you've put different errors in one bunch - I meant = it >>>>>> should never return 'Temporary failure in name resolution' as a = result >>>>>> for EAI_SERVICE, right?=20 >>>>>>=20 >>>>>> Are you testing for correct error returned for a particular case? >>>>> Don=E2=80=99t understand the question. I just check error messages = that appeared >>>>> after travis/gitlab testing. >>>>>=20 >>>> Different errors makes different messages.=20 >>>> Same error can make different messages on different platforms.=20 >>>>=20 >>>> You put both into one: you don't care about what exact error came = to >>>> you, right?=20 >>> Right. The most important thing here is that the error is from = getaddrinfo. >>=20 >> Here I disagree. We want to verify that an error from a specific set = of >> errors occurs. AFAIR, three errors are possible when trying to = resolve a >> non-existent hostname: EAI_NONAME, EAI_AGAIN (and, as I see from the >> messages, EAI_SERVICE; maybe it is when ipv6 is semi-configured like = on >> travis-ci). >>=20 >> Actual EAI_* error for the test depends on network conditions and = host >> configuration, messages are platform dependent. >>=20 >> See also: >> = https://lists.tarantool.org/pipermail/tarantool-patches/2019-August/003399= .html >>=20 >> Roman, I suggest to clarify things that Sergos asked in the comments >> near to the check: if it is not clear for a reviewer, then a future >> reader may hang with it too. > Ok, Sergos, can you just show me what is wrong in this code. Sorry, = but I > can=E2=80=99t figure out. There is the set of error messages, and = there is the > corresponding constants. If several error messages correspond to the = same > constant, then these messages are for different OS. >=20 > +-- 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) > +-- EAI_NONAME > + if err =3D=3D 'getaddrinfo: nodename nor servname provided, or = not known' or > +-- EAI_SERVICE > + err =3D=3D 'getaddrinfo: Servname not supported for = ai_socktype' or > +-- EAI_NONAME > + err =3D=3D 'getaddrinfo: Name or service not known' or > +-- EAI_NONAME > + err =3D=3D 'getaddrinfo: hostname nor servname provided, or = not known' or > +-- EAI_AGAIN > + err =3D=3D 'getaddrinfo: Temporary failure in name resolution' = or > +-- EAI_AGAIN > + err =3D=3D 'getaddrinfo: Name could not be resolved at this = time' then > + return true > + end > + return false > +end; >=20 >> And, please (AFAIR I already asked), comment which message is for = which >> EAI_* constant. >>=20 >> WBR, Alexander Turenko.