Jetty

Temporary file collision (??)

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 6.0.2
  • Fix Version/s: 6.1.0rc0
  • Component/s: None
  • Labels:
    None
  • Environment:
    Java 1.5.0_08 on either Windows XT or Linux
  • Number of attachments :
    0

Description

I have two web applications that are deployed from war files. The two applications have different context paths defined in their web-jetty.xml file, but both end up with the same temporary file. (Actually, when the second war is unpacked, the contents of the first are lost.)

Here are some snippets from the debug log:

2006-11-30 15:31:41.911::DEBUG: Created temp dir C:\DOCUME~1\JEFFRE~1.AGU\LOCALS~1\Temp\Jetty_0_0_0_0_80___ for org.mortbay.jetty.webapp.WebAppContext@29ce8c{/,null}
2006-11-30 15:31:41.943::INFO: Extract jar:file:/C:/projects-3.x/redcondor/build/services.war!/ to C:\DOCUME~1\JEFFRE~1.AGU\LOCALS~1\Temp\Jetty_0_0_0_0_80___\webapp
2006-11-30 15:31:41.943::DEBUG: Extract jar:file:/C:/projects-3.x/redcondor/build/services.war!/ to C:\DOCUME~1\JEFFRE~1.AGU\LOCALS~1\Temp\Jetty_0_0_0_0_80___\webapp

a few moments later:

2006-11-30 15:31:42.755::DEBUG: Created temp dir C:\DOCUME~1\JEFFRE~1.AGU\LOCALS~1\Temp\Jetty_0_0_0_0_80___ for org.mortbay.jetty.webapp.WebAppContext@59a34{/,null}
2006-11-30 15:31:42.771::INFO: Extract jar:file:/C:/projects-3.x/redcondor/build/dashboard.war!/ to C:\DOCUME~1\JEFFRE~1.AGU\LOCALS~1\Temp\Jetty_0_0_0_0_80___\webapp
2006-11-30 15:31:42.771::DEBUG: Extract jar:file:/C:/projects-3.x/redcondor/build/dashboard.war!/ to C:\DOCUME~1\JEFFRE~1.AGU\LOCALS~1\Temp\Jetty_0_0_0_0_80___\webapp

The services.war declares

<Configure class="org.mortbay.jetty.webapp.WebAppContext"><Set name="contextPath" type="String">/services</Set></Configure>

in web-jetty.xml. The dashboard.war run as a root context and does not declare a context path. Neither of the two webapps have virtual hosts defined.

In reading (an older) Jetty FAQ, the assigned temporary file names appear to be incorrect.

Activity

Hide
Tim Vernum added a comment -

It took me a little while to get my head around this, but suddenly the cause is obvious. (Not sure what the best fix is though)

You wrote: "The services.war declares [the context path] in web-jetty.xml", but that's not read until after the war file is expanded. At the time of expansion both the war files have a blank context path.

The simplest work around for you would be to put some sort of context path for services.war inside your main jetty.xml (or which ever file you have doing the deploying). That will force the expansion directories to be different.

Perhaps we need to include the identity hashcode of the WAC in the deployment directory?

Show
Tim Vernum added a comment - It took me a little while to get my head around this, but suddenly the cause is obvious. (Not sure what the best fix is though) You wrote: "The services.war declares [the context path] in web-jetty.xml", but that's not read until after the war file is expanded. At the time of expansion both the war files have a blank context path. The simplest work around for you would be to put some sort of context path for services.war inside your main jetty.xml (or which ever file you have doing the deploying). That will force the expansion directories to be different. Perhaps we need to include the identity hashcode of the WAC in the deployment directory?
Hide
Jeffrey Aguilera added a comment -

Yes. My quick work around was to provide an explicit path for the temporary folder. But the problem in Jetty still remains: The temporary file name is synthesized with an algorithm that is guaranteed to cause collisions, because it uses an uninitialized value for the context-path.

The irony is that I would prefer to have setExtractWar(false) for my webapps, but that does not work either. (See JETTY-134 ... The Jasper/Glassfish stuff chokes with Unable to initialize TldLocationsCache.)

Show
Jeffrey Aguilera added a comment - Yes. My quick work around was to provide an explicit path for the temporary folder. But the problem in Jetty still remains: The temporary file name is synthesized with an algorithm that is guaranteed to cause collisions, because it uses an uninitialized value for the context-path. The irony is that I would prefer to have setExtractWar(false) for my webapps, but that does not work either. (See JETTY-134 ... The Jasper/Glassfish stuff chokes with Unable to initialize TldLocationsCache.)
Hide
Jan Bartel added a comment -

Temporary file names are now generated thus:

"Jetty_"host""port""resourceBase""context"_"+virtualhost+base36 hashcode of whole string

Show
Jan Bartel added a comment - Temporary file names are now generated thus: "Jetty_"host""port""resourceBase""context"_"+virtualhost+base36 hashcode of whole string

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: