Introduction
Users of Java based batch processing applications, such as CoRB, XQSync, mlcp and the hadoop connector may have seen an error message containing "Premature EOF, partial header line read". Depending on how exceptions are managed, this may cause the Java application to exit with a stacktrace or to simply output the exception (and trace) into a log and continue.
What does it mean?
The premature EOF exception generally occurs in situations where a connection to a particular application server connection was lost while the XCC driver was in the process of reading a result set. This can happen in a few possible scenarios:
- The host became unavailable due to a hardware issue, segfault or similar issue;
- The query timeout expired (although this is much more likely to yield an XDMP-EXTIME exception with a "Time limit exceeded" message);
- Network interruption - a possible indicator of a network reliability problem such as a misconfigured load balancer or a fault in some other network hardware.
What does the full error message look like?
An example:
INFO: completed 5063408/14048060, 103 tps, 32 active threads
Feb 14, 2013 7:04:19 AM com.marklogic.developer.SimpleLogger logException
SEVERE: fatal error
com.marklogic.xcc.exceptions.ServerConnectionException: Error parsing HTTP
headers: Premature EOF, partial header line read: ''
[Session: user=admin, cb={default} [ContentSource: user=admin,
cb={none} [provider: address=localhost/127.0.0.1:8223, pool=0/64]]]
[Client: XCC/4.2-8]
at
com.marklogic.xcc.impl.handlers.AbstractRequestController.runRequest(AbstractRequestController.java:116)
at com.marklogic.xcc.impl.SessionImpl.submitRequest(SessionImpl.java:268)
at com.marklogic.developer.corb.Transform.call(Unknown Source)
at com.marklogic.developer.corb.Transform.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:679)
Caused by: java.io.IOException: Error parsing HTTP headers: Premature EOF,
partial header line read: ''
at com.marklogic.http.HttpHeaders.nextHeaderLine(HttpHeaders.java:283)
at com.marklogic.http.HttpHeaders.parseResponseHeaders(HttpHeaders.java:248)
at com.marklogic.http.HttpChannel.parseHeaders(HttpChannel.java:297)
at com.marklogic.http.HttpChannel.receiveMode(HttpChannel.java:270)
at com.marklogic.http.HttpChannel.getResponseCode(HttpChannel.java:174)
at
com.marklogic.xcc.impl.handlers.EvalRequestController.serverDialog(EvalRequestController.java:68)
at
com.marklogic.xcc.impl.handlers.AbstractRequestController.runRequest(AbstractRequestController.java:78)
... 11 more
2013-02-14 07:04:19.271 WARNING [12] (AbstractRequestController.runRequest):
Cannot obtain connection: Connection refused
Configuration / Code: things to try when you first see this message
A possible cause of errors like this may be due to the JVM starting garbage collection and this process taking long enough as to exceed the server timeout setting. If this is the case, try adding the -XX:+UseConcMarkSweepGC java option
Setting the "keep-alive" value to zero for the affected XDBC application server will disable socket pooling and may help to prevent this condition from arising; with keep-alive set to zero, sockets will not be re-used. With this approach, it is understood that disabling keep-alive should not be expected to have a significant negative impact on performance, although thorough testing is nevertheless advised.
|