commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kirill Safonov" <kirill.safo...@gmail.com>
Subject potential problem: FtpFileObject caches children when not attached
Date Wed, 12 May 2010 15:07:19 GMT
Hello,

 

While digging a bit into FTP performance, I've noticed the following:

 

When FtpFileObject.refresh() is called, FtpFileObject.children field is
reset to null in FtpFileObject.doDetach(), and AbstractFileObject.attached
flag is set to false (this is OK)

But, if then FtpFileObject.getChildFile() is called (this may happen when
getType() is invoked for one of the child files - see below), current
implementation will ignore 'attached' state and silently fill children cache
by calling doGetChildren().

 

The result is that FtpFileObject remains in inconsistent state: it is not
attached with AbstractFileObject.type field = null, child names cache
(AbstractFileObject.children)  = null, but has children cache bulit.

 

I'm not currently sure which consequences it may cause.

 

What I've found up to date is that when I load list of children I see that
two FTP LIST commands are issued: 

-          first one is to list the children themselves

-          then parent file is refreshed since CacheStrategy is ON_RESOLVE
(this is actually another issue I'd like to discuss, since it gives a
performance drop clearing the children cache right after is was build)

-          and then another LIST call that comes from child.getType(). If
there was no inconsistency I described above, this LIST would have been
called for each of the children.

 

Hope all this makes sense,

 Regards,

 Kirill


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message