For Programmers: Free Programming Magazines  


Home > Archive > PERL POE > June 2005 > Filedescriptor Leak









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Filedescriptor Leak
Markus Müller

2005-06-08, 9:04 pm

Hi Folks,

-jail-2.05b$ perl -MPOE -e 'print $POE::VERSION, "\n"'
0.29
-jail-2.05b$

I found a Filedescriptor l ...
I wrote a FTP-bouncer, a tcprelay with some more functions (identd for
example). It forwards only the controll connection, not the data
connection. If I connect to the relay, and then disconnect I every time
have one more line of this in lsof:

bouncer.p 14586 nick 24u sock 0,4 864749 can't
identify protocol

This increases and increases, on each connect/disconnect, and then some
object dies (only one of the socketfactories) with too many open files.
The thing is, if I remove the following line, this doesn´t occure:

$kernel->detach_myself();

What is false to use this to detach object from the parent object? It is
needed for the reinit of the config, for not terminating the open
connetions. Must I then do things myself for destroying SocketFactories?

Debuginformation:

xx1-xx-xxx-xx is IP of Server, xx2-xx-xxx-xx is IP of Targetserver and
xx3-xx-xxx-xx is IP of Client. The files /beforeall, ./connected,
../disconnected, b2.cfg and the script itself are attached.

-jail-2.05b$ ./bouncer.pl b2.cfg &
[1] 15466
-jail-2.05b$ FOUND KEY:ListenIP:xx1-xx-xxx-xx_
FOUND KEY:DestinationIP:xx2-xx-xxx-xx_:
FOUND KEY:Name:BouncerCurry:
FOUND KEY:ListenPort:58122:
FOUND KEY:DestinationPort:64281:
+ Redirecting xx1-xx-xxx-xx:58122 to xx2-xx-xxx-xx:64281

-jail-2.05b$ ps -auxww|grep bouncer.pl
15466 ttyp6 00:00:00 bouncer.pl
-jail-2.05b$ ./lsof -p 15466 >./beforeall
-jail-2.05b$ [5] Accepted connection from xx3-xx-xxx-xx:4308
[5] xx1-xx-xxx-xx:47175 <-> xx3-xx-xxx-xx:4308 established.
[5] Resolving identd (ClientIP: xx3-xx-xxx-xx, ClientPort: 4308,
LocalIP: xx3-xx-xxx-xx_, LocalPort: 47175, BuggyIdent: 1)
[5] Couldn't get identd: Error UKNOWN-ERROR
[5] Resolving reverse xx3-xx-xxx-xx
[5] Found reverse for xx3-xx-xxx-xx the host
xx3-xx-xxx-xx.customer.m-online.net
[5] -> 'IDNT
NoIdentd@xx3-xx-xxx-xx:host-xx3-xx-xxx-xx.customer.m-online.net'

-jail-2.05b$ ./lsof -p 15466 >./connected
-jail-2.05b$ [5] Server closed connection.
[5] Closing redirection session

-jail-2.05b$ ./lsof -p 15466 >./disconnected
-jail-2.05b$ wc -l ./beforeall ./connected ./disconnected
25 ./beforeall
28 ./connected
26 ./disconnected
79 total
-jail-2.05b$

-> I´ve one more open file descriptor between beforeall and disconnect!

Thanks for hints,
Markus Mueller


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com