Static resources disappear

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Static resources disappear

Jean-Baptiste Quenot
Hi there,

Using Hudson  1.115, all  static resources (images,  CSS, favicon)
disappear regularly  from Hudson's  web pages.  I have  to restart
Jetty every time it happens. Believe me the look is ugly with only
HTML :-)

For example /hudson/images/title.png gives a 404

I'm  using Jetty  6.1.3 and  Hudson is  deployed as  a WAR  in the
webapps directory (automatically expanded by Jetty).

Any idea?
--
     Jean-Baptiste Quenot
aka  John Banana   Qwerty
http://caraldi.com/jbq/

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Static resources disappear

Kohsuke Kawaguchi
Administrator
Jean-Baptiste Quenot wrote:

> Hi there,
>
> Using Hudson  1.115, all  static resources (images,  CSS, favicon)
> disappear regularly  from Hudson's  web pages.  I have  to restart
> Jetty every time it happens. Believe me the look is ugly with only
> HTML :-)
>
> For example /hudson/images/title.png gives a 404
>
> I'm  using Jetty  6.1.3 and  Hudson is  deployed as  a WAR  in the
> webapps directory (automatically expanded by Jetty).
>
> Any idea?
Does this problem start to happen when you upgraded to 1.115? Do you
know of any known version where this used to work?

Hudson's edit/build/debug cycle uses Jetty, so it's bit puzzling why
this can happen. I don't remember touching this part of the code lately,
either.

Does the problem still happen if you try a fresh Jetty installation?

If you think this is really a genuine hudson issue, please file a bug.

--
Kohsuke Kawaguchi
Sun Microsystems                   [hidden email]

smime.p7s (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Static resources disappear, suspect is Stapler

Jean-Baptiste Quenot
OK I did some progress on this bug, and found part of the
explanation:

* Jetty is started, and I access
  /hudson/images/24x24/new-package.gif in my browser

* Everytime I refresh the image in the browser, a reference to the
  image is kept open, leading to a leak of file descriptors:

$ lsof | grep new-package.gif
java       1576    jetty   16u      REG        9,0      1172     879163 /tmp/Jetty_127_0_0_1_8888_hudson.war__hudson__u006me/webapp/images/24x24/new-package.gif
java       1576    jetty   17u      REG        9,0      1172     879163 /tmp/Jetty_127_0_0_1_8888_hudson.war__hudson__u006me/webapp/images/24x24/new-package.gif
java       1576    jetty   18u      REG        9,0      1172     879163 /tmp/Jetty_127_0_0_1_8888_hudson.war__hudson__u006me/webapp/images/24x24/new-package.gif
java       1576    jetty   19u      REG        9,0      1172     879163 /tmp/Jetty_127_0_0_1_8888_hudson.war__hudson__u006me/webapp/images/24x24/new-package.gif
java       1576    jetty   21u      REG        9,0      1172     879163 /tmp/Jetty_127_0_0_1_8888_hudson.war__hudson__u006me/webapp/images/24x24/new-package.gif
java       1576    jetty   23r      REG        9,0      1172     879163 /tmp/Jetty_127_0_0_1_8888_hudson.war__hudson__u006me/webapp/images/24x24/new-package.gif
java       1576    jetty   25w      REG        9,0      1172     879163 /tmp/Jetty_127_0_0_1_8888_hudson.war__hudson__u006me/webapp/images/24x24/new-package.gif
java       1576    jetty   26r      REG        9,0      1172     879163 /tmp/Jetty_127_0_0_1_8888_hudson.war__hudson__u006me/webapp/images/24x24/new-package.gif
java       1576    jetty   27w      REG        9,0      1172     879163 /tmp/Jetty_127_0_0_1_8888_hudson.war__hudson__u006me/webapp/images/24x24/new-package.gif
java       1576    jetty   28r      REG        9,0      1172     879163 /tmp/Jetty_127_0_0_1_8888_hudson.war__hudson__u006me/webapp/images/24x24/new-package.gif
java       1576    jetty   29w      REG        9,0      1172     879163 /tmp/Jetty_127_0_0_1_8888_hudson.war__hudson__u006me/webapp/images/24x24/new-package.gif
java       1576    jetty   30r      REG        9,0      1172     879163 /tmp/Jetty_127_0_0_1_8888_hudson.war__hudson__u006me/webapp/images/24x24/new-package.gif

* If I hold the Shift key down while clicking Refresh, this
  resource leak cannot be observed

If you look at Stapler's source code, you'll notice that the
file input stream is not closed when returning the NOT_MODIFIED
status code.

See attached patch (I didn't use Bugzilla because it looked
empty).

Cheers,
--
     Jean-Baptiste Quenot
aka  John Banana   Qwerty
http://caraldi.com/jbq/

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

20070719-stapler-Stapler-serveStaticResource.txt (945 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Static resources disappear, suspect is Stapler

Jean-Baptiste Quenot
And here is the workaround: add a new servlet mapping after the
stapler servlet definition to request Jetty itself to serve images
directly:

  <servlet>
    <servlet-name>Stapler</servlet-name>
    <servlet-class>org.kohsuke.stapler.Stapler</servlet-class>
  </servlet>

  <servlet-mapping>
    <servlet-name>default</servlet-name>
    <url-pattern>/images/*</url-pattern>
  </servlet-mapping>

The same should be done for css and scripts.
--
     Jean-Baptiste Quenot
aka  John Banana   Qwerty
http://caraldi.com/jbq/

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Static resources disappear, suspect is Stapler

Kohsuke Kawaguchi
Administrator
In reply to this post by Jean-Baptiste Quenot
Jean-Baptiste Quenot wrote:
> If you look at Stapler's source code, you'll notice that the
> file input stream is not closed when returning the NOT_MODIFIED
> status code.

Yep. Committed a fix. I'll integrate this into Hudson 1.120.

--
Kohsuke Kawaguchi
Sun Microsystems                   [hidden email]

smime.p7s (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Static resources disappear, suspect is Stapler

Jean-Baptiste Quenot
* Kohsuke Kawaguchi:
> Jean-Baptiste Quenot wrote:
> >If you look at Stapler's source code, you'll notice that the
> >file input stream is not closed when returning the NOT_MODIFIED
> >status code.
>
> Yep. Committed a fix. I'll integrate this into Hudson 1.120.

I can't see it in the ChangeLog...
--
     Jean-Baptiste Quenot
aka  John Banana   Qwerty
http://caraldi.com/jbq/

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Static resources disappear, suspect is Stapler

Kohsuke Kawaguchi
Administrator
Jean-Baptiste Quenot wrote:
> * Kohsuke Kawaguchi:
>> Jean-Baptiste Quenot wrote:
>> >If you look at Stapler's source code, you'll notice that the
>> >file input stream is not closed when returning the NOT_MODIFIED
>> >status code.
>>
>> Yep. Committed a fix. I'll integrate this into Hudson 1.120.
>
> I can't see it in the ChangeLog...

Sorry, I forgot to bump up the stapler dependency in hudson, and I had
to get 1.120 out to release the security fix.

This change will be in 1.121.


--
Kohsuke Kawaguchi
Sun Microsystems                   [hidden email]

smime.p7s (4K) Download Attachment