users@grizzly.java.net

FileCache blocks stream?

From: André Wallat <andre.wallat_at_gmail.com>
Date: Mon, 2 Sep 2013 17:38:44 +0200

Hello there,

I created a simple HttpServer which serves static content. On a local
(windows) machine everything is working fine. On a remote linux system
(Ubuntu 11.04) however the page takes 30 seconds to load. Those pending
requests are different every time, like javascript files, images or
ajax-calls. It seems that there's a timeout after 30 seconds when the last
resources are finally returned and the webpage is presented correctly.

When the server is started the very first time, then the first time the
page is called, everything is quick. The second time (and the following)
however have this long delay. The log shows several lines of:

org.glassfish.grizzly.http.server.StaticHttpHandlerBase$NonBlockingDownloadHandler
> onWritePossible

FINE: [onWritePossible]

...


for the first request and:

org.glassfish.grizzly.nio.transport.TCPNIOTransport read

FINE: TCPNIOConnection
> (TCPNIOConnection{localSocketAddress={/***.***.***.***:9997},
> peerSocketAddress={/5.10.178.19:63246}}) (allocated) read 562 bytes

...

org.glassfish.grizzly.nio.DefaultSelectionKeyHandler onKeyRegistered

FINE: KEY IS REGISTERED: sun.nio.ch.SelectionKeyImpl_at_1c0c1b7


for the second request, which blocks 30s and then goes on.

When I disable the file-cache however, then there's no 30s wait!

for (NetworkListener l : server.getListeners()) {
> l.getFileCache().setEnabled(false);
> }


Is this behaviour normal and do I have to configure my server differently
or is this a bug?

Thanks in advance!
André