Welcome! Log In Create A New Profile

Advanced

Re: Question about multiple upstream->peer.free calls

Mike Gagnon
April 11, 2012 11:16AM
Thanks for the feedback! Everything works smoothly now.

Mike Gagnon
On Apr 11, 2012 2:41 AM, "Maxim Dounin" <mdounin@mdounin.ru> wrote:

> Hello!
>
> On Tue, Apr 10, 2012 at 07:50:43PM -0700, Mike Gagnon wrote:
>
> > Hello,
> >
> > I am developing a load-balancing module for nginx. I have noticed that
> > when a peer fails (say because the connection was reset by the peer)
> > the r->upstream->peer.free function is called multiple times on the
> > same peer connection: the first time with state == NGX_PEER_FAILED
> > set, and the second time with state == 0.
> >
> > What is the purpose of calling peer.free multiple times?
>
> There is no real reason, it's more or less bug. It's not yet
> fixed as it doesn't cause any problems with vanilla balancer
> modules (well, actually there is a workaround in upstream
> keepalive, though it's mostly result of the fact it was developed
> as a separate module). We'll likely fix this somewhere in
> 1.3.x.
>
> > Is there a
> > recommended way to tell if a call to peer.free is the first call (for
> > that peer connection)? Or to tell if it is the last call (for that
> > peer connection)?
> >
> > This issue is important for the correctness of my code.
>
> For now I would recommend doing similar thing as upstream
> keepalive does: remember 1st free() call in an internal data and
> ignore subsequent calls.
>
> Maxim Dounin
>
> _______________________________________________
> nginx-devel mailing list
> nginx-devel@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx-devel
>
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

Question about multiple upstream->peer.free calls

Mike Gagnon 1121 April 10, 2012 10:52PM

Re: Question about multiple upstream->peer.free calls

Maxim Dounin 434 April 11, 2012 05:42AM

Re: Question about multiple upstream->peer.free calls

Mike Gagnon 518 April 11, 2012 11:16AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 321
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready