0rpc / zerorpc-node

zerorpc for node.js
http://www.zerorpc.io
Other
707 stars 167 forks source link

Streaming responses example error #37

Open 1am opened 10 years ago

1am commented 10 years ago

Hi,

I've been testing streaming responses example from http://zerorpc.dotcloud.com/ website and there seems to be a small problem when i set node.js as server and python as client. Oposite configuration works correctly. I've tried using different ports, etc. but nothing seems to solve the issue. Node server is started first and later I launch the client script. Does somebody know what could solve the problem?

Python client response:

# python client.py 
Traceback (most recent call last):
  File "client.py", line 6, in <module>
    for item in c.streaming_range(10, 20, 2):
  File "/Library/Python/2.7/site-packages/zerorpc/core.py", line 260, in <lambda>
    return lambda *args, **kargs: self(method, *args, **kargs)
  File "/Library/Python/2.7/site-packages/zerorpc/core.py", line 245, in __call__
    return self._process_response(request_event, bufchan, timeout)
  File "/Library/Python/2.7/site-packages/zerorpc/core.py", line 220, in _process_response
    reply_event, self._handle_remote_error)
  File "/Library/Python/2.7/site-packages/zerorpc/patterns.py", line 44, in process_answer
    raise exception
zerorpc.exceptions.RemoteError: Error: None

Node.js server response (after I run python client):

# node server.js 

/usr/local/lib/node_modules/zerorpc/lib/channel.js:164
        throw new Error("Cannot send on closed channel");
              ^
Error: Cannot send on closed channel
    at ServerChannel.Channel.send (/usr/local/lib/node_modules/zerorpc/lib/channel.js:164:15)
    at sendError (/usr/local/lib/node_modules/zerorpc/lib/server.js:125:12)
    at Server._recv (/usr/local/lib/node_modules/zerorpc/lib/server.js:180:9)
    at MultiplexingSocket.<anonymous> (/usr/local/lib/node_modules/zerorpc/lib/server.js:86:46)
    at MultiplexingSocket.emit (events.js:95:17)
    at MultiplexingSocket.<anonymous> (/usr/local/lib/node_modules/zerorpc/lib/socket.js:106:18)
    at MultiplexingSocket.emit (events.js:95:17)
    at null.<anonymous> (/usr/local/lib/node_modules/zerorpc/lib/socket.js:61:14)
    at emit (events.js:106:17)
    at /usr/local/lib/node_modules/zerorpc/node_modules/zmq/lib/index.js:473:27
1am commented 10 years ago

I've also tried server from https://github.com/dotcloud/zerorpc-node#servers with zerorpc cli utility. This time I get no responses with an exception that sometimes iter returns the first value.

Request:

zerorpc tcp://127.0.0.1:4242 iter 11 20 1

Response - sometimes nothing, sometimes this:

'11'

add42 call:

zerorpc tcp://127.0.0.1:4242 add42 12
connecting to "tcp://127.0.0.1:4242"
Traceback (most recent call last):
  File "/usr/local/bin/zerorpc", line 8, in <module>
    load_entry_point('zerorpc==0.4.4', 'console_scripts', 'zerorpc')()
  File "/Library/Python/2.7/site-packages/zerorpc/cli.py", line 265, in main
    return run_client(args)
  File "/Library/Python/2.7/site-packages/zerorpc/cli.py", line 228, in run_client
    results = client(args.command, *call_args)
  File "/Library/Python/2.7/site-packages/zerorpc/core.py", line 245, in __call__
    return self._process_response(request_event, bufchan, timeout)
  File "/Library/Python/2.7/site-packages/zerorpc/core.py", line 226, in _process_response
    raise ex
zerorpc.exceptions.TimeoutExpired: timeout after 30s, when calling remote method add42
rodgerbenham commented 9 years ago

I am also experiencing the same issue, running node.js as the server seems to timeout the request even though the message comes through.