Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Cc: tarantool-patches@freelists.org
Subject: Re: [tarantool-patches] Re: [PATCH v2 03/11] sio: remove exceptions
Date: Tue, 11 Dec 2018 11:44:28 +0300	[thread overview]
Message-ID: <20181211084428.2ycn4h3vldjkuepr@esperanza> (raw)
In-Reply-To: <1af45eb9-5b6e-9ea7-30d8-fc8ebcf37fa1@tarantool.org>

On Mon, Dec 10, 2018 at 06:37:37PM +0300, Vladislav Shpilevoy wrote:
> On 09/12/2018 15:54, Vladimir Davydov wrote:
> > On Wed, Dec 05, 2018 at 12:28:50AM +0300, Vladislav Shpilevoy wrote:
> > > @@ -40,6 +40,14 @@
> > >   #include "trivia/util.h"
> > >   #include "exception.h"
> > > +enum { SIO_ERROR_FATAL = -2 };
> > > +
> > > +bool
> > > +sio_is_error_fatal(int retcode)
> > > +{
> > > +	return retcode == SIO_ERROR_FATAL;
> > > +}
> > > +
> > >   /** Pretty print socket name and peer (for exceptions) */
> > >   const char *
> > >   sio_socketname(int fd)
> > > @@ -224,9 +234,11 @@ sio_accept(int fd, struct sockaddr *addr, socklen_t *addrlen)
> > >   {
> > >   	/* Accept a connection. */
> > >   	int newfd = accept(fd, addr, addrlen);
> > > -	if (newfd < 0 &&
> > > -	    (errno != EAGAIN && errno != EWOULDBLOCK && errno != EINTR))
> > > -		tnt_raise(SocketError, sio_socketname(fd), "accept");
> > > +	if (newfd < 0 && errno != EAGAIN && errno != EWOULDBLOCK &&
> > > +	    errno != EINTR) {
> > > +		diag_set(SocketError, sio_socketname(fd), "accept");
> > > +		return SIO_ERROR_FATAL;
> > > +	}
> > >   	return newfd;
> > >   }
> > 
> > This looks bad. It's not just my opinion. I consulted with Kostja
> > verbally and he agrees with me.
> > 
> > Let's please set diag on any error in all sio functions and let the
> > caller decide which ones are critical and which are not by checking
> 
> There is a problem - each diag increments error counter visible in
> stat. But I believe you know it, so as you wish.

Well, only ClientErrors are accounted in box.stat(), SocketErrors are
not. However, you're right - setting diag on each EWOULDBLOCK error does
seem to be expensive, because diag_set() implies malloc(). This would be
a pointless overhead.

So we've agreed that we shouldn't set diag on transient errors,
only errno. Kostja reworked and pushed this patch by himself.
For some reason, he also authored it, split it in 5, and did some
minor unnecessary changes (like moving comments).

  reply	other threads:[~2018-12-11  8:44 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-04 21:28 [PATCH v2 00/11] SWIM preparation Vladislav Shpilevoy
2018-12-04 21:28 ` [PATCH v2 01/11] sio: remove unused functions Vladislav Shpilevoy
2018-12-09 12:10   ` Vladimir Davydov
2018-12-04 21:28 ` [PATCH v2 10/11] evio: make code C compatible Vladislav Shpilevoy
2018-12-05  8:56   ` Vladimir Davydov
2018-12-05 20:07     ` [tarantool-patches] " Vladislav Shpilevoy
2018-12-04 21:28 ` [PATCH v2 11/11] evio: turn nto c Vladislav Shpilevoy
2018-12-04 21:28 ` [PATCH v2 02/11] sio: treat EADDRINUSE in sio_listen as error Vladislav Shpilevoy
2018-12-09 12:57   ` Vladimir Davydov
2018-12-10 15:36     ` [tarantool-patches] " Vladislav Shpilevoy
2018-12-04 21:28 ` [PATCH v2 03/11] sio: remove exceptions Vladislav Shpilevoy
2018-12-09 12:54   ` Vladimir Davydov
2018-12-10 15:37     ` [tarantool-patches] " Vladislav Shpilevoy
2018-12-11  8:44       ` Vladimir Davydov [this message]
2018-12-04 21:28 ` [PATCH v2 04/11] sio: make code compatible with C Vladislav Shpilevoy
2018-12-05  8:57   ` Vladimir Davydov
2018-12-05 20:07     ` [tarantool-patches] " Vladislav Shpilevoy
2018-12-04 21:28 ` [PATCH v2 05/11] sio: turn into C Vladislav Shpilevoy
2018-12-04 21:28 ` [PATCH v2 06/11] evio: make on_accept be nothrow Vladislav Shpilevoy
2018-12-04 21:28 ` [PATCH v2 07/11] coio: fix double close of a file descriptor Vladislav Shpilevoy
2018-12-04 21:28 ` [PATCH v2 08/11] evio: remove exceptions Vladislav Shpilevoy
2018-12-04 21:28 ` [PATCH v2 09/11] coio: fix file descriptor leak on accept Vladislav Shpilevoy
2018-12-11  8:47 ` [PATCH v2 00/11] SWIM preparation Vladimir Davydov

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=20181211084428.2ycn4h3vldjkuepr@esperanza \
    --to=vdavydov.dev@gmail.com \
    --cc=tarantool-patches@freelists.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [tarantool-patches] Re: [PATCH v2 03/11] sio: remove exceptions' \
    /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