[nanomsg] Re: mangos has a compatibility shim

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

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.

Your fetch_test is Linux specific, so I can’t test on the Mac (no /proc)

The earlier failures also seem to be responsible for other failures, as exiting 
without closing the socket leaves the address unusable for other applications.  
(No SO_REUSEADDR).

Now the other thing is that I feel pretty strongly that panic() is the wrong 
choice here.  At least in a library.

I also see $PATH dependencies for goq binary, etc.

I don’t think, at the moment, that mangos/compat is doing anything else wrong 
here.  Unfortunately I don’t have a linux vm to test with handy, so I can’t see 
how much this is just linuxisms and how much might be genuine problems with 
mangos.

-- 
Garrett D'Amore
Sent with Airmail

On May 13, 2014 at 11:27:10 AM, Garrett D'Amore (garrett@xxxxxxxxxx) wrote:


On May 13, 2014 at 10:55:54 AM, Jason E. Aten (j.e.aten@xxxxxxxxx) wrote:

Hi Garrett,

The Socket::Send() method in compat/compat.go:235 should return (int, error), 
rather than just (error) to be API compatible. After I hacked that in (but how 
to get the actual size sent?), I got compilation against compat just fine. 
Excellent!
Ok, cool.  From mangos perspective, its always the whole message.



But sadness ensued when I ran my application's test suite when built against 
compat/mangos.  Stuff just broke with "panic connection closed".  You can try 
my code and its test suite (go test -v) here: https://github.com/glycerine/goq. 
You''ll just have to change one line, line 18 of goq.go, from

nn "github.com/op/go-nanomsg"

to

nn "bitbucket.org/gdamore/mangos/compat"

Thanks again for mangos and compat. I'm really looking forward using the (max 
message size) DOS protection you implemented.


I’ll try this out later today.

- Garrett

Jason



On Sun, May 11, 2014 at 6:08 PM, Jason E. Aten <j.e.aten@xxxxxxxxx> wrote:
On Sun, May 11, 2014 at 5:37 PM, Garrett D'Amore <garrett@xxxxxxxxxx> wrote:
I’ve implemented (at user request) bitbucket.org/gdamore/mangos/compat

Awesome. Thanks Garrett.



Other related posts: