Re: [Exim] pipe() blockage with queryprogram router

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Philip Hazel
Date:  
À: John Vaughan
CC: exim-users
Sujet: Re: [Exim] pipe() blockage with queryprogram router
On Thu, 24 Jul 2003, John Vaughan wrote:

> I need a plumber:


Plumbers are in very short supply, at least in the UK. :-)

> So, to make groups work, I wrote a little perl script which will do the
> hard recursive ldap lookup work and talk to exim via a queryprogram
> router.


Inefficient, but OK for small volume.

> It works just fine for small lists, but when I started getting into my
> bigger lists, there were issues. Bear in mind that this script returns a
> line in the format:
>
> REDIRECT foo@???,bar@???,baz@???...
>
> and the returned line for the largest mailing list I can find is a shade
> over 8Kbytes long...


Aarrgghh!! The queryprogram interface was never designed for handling
data of that size.

> 1) The read buffer for the pipe is way too small (defined at line 191 in
> src/routers/queryprogram.c) and once I bumped that up, it worked better
> (ie, didn't cut off after about the 10th user).


Indeed.

> 2) This is the one that's got me stuck:
> When I test my biggest list (returning an 8k+ line down the pipe) using
> exim -bt <foo> on RedHat 9 (completely patched up to date), exim just
> hangs. If I do the same thing on a similarly setup exim on a solaris 8
> box, it works fine.


I suspect it is to do with the internal size of the pipe. The
queryprogram router waits for the process to finish, then reads the
pipe. This assumes that all the data the process wants to write will fit
into an internal pipe buffer. As I said, queryprogram doesn't expect
more than a few hundred bytes of data... No doubt Linux and Solaris
differ in this respect.

> I'd really like to sort this out on linux because I'd prefer to use linux
> on the mail relays (which is what this'll be). I really don't know enough
> to determine if it's a linux problem, a redhat problem or an exim
> problem, and I've not seen any other similar problem described anywhere...


I think you'll have to find another way of achieving what you want.
Using ${run... in a redirect router is going to suffer from the same
problem. If you can write your script so that it runs as some kind of
socket-based service, then perhaps ${readsocket could be used.

Alternatively, you could use a redirect router with an option like this:

file = ${run .....

Your script places the list of addresses in a file, and returns the name
of the file. Of course, there would have to be some process for cleaning
up the files afterwards.

Philip

--
Philip Hazel            University of Cambridge Computing Service,
ph10@???      Cambridge, England. Phone: +44 1223 334714.
Get the Exim 4 book:    http://www.uit.co.uk/exim-book