[zeromq-dev] Using zeroMQ socket from freeradius module
Max Kuznecov
mek at mek.uz.ua
Fri Jul 6 16:08:48 CEST 2012
Hi!
I'm facing a strange problem which I'm unable to resolve for about a
week, so I decided to ask in the list as a last resort.
I've got a system which collects requests from custom freeradius
account module, stores them in persistent queue on disk and then
serves to the agents, which put them into postgres afterwards.
Here's a brief arch image: http://imageshack.us/photo/my-images/821/archn.png/
In radius module a single 0mq socket (REQ) is instantiated which is
later used for sending requests to collector.
Collector is a separate process which binds on the REP socket (tcp, on
the same port as radius module, of course)
Collector's loop code: http://pastebin.com/xuN4pitv
Radius module code: http://pastebin.com/HhUK4nGG
It uses mutexes as radius calls the function from various threads.
xsend function is a basic wrapper: http://pastebin.com/V3dG0kV9
So, the problem is: when the radius initiates the module, it
successfully creates the context and the socket.
But, when it tries to send a message to the collector, the following happens:
Send operation reports ok (code 0), but when it tries to receive
afterwards it blocks. And the collector doesn't receive the data sent
by module!
I've put a lot of debug printfs all around and the collector just
doesn't seem to complete the recv function call.
But what is the most strange in all this is that if I run radius with
debug flag (-X) which tell it to run in single threaded and in
foreground - everything works just as planned - modules sends messages
to collector, collector replies etc. Even when I supply a -f option to
radiusd, which just evades calling fork() it still works. It doesn't
only when radius daemon is run in background.
So, basically this is what I cannot understand, if it didn't work in
any case I'd understand, but this...
Maybe anybody could came up with any idea about what's wrong here. I'd
be greatly appreciated!
--
~syhpoon
More information about the zeromq-dev
mailing list