You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ftpserver-dev@incubator.apache.org by Jens Viebig <jv...@como.com> on 2006/04/21 14:46:56 UTC
Bug, Server locks up because of firewall issues
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.
Re: Bug, Server locks up because of firewall issues
Posted by OZAKI Ittetsu <al...@tesltd.co.jp>.
Hi,
It seems my attachement file was lost somewhere.
This time I paste the patch in body. Sorry.
Index: src/java/org/apache/ftpserver/ConnectionManagerImpl.java
===================================================================
--- src/java/org/apache/ftpserver/ConnectionManagerImpl.java (revision 407453)
+++ src/java/org/apache/ftpserver/ConnectionManagerImpl.java (working copy)
@@ -230,9 +230,9 @@
if(conList == null) {
return;
}
+ conList = new Vector(conList);
// get inactive client connection list
- synchronized(conList) {
for( int i = conList.size(); --i>=0; ) {
IConnection con = (IConnection)conList.get(i);
if(con == null) {
@@ -263,7 +263,6 @@
}
}
}
- }
// close idle client connections
for( Iterator conIt=inactiveCons.iterator(); conIt.hasNext(); ) {
Thanks,
OZAKI Ittetsu
Re: Bug, Server locks up because of firewall issues
Posted by OZAKI Ittetsu <al...@tesltd.co.jp>.
Rana,
A patch attached which modifies the timerTask.
> We shall modify the timerTask to use
> a clone of the connection list.
Is "We" mean Rana and the other committers,
or Rana and me?
Sorry, I am bad at english..
Thanks,
OZAKI Ittetsu
On Fri, 5 May 2006 06:39:01 -0700 (PDT)
Rana Bhattacharyya <ra...@yahoo.com> wrote:
> Hi,
>
> I am sorry for the late reply. I think you have a
> valid point. The problem you are mentioning is that
> the client processing will not start if it begins
> during the timerTask as it is synchronized over the
> connection list. We shall modify the timerTask to use
> a clone of the connection list.
>
> Thanks for pointing this.
>
> - Rana Bhattacharyya
>
>
> --- OZAKI Ittetsu <al...@tesltd.co.jp> wrote:
>
> >
> > Hi,
> >
> > I was encountering this problem.
> > Thank you very much for fixing the code.
> >
> > BTW, part of the reason for this problem is
> > synchronized
> > conList, accessed by timerTask() and
> > newConnection().
> >
> > When servSoc.accept() blocks, conList is kept locked
> > by
> > timerTask() until servSoc.accept() returns.
> > So newConnection() has to wait, because
> > conList.add()
> > is synchronized.
> >
> > I guess it's better that timerTask() iterates over
> > "clone" of conList, than synchronizes on it.
> > How do you think?
> >
> > Thanks,
> > OZAKI Ittetsu
> >
> >
> > On Mon, 24 Apr 2006 03:14:06 -0700 (PDT)
> > Rana Bhattacharyya <ra...@yahoo.com> wrote:
> >
> > > Hi,
> > >
> > > Thank you very much for replying. You are
> > absolutely
> > > right. I shall add one data connection
> > configuration
> > > parameter to set the server socket timeout.
> > Basically
> > > I shall set the SO_TIMEOUT.
> > >
> > > FtpDataConnection is not shared in multiple
> > > connections. Each ftp session has a
> > FtpDataConnection
> > > instance. So other client can open data connection
> > > when server is waiting for one client.
> > >
> > > These are synchronized because, the FTP session
> > > cleaner removes idle connections at specified
> > interval
> > > and this timer thread can mess-up if these methods
> > are
> > > not synchronized.
> > >
> > > Thanks,
> > > Rana Bhattacharyya
> > >
> > >
> > > --- Jens Viebig <jv...@como.com> wrote:
> > >
> > > > 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" <ra...@yahoo.com>
> > > > To: <ft...@incubator.apache.org>
> > > > 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 <jv...@como.com> 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
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> > > __________________________________________________
> > > Do You Yahoo!?
> > > Tired of spam? Yahoo! Mail has the best spam
> > protection around
> > > http://mail.yahoo.com
> >
> >
> >
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
--
OZAKI Ittetsu <al...@tesltd.co.jp>
Re: Bug, Server locks up because of firewall issues
Posted by Rana Bhattacharyya <ra...@yahoo.com>.
Hi,
I am sorry for the late reply. I think you have a
valid point. The problem you are mentioning is that
the client processing will not start if it begins
during the timerTask as it is synchronized over the
connection list. We shall modify the timerTask to use
a clone of the connection list.
Thanks for pointing this.
- Rana Bhattacharyya
--- OZAKI Ittetsu <al...@tesltd.co.jp> wrote:
>
> Hi,
>
> I was encountering this problem.
> Thank you very much for fixing the code.
>
> BTW, part of the reason for this problem is
> synchronized
> conList, accessed by timerTask() and
> newConnection().
>
> When servSoc.accept() blocks, conList is kept locked
> by
> timerTask() until servSoc.accept() returns.
> So newConnection() has to wait, because
> conList.add()
> is synchronized.
>
> I guess it's better that timerTask() iterates over
> "clone" of conList, than synchronizes on it.
> How do you think?
>
> Thanks,
> OZAKI Ittetsu
>
>
> On Mon, 24 Apr 2006 03:14:06 -0700 (PDT)
> Rana Bhattacharyya <ra...@yahoo.com> wrote:
>
> > Hi,
> >
> > Thank you very much for replying. You are
> absolutely
> > right. I shall add one data connection
> configuration
> > parameter to set the server socket timeout.
> Basically
> > I shall set the SO_TIMEOUT.
> >
> > FtpDataConnection is not shared in multiple
> > connections. Each ftp session has a
> FtpDataConnection
> > instance. So other client can open data connection
> > when server is waiting for one client.
> >
> > These are synchronized because, the FTP session
> > cleaner removes idle connections at specified
> interval
> > and this timer thread can mess-up if these methods
> are
> > not synchronized.
> >
> > Thanks,
> > Rana Bhattacharyya
> >
> >
> > --- Jens Viebig <jv...@como.com> wrote:
> >
> > > 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" <ra...@yahoo.com>
> > > To: <ft...@incubator.apache.org>
> > > 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 <jv...@como.com> 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
> > > >
> > > >
> > >
> > >
> >
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Tired of spam? Yahoo! Mail has the best spam
> protection around
> > http://mail.yahoo.com
>
>
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Re: Bug, Server locks up because of firewall issues
Posted by OZAKI Ittetsu <al...@tesltd.co.jp>.
Hi,
I was encountering this problem.
Thank you very much for fixing the code.
BTW, part of the reason for this problem is synchronized
conList, accessed by timerTask() and newConnection().
When servSoc.accept() blocks, conList is kept locked by
timerTask() until servSoc.accept() returns.
So newConnection() has to wait, because conList.add()
is synchronized.
I guess it's better that timerTask() iterates over
"clone" of conList, than synchronizes on it.
How do you think?
Thanks,
OZAKI Ittetsu
On Mon, 24 Apr 2006 03:14:06 -0700 (PDT)
Rana Bhattacharyya <ra...@yahoo.com> wrote:
> Hi,
>
> Thank you very much for replying. You are absolutely
> right. I shall add one data connection configuration
> parameter to set the server socket timeout. Basically
> I shall set the SO_TIMEOUT.
>
> FtpDataConnection is not shared in multiple
> connections. Each ftp session has a FtpDataConnection
> instance. So other client can open data connection
> when server is waiting for one client.
>
> These are synchronized because, the FTP session
> cleaner removes idle connections at specified interval
> and this timer thread can mess-up if these methods are
> not synchronized.
>
> Thanks,
> Rana Bhattacharyya
>
>
> --- Jens Viebig <jv...@como.com> wrote:
>
> > 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" <ra...@yahoo.com>
> > To: <ft...@incubator.apache.org>
> > 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 <jv...@como.com> 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
> > >
> > >
> >
> >
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
Re: clean up, config and proxy issues
Posted by Ricardo <ri...@ageto.de>.
Hi,
> First of all, I would like to apologize for
> missing your mail. Sometime, I become too busy in my
> office work and it becomes very difficult to response
> properly. Anyway, this is not an excuse. I am really
> sorry.
No problem at all -
(first I guess my questions are not good enough to be answered ;)
> Recently, I have uploaded a new version where local
> port 20 is supported.
Fine, I'll try it out next time.
> I do not understand you question about SSL. Can you
> please elaborate it?
At this I just wanne know, if it's possible to let users connect via
SECURE CONNECTION (using SSL) and also allows users without SSL to
connect, too.
Basically thought "YES-sure"; but I just wanne verify that.
> I am not sure which module will translate the HTTP
> request to FTP request? Is it the proxy server? Again
> some pointer will help us.
That's not so easy as it maybe sounds first ... I figure out that it's
not really possible by using the "mod_ftp_proxy" or other proxy options
from apache webserver.
The proxy implementations are just plain CERN-Proxy.
So it would be only possible to redirect the HTTP-Requests to a
FTP-Server, but not a "transparent usage" in two directions (so there is
currently GET supported only).
If someone got an other idea how to proxying FTP-Request in two
directions (so user doesn't kow/feel the proxy) - I will listen.
So at last, I just wanne know if there are any reasons for don't change
basic structure of application (i.e. set "log"-Dir out ouf "res" and so
on...)
Hope I make myself clear, if anything is left, feel free to contact.
Thanks again for answering - and your great effort here!
Best regards,
Ricardo
Re: clean up, config and proxy issues
Posted by Rana Bhattacharyya <ra...@yahoo.com>.
Hi,
First of all, I would like to apologize for
missing your mail. Sometime, I become too busy in my
office work and it becomes very difficult to response
properly. Anyway, this is not an excuse. I am really
sorry.
Recently, I have uploaded a new version where local
port 20 is supported.
I do not understand you question about SSL. Can you
please elaborate it?
I am not sure which module will translate the HTTP
request to FTP request? Is it the proxy server? Again
some pointer will help us.
Thanks,
Rana Bhattacharyya
----------------------------------------------
Hi,
I got some questions about the files, dirs and the
usage of the FTP server.
The useraccounts are created by an application in
background (stored in db).
So there is no need for a ui or direct user creation/
update/ delete
possibility (start as windows service).
Can I disable the user-queries I don't need?
(Or is there some reason leave them in, also the files
like user.gen,
ftpd_ui.x...?)
Additional I've got a question about the usage behind
a proxy on same
machine/ server.
The port 20 is declared for data connection, so how
the configuration will
be handled when using the
<pasv-port>0</pasv-port>
for configuration in [ftp.xml]? I'm not sure how to
interpret "any free" in
the doc?
Does these config will cause problems in combination
with a proxy?
I've think about something like:
<pasv-port>11033</pasv-port> (and in socketfactory
<port>11034</port>)
... so the proxy have to be informed about the ports?!
(Maybe through [httpd.conf] in Apache2 server dir)
Listen 20
Listen 21
Or shouldn't I care about this issue?
Second point is the secured use over SSL. If I wanne
provide simple AND
secured access over same server, is there anything to
pay attention for? So
the client should choose which security level is
needed.
(Maybe it isn't possible to do so? Or not recommended?
Are there special
needs for the usage with a proxy - except apache SSL
configuration?)
By the way, maybe someone got an idea for a reverse
proxy using apache2
webserver?
I've defined a ftp access over http to connect to the
ftp server indirectly.
But I'm not able to set up the transparent access via
ftp - and I'm not
really sure where/ how to locate the (I think my ;)
mistake.
# [httpd.conf]
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_ftp.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
# http acces to ftp server
ProxyRequests Off
ProxyPass /ftp ftp://192.168.1.120
ProxyPassReverse /ftp ftp://192.168.1.120
So by this a request in browser is possible useing:
http://localhost/ftp
I've also tried to redirect the ftp requests par
"ProxyRemote" into the
httpd.conf
# [httpd.conf]
ProxyRemote ftp ftp://192.168.1.120
Is it possible to define the FTP server as a proxy
here?
If it's not the right place for ask these questions -
I'm sorry in advance,
but I don't know where to look for further
information.
Thanks for reading,
for questions or suggestions feel free to contact,
Ricardo
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam
protection around
http://mail.yahoo.com
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Re: Bug, Server locks up because of firewall issues
Posted by Rana Bhattacharyya <ra...@yahoo.com>.
Hi,
Thank you very much for replying. You are absolutely
right. I shall add one data connection configuration
parameter to set the server socket timeout. Basically
I shall set the SO_TIMEOUT.
FtpDataConnection is not shared in multiple
connections. Each ftp session has a FtpDataConnection
instance. So other client can open data connection
when server is waiting for one client.
These are synchronized because, the FTP session
cleaner removes idle connections at specified interval
and this timer thread can mess-up if these methods are
not synchronized.
Thanks,
Rana Bhattacharyya
--- Jens Viebig <jv...@como.com> wrote:
> 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" <ra...@yahoo.com>
> To: <ft...@incubator.apache.org>
> 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 <jv...@como.com> 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
> >
> >
>
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Re: Bug, Server locks up because of firewall issues
Posted by Jens Viebig <jv...@como.com>.
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" <ra...@yahoo.com>
To: <ft...@incubator.apache.org>
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 <jv...@como.com> 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
>
>
Re: Bug, Server locks up because of firewall issues
Posted by Rana Bhattacharyya <ra...@yahoo.com>.
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 <jv...@como.com> 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