incubator-ftpserver-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rana Bhattacharyya <ran...@yahoo.com>
Subject Re: Bug, Server locks up because of firewall issues
Date Fri, 05 May 2006 13:39:01 GMT
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 <alp-ozaki@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 <rana_b@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 <jviebig@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" <rana_b@yahoo.com>
> > > To: <ftpserver-dev@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 <jviebig@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 

Mime
View raw message