[Mimedefang] Tracking down file descriptors

Kelson kelson at speed.net
Thu Nov 11 17:40:37 EST 2004


OK, this is bugging the heck out of me.  I just upgraded to MD 2.48 from 
2.44, well aware of the need to move anything that opened a file into 
filter_initialize, and I got the dreaded warning about opening file 
descriptors anyway.

I have several places where I open a descriptor, read/write, then close 
it.  Some are in filter_begin, etc., others are in custom functions that 
get called by these.  As far as I can tell, these should cause no 
problems, because the descriptor is always closed by the end of the 
function.

I've searched through my filter, and every single open call is inside a 
function.  Despite this, I still get the "Something in your Perl filter 
appears to have opened a file descriptor outside of any function" 
warning in my logs.

I looked at embperl.c, and if I understand correctly, it seems to be 
counting the number of open descriptors before and after parsing the 
filter. So *something* is opening a descriptor somewhere and not closing 
it.  So I looked at use statements:

use Mail::SPF::Query
use Text::Wrap
use strict

Text::Wrap seemed unlikely, but I commented out Mail::SPF::Query and the 
code that uses it, and that didn't make a difference.

Our filter is split across three files for organization, using 
require(). I don't think this should leave file descriptors hanging 
around, but just to try it, I combined all three files into one.  Same 
thing.

Any suggestions as to where else I should look?

-- 
Kelson Vibber
SpeedGate Communications <www.speed.net>




More information about the MIMEDefang mailing list