Hi to all, when looking into the logs for all sort of things we noticed that we get a lot of exceptions with the stacktrace shown in [1]. We are heavily using RestXQ to insert documents at a rather high pace. It doesn't compromise the functioning of the system which looks to be behaving correctly. Nevertheless we have the feeling that when it happens we get a slowing down of the delivery of the response to the client. I say feeling because this has yet to be proved. Anyone knows what this exception is about and whether it can be avoided somehow? Maybe tuning Jetty configuration? Thanks a lot, Marco.
[1] java.io.IOException: Closed at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:140) at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:117) at org.basex.http.restxq.RestXqResponse.create(RestXqResponse.java:104) at org.basex.http.restxq.RestXqModule.process(RestXqModule.java:97) at org.basex.http.restxq.RestXqFunction.process(RestXqFunction.java:104) at org.basex.http.restxq.RestXqServlet.run(RestXqServlet.java:29) at org.basex.http.BaseXServlet.service(BaseXServlet.java:64) at javax.servlet.http.HttpServlet.service(HttpServlet.java:848) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:684) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:503) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:429) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
at org.eclipse.jetty.server.Server.handle(Server.java:370) at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:494)
at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:982)
at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:1043)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:865) at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240) at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:696)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:53)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
at java.lang.Thread.run(Thread.java:745) java.lang.IllegalStateException: Committed at org.eclipse.jetty.server.Response.resetBuffer(Response.java:1130) at org.basex.http.HTTPContext.status(HTTPContext.java:254) at org.basex.http.BaseXServlet.service(BaseXServlet.java:71) at javax.servlet.http.HttpServlet.service(HttpServlet.java:848) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:684) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:503) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:429) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
at org.eclipse.jetty.server.Server.handle(Server.java:370) at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:494)
at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:982)
at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:1043)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:865) at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240) at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:696)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:53)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
at java.lang.Thread.run(Thread.java:745)
Hi Marco,
If you manage to make it reproducible, please give us a note!
Thanks, Christian
On Fri, Feb 20, 2015 at 12:49 PM, Marco Lettere marco.lettere@dedalus.eu wrote:
Hi to all, when looking into the logs for all sort of things we noticed that we get a lot of exceptions with the stacktrace shown in [1]. We are heavily using RestXQ to insert documents at a rather high pace. It doesn't compromise the functioning of the system which looks to be behaving correctly. Nevertheless we have the feeling that when it happens we get a slowing down of the delivery of the response to the client. I say feeling because this has yet to be proved. Anyone knows what this exception is about and whether it can be avoided somehow? Maybe tuning Jetty configuration? Thanks a lot, Marco.
[1] java.io.IOException: Closed at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:140) at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:117) at org.basex.http.restxq.RestXqResponse.create(RestXqResponse.java:104) at org.basex.http.restxq.RestXqModule.process(RestXqModule.java:97) at org.basex.http.restxq.RestXqFunction.process(RestXqFunction.java:104) at org.basex.http.restxq.RestXqServlet.run(RestXqServlet.java:29) at org.basex.http.BaseXServlet.service(BaseXServlet.java:64) at javax.servlet.http.HttpServlet.service(HttpServlet.java:848) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:684) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:503) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:429) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116) at org.eclipse.jetty.server.Server.handle(Server.java:370) at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:494) at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:982) at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:1043) at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:865) at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240) at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82) at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:696) at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:53) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608) at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543) at java.lang.Thread.run(Thread.java:745) java.lang.IllegalStateException: Committed at org.eclipse.jetty.server.Response.resetBuffer(Response.java:1130) at org.basex.http.HTTPContext.status(HTTPContext.java:254) at org.basex.http.BaseXServlet.service(BaseXServlet.java:71) at javax.servlet.http.HttpServlet.service(HttpServlet.java:848) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:684) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:503) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:429) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116) at org.eclipse.jetty.server.Server.handle(Server.java:370) at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:494) at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:982) at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:1043) at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:865) at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240) at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82) at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:696) at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:53) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608) at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543) at java.lang.Thread.run(Thread.java:745)
Hello Christian, this is a small example that reproduces the issue. Mainly it's a simulator for a REST API with which a client can check for the existence of a document (call to HEAD method) and then adds the document through the POST method. To generate the jetty exception it sufficient to do only few cycles (three in the example). As usual thanks for the attention. Regards, Marco.
API code
module namespace _ = 'urn:test';
declare %rest:path('test/{$db}/{$id}') %rest:HEAD function _:check($db, $id) { let $r := count(collection($db)/doc/id[text() = $id]) return rest:response <http:response status="{if ($r > 0) then 200 else 404}"/> </rest:response> };
declare %rest:path('test/{$db}') %rest:POST('{$body}') %rest:consumes("application/xml") function _:add($db, $body) { let $id := $body/doc/id/text() let $r := count(collection($db)/doc/id[text() = $id]) return if($r > 0) then rest:response <http:response status="400" message="{'already present' || $r}"/> </rest:response> else (db:add($db, $body, $id || ".xml"), rest:response <http:response status="200" message="OK"/> </rest:response>) };
Example client code:
declare namespace hl7v3 = "urn:hl7-org:v3";
let $db := 'db'
for $i in (1 to 3) let $id := "id_" || $i let $doc := <doc> <id>{$id}</id> </doc> return( http:send-request( <http:request href="{'http://localhost:8984/test/' || $db || '/' || $id}" method="HEAD" override-media-type="text/plain"> </http:request> ) , http:send-request( <http:request href="{'http://localhost:8984/test/' || $db}" method="POST" override-media-type="text/plain"> <http:body media-type="application/xml"> {$doc} </http:body> </http:request> ) )
On 20/02/2015 13:49, Christian Grün wrote:
Hi Marco,
If you manage to make it reproducible, please give us a note!
Thanks, Christian
On Fri, Feb 20, 2015 at 12:49 PM, Marco Lettere marco.lettere@dedalus.eu wrote:
Hi to all, when looking into the logs for all sort of things we noticed that we get a lot of exceptions with the stacktrace shown in [1]. We are heavily using RestXQ to insert documents at a rather high pace. It doesn't compromise the functioning of the system which looks to be behaving correctly. Nevertheless we have the feeling that when it happens we get a slowing down of the delivery of the response to the client. I say feeling because this has yet to be proved. Anyone knows what this exception is about and whether it can be avoided somehow? Maybe tuning Jetty configuration? Thanks a lot, Marco.
[1] java.io.IOException: Closed at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:140) at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:117) at org.basex.http.restxq.RestXqResponse.create(RestXqResponse.java:104) at org.basex.http.restxq.RestXqModule.process(RestXqModule.java:97) at org.basex.http.restxq.RestXqFunction.process(RestXqFunction.java:104) at org.basex.http.restxq.RestXqServlet.run(RestXqServlet.java:29) at org.basex.http.BaseXServlet.service(BaseXServlet.java:64) at javax.servlet.http.HttpServlet.service(HttpServlet.java:848) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:684) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:503) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:429) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116) at org.eclipse.jetty.server.Server.handle(Server.java:370) at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:494) at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:982) at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:1043) at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:865) at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240) at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82) at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:696) at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:53) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608) at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543) at java.lang.Thread.run(Thread.java:745) java.lang.IllegalStateException: Committed at org.eclipse.jetty.server.Response.resetBuffer(Response.java:1130) at org.basex.http.HTTPContext.status(HTTPContext.java:254) at org.basex.http.BaseXServlet.service(BaseXServlet.java:71) at javax.servlet.http.HttpServlet.service(HttpServlet.java:848) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:684) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:503) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:429) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116) at org.eclipse.jetty.server.Server.handle(Server.java:370) at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:494) at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:982) at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:1043) at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:865) at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240) at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82) at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:696) at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:53) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608) at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543) at java.lang.Thread.run(Thread.java:745)
Ciao Marco,
penso che adesso il problema sia risolto. It wasn’t a critical one, though; it occurred as we tried to output an empty result as final step of the HEAD request [1].
Il nuovo snapshot è online [2]. Christian
[1] https://github.com/BaseXdb/basex/commit/40b0b9740912dcbe96f12f6c64067c3acd71... [2] http://files.basex.org/releases/latest
On Sat, Feb 21, 2015 at 3:44 PM, Marco Lettere marco.lettere@dedalus.eu wrote:
Hello Christian, this is a small example that reproduces the issue. Mainly it's a simulator for a REST API with which a client can check for the existence of a document (call to HEAD method) and then adds the document through the POST method. To generate the jetty exception it sufficient to do only few cycles (three in the example). As usual thanks for the attention. Regards, Marco.
API code
module namespace _ = 'urn:test';
declare %rest:path('test/{$db}/{$id}') %rest:HEAD function _:check($db, $id) { let $r := count(collection($db)/doc/id[text() = $id]) return rest:response <http:response status="{if ($r > 0) then 200 else 404}"/> </rest:response> };
declare %rest:path('test/{$db}') %rest:POST('{$body}') %rest:consumes("application/xml") function _:add($db, $body) { let $id := $body/doc/id/text() let $r := count(collection($db)/doc/id[text() = $id]) return if($r > 0) then rest:response <http:response status="400" message="{'already present' || $r}"/> </rest:response> else (db:add($db, $body, $id || ".xml"), rest:response <http:response status="200" message="OK"/> </rest:response>) };
Example client code:
declare namespace hl7v3 = "urn:hl7-org:v3";
let $db := 'db'
for $i in (1 to 3) let $id := "id_" || $i let $doc := <doc> <id>{$id}</id> </doc> return( http:send-request( <http:request href="{'http://localhost:8984/test/' || $db || '/' || $id}" method="HEAD" override-media-type="text/plain"> </http:request> ) , http:send-request( <http:request href="{'http://localhost:8984/test/' || $db}" method="POST" override-media-type="text/plain"> <http:body media-type="application/xml"> {$doc} </http:body> </http:request> ) )
On 20/02/2015 13:49, Christian Grün wrote:
Hi Marco,
If you manage to make it reproducible, please give us a note!
Thanks, Christian
On Fri, Feb 20, 2015 at 12:49 PM, Marco Lettere marco.lettere@dedalus.eu wrote:
Hi to all, when looking into the logs for all sort of things we noticed that we get a lot of exceptions with the stacktrace shown in [1]. We are heavily using RestXQ to insert documents at a rather high pace. It doesn't compromise the functioning of the system which looks to be behaving correctly. Nevertheless we have the feeling that when it happens we get a slowing down of the delivery of the response to the client. I say feeling because this has yet to be proved. Anyone knows what this exception is about and whether it can be avoided somehow? Maybe tuning Jetty configuration? Thanks a lot, Marco.
[1] java.io.IOException: Closed at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:140) at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:117) at org.basex.http.restxq.RestXqResponse.create(RestXqResponse.java:104) at org.basex.http.restxq.RestXqModule.process(RestXqModule.java:97) at org.basex.http.restxq.RestXqFunction.process(RestXqFunction.java:104) at org.basex.http.restxq.RestXqServlet.run(RestXqServlet.java:29) at org.basex.http.BaseXServlet.service(BaseXServlet.java:64) at javax.servlet.http.HttpServlet.service(HttpServlet.java:848) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:684) at
org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:503) at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137) at
org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557) at
org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231) at
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:429) at
org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193) at
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020) at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135) at
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116) at org.eclipse.jetty.server.Server.handle(Server.java:370) at
org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:494) at
org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:982) at
org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:1043) at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:865) at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240) at
org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82) at
org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:696) at
org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:53) at
org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608) at
org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543) at java.lang.Thread.run(Thread.java:745) java.lang.IllegalStateException: Committed at org.eclipse.jetty.server.Response.resetBuffer(Response.java:1130) at org.basex.http.HTTPContext.status(HTTPContext.java:254) at org.basex.http.BaseXServlet.service(BaseXServlet.java:71) at javax.servlet.http.HttpServlet.service(HttpServlet.java:848) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:684) at
org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:503) at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137) at
org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557) at
org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231) at
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:429) at
org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193) at
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020) at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135) at
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116) at org.eclipse.jetty.server.Server.handle(Server.java:370) at
org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:494) at
org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:982) at
org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:1043) at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:865) at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240) at
org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82) at
org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:696) at
org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:53) at
org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608) at
org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543) at java.lang.Thread.run(Thread.java:745)
Wow! You installed the Italian Locale? Grazie! Marco.
On 22/02/2015 19:14, Christian Grün wrote:
Ciao Marco,
penso che adesso il problema sia risolto. It wasn’t a critical one, though; it occurred as we tried to output an empty result as final step of the HEAD request [1].
Il nuovo snapshot è online [2]. Christian
[1] https://github.com/BaseXdb/basex/commit/40b0b9740912dcbe96f12f6c64067c3acd71... [2] http://files.basex.org/releases/latest
On Sat, Feb 21, 2015 at 3:44 PM, Marco Lettere marco.lettere@dedalus.eu wrote:
Hello Christian, this is a small example that reproduces the issue. Mainly it's a simulator for a REST API with which a client can check for the existence of a document (call to HEAD method) and then adds the document through the POST method. To generate the jetty exception it sufficient to do only few cycles (three in the example). As usual thanks for the attention. Regards, Marco.
API code
module namespace _ = 'urn:test';
declare %rest:path('test/{$db}/{$id}') %rest:HEAD function _:check($db, $id) { let $r := count(collection($db)/doc/id[text() = $id]) return rest:response <http:response status="{if ($r > 0) then 200 else 404}"/> </rest:response> };
declare %rest:path('test/{$db}') %rest:POST('{$body}') %rest:consumes("application/xml") function _:add($db, $body) { let $id := $body/doc/id/text() let $r := count(collection($db)/doc/id[text() = $id]) return if($r > 0) then rest:response <http:response status="400" message="{'already present' || $r}"/> </rest:response> else (db:add($db, $body, $id || ".xml"), rest:response <http:response status="200" message="OK"/> </rest:response>) };
Example client code:
declare namespace hl7v3 = "urn:hl7-org:v3";
let $db := 'db'
for $i in (1 to 3) let $id := "id_" || $i let $doc := <doc> <id>{$id}</id> </doc> return( http:send-request( <http:request href="{'http://localhost:8984/test/' || $db || '/' || $id}" method="HEAD" override-media-type="text/plain"> </http:request> ) , http:send-request( <http:request href="{'http://localhost:8984/test/' || $db}" method="POST" override-media-type="text/plain"> <http:body media-type="application/xml"> {$doc} </http:body> </http:request> ) )
On 20/02/2015 13:49, Christian Grün wrote:
Hi Marco,
If you manage to make it reproducible, please give us a note!
Thanks, Christian
On Fri, Feb 20, 2015 at 12:49 PM, Marco Lettere marco.lettere@dedalus.eu wrote:
Hi to all, when looking into the logs for all sort of things we noticed that we get a lot of exceptions with the stacktrace shown in [1]. We are heavily using RestXQ to insert documents at a rather high pace. It doesn't compromise the functioning of the system which looks to be behaving correctly. Nevertheless we have the feeling that when it happens we get a slowing down of the delivery of the response to the client. I say feeling because this has yet to be proved. Anyone knows what this exception is about and whether it can be avoided somehow? Maybe tuning Jetty configuration? Thanks a lot, Marco.
[1] java.io.IOException: Closed at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:140) at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:117) at org.basex.http.restxq.RestXqResponse.create(RestXqResponse.java:104) at org.basex.http.restxq.RestXqModule.process(RestXqModule.java:97) at org.basex.http.restxq.RestXqFunction.process(RestXqFunction.java:104) at org.basex.http.restxq.RestXqServlet.run(RestXqServlet.java:29) at org.basex.http.BaseXServlet.service(BaseXServlet.java:64) at javax.servlet.http.HttpServlet.service(HttpServlet.java:848) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:684) at
org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:503) at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137) at
org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557) at
org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231) at
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:429) at
org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193) at
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020) at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135) at
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116) at org.eclipse.jetty.server.Server.handle(Server.java:370) at
org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:494) at
org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:982) at
org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:1043) at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:865) at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240) at
org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82) at
org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:696) at
org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:53) at
org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608) at
org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543) at java.lang.Thread.run(Thread.java:745) java.lang.IllegalStateException: Committed at org.eclipse.jetty.server.Response.resetBuffer(Response.java:1130) at org.basex.http.HTTPContext.status(HTTPContext.java:254) at org.basex.http.BaseXServlet.service(BaseXServlet.java:71) at javax.servlet.http.HttpServlet.service(HttpServlet.java:848) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:684) at
org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:503) at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137) at
org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557) at
org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231) at
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:429) at
org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193) at
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020) at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135) at
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116) at org.eclipse.jetty.server.Server.handle(Server.java:370) at
org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:494) at
org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:982) at
org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:1043) at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:865) at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240) at
org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82) at
org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:696) at
org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:53) at
org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608) at
org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543) at java.lang.Thread.run(Thread.java:745)
basex-talk@mailman.uni-konstanz.de