B4J Question Jetty setting maxIdleTime

Discussion in 'B4J Questions' started by alwaysbusy, Mar 10, 2016.

  1. alwaysbusy

    alwaysbusy Expert Licensed User

    I'm experiencing Timeouts in on the server side streaming audio files. Although these messages appear in the log, the audio file keeps playing.

    Code:
    java.util.concurrent.TimeoutException: Idle timeout expired: 30001/30000 ms
       at org.eclipse.jetty.io.IdleTimeout.checkIdleTimeout(IdleTimeout.java:
    166)
       at org.eclipse.jetty.io.IdleTimeout$
    1.run(IdleTimeout.java:50)
       at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:
    511)
       at java.util.concurrent.FutureTask.run(FutureTask.java:
    266)
       at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$
    201(ScheduledThreadPoolExecutor.java:180)
       at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:
    293)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:
    1142)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:
    617)
       at java.lang.Thread.run(
    Thread.java:745)
    2016-03-10 17:18:35.259:WARN:oejs.HttpChannel:qtp23170705-13: //localhost:51042/demo/Audio/04%20Steal.mp3
    java.io.IOException: java.util.concurrent.TimeoutException: Idle timeout expired: 
    30001/30000 ms
       at org.eclipse.jetty.util.SharedBlockingCallback$Blocker.block(SharedBlockingCallback.java:
    226)
       at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:
    164)
       at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:
    436)
       at org.eclipse.jetty.util.IO.copy(IO.java:
    163)
       at org.eclipse.jetty.util.resource.Resource.writeTo(Resource.java:
    682)
       at org.eclipse.jetty.servlet.DefaultServlet.sendData(DefaultServlet.java:
    995)
       at org.eclipse.jetty.servlet.DefaultServlet.doGet(DefaultServlet.java:
    520)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:
    687)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:
    790)
       at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:
    821)
       at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:
    583)
       at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:
    224)
       at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:
    1158)
       at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:
    511)
       at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:
    185)
       at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:
    1090)
       at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:
    141)
       at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:
    109)
       at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:
    119)
       at org.eclipse.jetty.server.Server.handle(
    Server.java:517)
       at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:
    308)
       at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:
    242)
       at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:
    261)
       at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:
    95)
       at org.eclipse.jetty.io.SelectChannelEndPoint$
    2.run(SelectChannelEndPoint.java:75)
       at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceAndRun(ExecuteProduceConsume.java:
    213)
       at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:
    147)
       at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:
    654)
       at org.eclipse.jetty.util.thread.QueuedThreadPool$
    3.run(QueuedThreadPool.java:572)
       at java.lang.Thread.run(
    Thread.java:745)
    Searching the net, I should be able to extend this timeout, e.g maxIdleTime=500000. (it is 30000 by default).

    I tried:

    Code:
    srvr.SetStaticFilesOptions(CreateMap("cacheControl""max-age=604800,public","gzip":True,"dirAllowed":False"maxIdleTime":"500000"))
    But I do not think this is the right place to set this param (it is ignored).
     
  2. Erel

    Erel Administrator Staff Member Licensed User

  3. alwaysbusy

    alwaysbusy Expert Licensed User

    That is probably true. It has to load a mp3 of 11Mb. After 7.6 Mb it stops buffering and start playing. When it reaches 30 seconds into the song, it still has plenty of the song into the buffer so it does not communicate with the socket, giving this error.
     
  4. alwaysbusy

    alwaysbusy Expert Licensed User

    I solved the issue on the browsers side, but just out of curiosity, where could I set the Jetty idleTimeout parameter in B4J? Is SetStaticFilesOptions the right place?
     
  5. Erel

    Erel Administrator Staff Member Licensed User

    You can use this code:
    Code:
    srvr.Start
    Dim jo As JavaObject = srvr
    Dim connectors() As Object = jo.GetFieldJO("server").RunMethod("getConnectors"Null)
    Dim timeout As Long = 50000
    For Each c As JavaObject In connectors
       c.RunMethod(
    "setIdleTimeout"Array(timeout))
    Next
     
    magi6162, inakigarm and alwaysbusy like this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice