I did some more testing and the two functions i pointed out do no harm and
return immediately.
The function that is causing the hang is in FtpDataConnection as you pointed
out:
public synchronized Socket getDataSocket() {
...
m_dataSoc = m_servSoc.accept();
...
}
Yes i would definetely add a timeout for m_servSoc.
Without a timeout this function waits forever, when the data connection is
not established. This is not good and there are several reasons why this
coud happen (Server side-firewalls, client-side firewalls, broken ftp
clients,broken network connections...).
Does this function have to be synchronized ? Even with a timeout for the
server socket, while the server waits for the incoming data connection, no
other client can connect to the server.
----- Original Message -----
From: "Rana Bhattacharyya" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Monday, April 24, 2006 7:17 AM
Subject: Re: Bug, Server locks up because of firewall issues
Hi,
new RequestHandler() handles the new connection. It
does not handle the passive mode data transfer.
FtpDataConnection class handles all data connections
(both active and passive). So you are suggesting to
close the passive server socket if there is no client
connections within a speified time to prevent server
lock out. Please write your comments.
Thanks,
Rana Bhattacharyya
--- Jens Viebig <[EMAIL PROTECTED]> wrote:
Hi List,
I found a situation where the ftp server locks up
and no new connections can be made.
ftpserver runs behind a firewall with open port 21
and runs fine with clients working in active mode.
When a client tries to connect in passive mode, the
data connection is blocked by the firewall. This is
the point where the server locks up. It seems that
the server is waiting for the incoming data
connection that is never established because of the
firewall.
The main thread executes two functions after
accepting the client socket connection
IConnection connection = new
RequestHandler(m_ftpConfig, soc);
conManager.newConnection(connection);
it seems that one of the functions causes the
hangup. In my understanding of server architecture
the thread handling the client connection should be
forked immediately after the accept() of the socket
or the functions should have a very short timeout,
because no new connections can be established while
these functions are executed.
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com