[zeromq-dev] Strange problem with lua-zmq on Windows
Ross Andrews
ross.andrews at gmail.com
Wed Aug 10 19:12:12 CEST 2011
I'm not sure if this is a Windows problem, a Lua problem, a ZeroMQ problem,
or a my-code problem, but after about three weeks I am finally able to
reproduce it in a small example so here goes.
Here's the server:
require 'zmq'
ctx = zmq.init(1)
socket = ctx:socket(zmq.REP)
socket:bind 'tcp://*:4568'
n = 0
while true do
socket:recv()
n = n + 1
print(n)
socket:send('pong')
end
socket:close()
----------
And here's the client:
require 'zmq'
ctx = zmq.init(1)
k = 0
while k < 10 do
local n, sockets = 0, {}
while n < 50 do
local socket = ctx:socket(zmq.REQ)
socket:connect('tcp://localhost:4568')
socket:send('ping')
table.insert(sockets, socket)
n = n + 1
end
for _, socket in ipairs(sockets) do
print(socket:recv())
socket:close()
end
k = k + 1
end
----------
The idea is that I have a client that accepts requests, spawns threads (or
maybe uses a thread pool, either way I can't control it) to handle them.
"Handling them" consists of creating a REQ socket, sending a request to
another (single-threaded) thing to handle them and give a response back, and
then returning the response. I have to make a new socket each time because I
can't control which thread the requesting thing is on, and I can't share ZMQ
sockets across threads.
The problem is that this case thrashes and then eventually kills lua-zmq. It
should handle 500 messages here, actually it dies at an indeterminate point
between about 100 and about 400.
Can anyone give me a clue what's going on?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20110810/7c255823/attachment.htm>
More information about the zeromq-dev
mailing list