"Peter J. Holzer" <hjp-pgsql@hjp.at> writes:
> But there is something else which may be relevant: �MQ uses threads
> internally, and I don't actually know whether zmq_msg_recv returning
> means that the read(2) call (or whatever) on the socket terminates.
... ugh ...
> Postgres worker processes are single-threaded, are they? Is there
> something else which could interact badly with a moderately complex
> multithreaded I/O library used from a stored procedure?
Yes, lots. If you cause additional threads to appear inside a backend
process, things could break arbitrarily badly. It's up to you to ensure
that none of those extra threads ever escape to execute any non-Perl
code. I suspect this could easily explain the problems you're seeing.
regards, tom lane