We have a very busy server running 9 clones of a web app server. Each clone
uses DiskFileUpload, and most of the incoming files are cached to disk. We
discovered that in rare instances, two clones will attempt to write to the
same file, causing corruption.

We discovered that getUniqueId (which is used to create tmp file name) is
not guaranteed unique across class loaders (it's written in the code
comments -- thank you). One solution to the file collisions is to force each
clone to write to a different tmp directory. However, we would prefer to not
have to worry about managing multiple tmp directories.

Are there any suggestions as to the best way to modify the getUniqueId
method to return a unique ID across class loaders? We are thinking along the
lines of injecting a random number to concatenate with the static counter in
the DefaultFileItem, (or grabbing the start timestamp off the jvm) to create
unique names.

Thanks,
Mike

Reply via email to