[nanomsg] Re: Abort on recoverable error?

  • From: Martin Sustrik <sustrik@xxxxxxxxxx>
  • To: nanomsg@xxxxxxxxxxxxx
  • Date: Tue, 02 Sep 2014 08:28:41 +0200

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Yes. It's a bug, or rather missing feature. What should happen in case
of this error is to wait for a while and re-bind later on. The code
for that is still missing though.

Martin

On 02/09/14 08:06, Matt Howlett wrote:
> 
> I agree completely... the way abort is used in nanomsg prevents me
> from using it in scenarios I otherwise would like to.
> 
> 
> On Tue, Sep 2, 2014 at 3:56 PM, Garrett D'Amore
> <garrett@xxxxxxxxxx <mailto:garrett@xxxxxxxxxx>> wrote:
> 
> I'd argue that's a bug.  And yet, I see lots of these things in
> the underlying code now that I look. :-(
> 
> Libraries should only ever abort() in the event that the library 
> developer created a bug -- and *every* case where the library 
> abort()'s or fails an assertion should be treated as a high
> priority bug.
> 
> 
> On Mon, Sep 1, 2014 at 10:49 PM, Jihyun Yu <yjh0502@xxxxxxxxx 
> <mailto:yjh0502@xxxxxxxxx>> wrote:
> 
> Hi,
> 
> It seems that nanomsg aborts on recoverable error. For example 
> following code fails with abort();
> 
> == #include <nanomsg/nn.h> #include <nanomsg/pubsub.h>
> 
> int main(void) { int socket = nn_socket(AF_SP, NN_PUB); if(socket <
> 0) return socket; int tp1 = nn_bind(socket, "tcp://*:11234"); 
> if(tp1 < 0) return tp1; int tp2 = nn_bind(socket,
> "tcp://*:11234"); if(tp2 < 0) return tp2;
> 
> return 0; } ==
> 
> Here's an output
> 
> == Address already in use [98] (src/transports/tcp/btcp.c:378) 
> /bin/bash: line 1: 22624 Aborted                 ./a.out ==
> 
> I'm writing Erlang binding of nanomsg[1], and calling abort()
> inside library functions is not acceptable in Erlang. Is the
> design intentional?
> 
> 
> [1] https://github.com/yjh0502/nanomsg
> 
> 
> 

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJUBWOTAAoJENTpVjxCNN9Y7K0H/i0jXyX2IlndH9NBXxmPczE6
c/28+cdUfLD6N/xs0+d4BltXPpa0WObjJvl5OhufPi23E2QlbBNq5zYUviQDZ6Qn
xKhnpCOwTc8G3n/f5Mt/5iou5chPnGO8A8nJS8Yii+IfYJItXT9o969+VFXXci/x
qvCMW5jQqvo6rD03k4k2m8mH/1m48/Lbfu3VFu64j6Gtpc2AeurjF144aCmr+0PC
KS0zgFe5E8AgDMZLcEWBvXSLYO3yeSCP8CyF+lyIKRvkXd9eQYOOfjVvxhunl1/1
hbHWbViARTL7nLa7x4HPBQ7m4lOBjwLJf2wHcAFO8IrNXcl2i9TRJ23+d8Ke2KQ=
=Zn7a
-----END PGP SIGNATURE-----

Other related posts: