celluloid / celluloid-zmq

UNMAINTAINED: See celluloid/celluloid#779 - Celluloid actors that talk over the 0MQ protocol
https://celluloid.io
MIT License
83 stars 25 forks source link

Added multipart string reader #34

Closed Asmod4n closed 10 years ago

Asmod4n commented 10 years ago

Sending and recieving multipart string messages is only supported on XREQ, XREP, Router and Dealer sockets, afaik. At least i couldn't get it to work with normal REQ, REP sockets.

coveralls commented 10 years ago

Coverage Status

Coverage decreased (-65.96%) when pulling c25bb2f9ea108a245ebee8e3a18b85b94b04b537 on Asmod4n:patch-1 into 4c2ab1af7b757ab7b5f4758afe09743c141c46ea on celluloid:master.

Asmod4n commented 10 years ago

So.. the wait_writable locks the process :?

tarcieri commented 10 years ago

@Asmod4n the process? On what VM?

Asmod4n commented 10 years ago

@tarcieri travis, the socket tests don't do anything, it times them out after 10 minutes.

No idea what it is, really.

Asmod4n commented 10 years ago

Can you somehow trigger another travis run? Locally the tests pass @tarcieri

I need this functionality for https://github.com/Asmod4n/celluloid-zmq-zap :)

Asmod4n commented 10 years ago

Hrm, i still have no idea why it doesn't do anything. I believe inproc changed between zmq 3 and 4.

tarcieri commented 10 years ago

@Asmod4n we should have Travis install the Ubuntu package first

Asmod4n commented 10 years ago

@tarcieri there is no zmq4 package for ubuntu 12.04 (which travis uses, maybe they add 14.04. soonish), have to fetch it from git and compile it :<

But i find it quite amusing(?) that the specs run successfully on ruby-head: https://travis-ci.org/celluloid/celluloid-zmq/jobs/20446393

samlown commented 10 years ago

I've been testing this branch with a "Router" server. The ZMQ.wait_writable in WritableSocket#write causes lots of pain when handling simultaneous requests as it prevents a response from been written on the socket.

Removing the line allows responses to be sent without issue in multiple threads over the same socket. Perhaps I'm missing something as to why this was added?

Asmod4n commented 10 years ago

Could you try https://github.com/Asmod4n/celluloid-zmq-zap/blob/master/examples/curve_redis.rb out with wait_writeable disabled? Afaik i had it in because without it i was getting protocol errors.

You have to comment out Line 61 here https://github.com/Asmod4n/celluloid-zmq-zap/blob/master/lib/celluloid/zmq/zap/celluloid-zmq-ext.rb

samlown commented 10 years ago

I haven't tried your specific example with all the complex curve stuff, but I set-up something similar with the Dealer-Router pattern. Worked fine! Here's my gist:

https://gist.github.com/samlown/10299933

However, I've always found it much easier to use the Req-Router pattern where each incoming request has it's own socket, that way you don't need to deal with matching responses.

Asmod4n commented 10 years ago

Will try it later tomorrow if it still functions without the wait_writable, or else just use it in the Dealer Socket myself.