[nanomsg] Re: mangos has a compatibility shim

  • From: "Jason E. Aten" <j.e.aten@xxxxxxxxx>
  • To: "Garrett D'Amore" <garrett@xxxxxxxxxx>, nanomsg <nanomsg@xxxxxxxxxxxxx>
  • Date: Tue, 13 May 2014 18:26:53 -0700

On Tue, May 13, 2014 at 5:09 PM, Garrett D'Amore <garrett@xxxxxxxxxx> wrote:

> I’ve fixed the Send signature for mangos/compat.
>
> So looking at this further:
>
>
>         myMsg, err := nnzbus.Recv(0)
>         if err != nil {
>                 panic(err)
>         }
>
> This happens if you *CLOSE* the socket.  E.g. nnzbus.Close().  You can’t
> Recv on such a socket.  If go-nanomsg lets you do this, then its an error.
>  Interestingly enough, it appears that the underlying libnanomsg() lets you
> do this, but I think its an accident (use after free) if this works at all.
>  The actual message would certainly never be delivered.
>

I'm not reading after the close. I added logging to verify this, and pushed
it to the github repo so you can easily verify this. Below is the sequence
of open/close/recv/send during the tests. All tests pass with go-nanomsg.
I'll spin you up a linux vm and send you the creds in a separate email, in
just a second.

jaten@i7:~/pubgoq:master$ for i in `ls -1 openclose*`; do echo $i; cat $i;
done
opencloseLog.pid29264
opencloseLog.pid29269
opencloseLog.pid29273
opencloseLog.pid29277

opencloseLog.pid29283
open 0xc210000460
recv 0xc210000460
recv 0xc210000460
open 0xc210000898
open 0xc210000a10
recv 0xc210000460
open 0xc210000a28
send 0xc210000a10
recv 0xc210000460
recv 0xc210000460
close 0xc210000898
close 0xc210000a10
close 0xc210000a28
close 0xc210000460

opencloseLog.pid29293
open 0xc210000460
recv 0xc210000460
recv 0xc210000460
close 0xc210000460

opencloseLog.pid29314
open 0xc210000460
recv 0xc210000460
recv 0xc210000460
open 0xc210000898
open 0xc210000a10
recv 0xc210000460
open 0xc210000a28
send 0xc210000a10
recv 0xc210000460
recv 0xc210000460
close 0xc210000898
close 0xc210000a10
close 0xc210000a28
close 0xc210000460
jaten@i7:~/pubgoq:master$

Other related posts: