I had a situation where XNAT login attempts (and, as it turns out,
anything else requiring a database lookup) would fail, throw a broken
pipe SocketException and print the stack trace on the login page. This
happened with a database running on the local (to XNAT) system, and
postgresql appeared to be running fine the whole time, so I don't know
what the cause was. The only solution I found was to restart the XNAT
process. In attempting to reproduce the behavior, I found the
following:
start XNAT with the backing database running:
normal operation.
start XNAT with the backing database running, restart the database
without hitting it from XNAT while it's down:
XNAT reports "The backend has broken the connection. Possibly the
action you have attempted has caused it to close."
Subsequent attempts print the stack trace, persisting until opening a
new browser window/tab or entering the initial url afresh (looks like
it holds the variable for subsequent POSTs otherwise).
start XNAT with the backing database running, stop the database and
hit it while it's down:
XNAT prints the stack trace in its Welcome/Goodbye/<miscMessages> box
above the User/Password fields immediately.
It seems there is no recovery from the broken connection other than to
restart the XNAT process.
The standard(/modern?) way of doing this is to let the container
handle a pool of database connections and just interact with the
container. For example, our in-house Tomcat apps use this, and we can
manage the connections themselves with attributes in the standard
datasource definition. They generally mitigate or prevent dead
connections and survive this sort of situation transparently (as long
as the database and any interposed networking are operating, of
course).
Here is the stack trace in question:
An I/O error has occured while flushing the output - Exception:
java.net.SocketException: Broken pipe Stack Trace:
java.net.SocketException: Broken pipe at
java.net.SocketOutputStream.socketWrite0(Native Method) at
java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92) at
java.net.SocketOutputStream.write(SocketOutputStream.java:136) at
java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)
at org.postgresql.core.PGStream.flush(PGStream.java:411) at
org.postgresql.core.QueryExecutor.sendQueryV3(QueryExecutor.java:337)
at org.postgresql.core.QueryExecutor.executeV3(QueryExecutor.java:121)
at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:100)
at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:43) at
org.postgresql.jdbc1.AbstractJdbc1Statement.execute(AbstractJdbc1Statement.java:
517) at
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:
50) at
org.postgresql.jdbc1.AbstractJdbc1Statement.executeQuery(AbstractJdbc1Statement.java:
233) at
org.postgresql.jdbc1.AbstractJdbc1Statement.executeQuery(AbstractJdbc1Statement.java:
221) at
org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:
205) at org.nrg.xft.db.PoolDBUtils.executeSelectQuery(PoolDBUtils.java:
490) at org.nrg.xft.search.TableSearch.Execute(TableSearch.java:205)
at org.nrg.xft.search.ItemSearch.getIdentifierResults(ItemSearch.java:
323) at org.nrg.xft.search.ItemSearch.exec(ItemSearch.java:431) at
org.nrg.xft.search.ItemSearch.exec(ItemSearch.java:121) at
org.nrg.xdat.security.XDATUser.(XDATUser.java:94) at
org.nrg.xnat.security.LDAPAuthenticator.authenticate(LDAPAuthenticator.java:
470) at
org.nrg.xdat.security.Authenticator.Authenticate(Authenticator.java:
60) at
org.nrg.xdat.turbine.modules.actions.XDATLoginUser.doPerform(XDATLoginUser.java:
89) at
org.apache.turbine.modules.actions.VelocityAction.doPerform(VelocityAction.java:
46) at
org.apache.turbine.util.velocity.VelocityActionEvent.perform(VelocityActionEvent.java:
82) at
org.apache.turbine.modules.actions.VelocityAction.perform(VelocityAction.java:
72) at org.apache.turbine.modules.ActionLoader.exec(ActionLoader.java:
96) at
org.apache.turbine.modules.pages.DefaultPage.doBuild(DefaultPage.java:
113) at org.apache.turbine.modules.Page.build(Page.java:53) at
org.apache.turbine.modules.PageLoader.exec(PageLoader.java:98) at
org.apache.turbine.Turbine.doGet(Turbine.java:751) at
org.apache.turbine.Turbine.doPost(Turbine.java:846) at
javax.servlet.http.HttpServlet.service(HttpServlet.java:637) at
javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
290) at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
206) at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:
233) at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:
191) at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:
465) at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:
127) at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:
102) at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:
109) at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:
298) at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:
852) at org.apache.coyote.http11.Http11Protocol
$Http11ConnectionHandler.process(Http11Protocol.java:588) at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:
489) at java.lang.Thread.run(Thread.java:619) End of Stack Trace
I can see a couple things to improve:
1) Make the "nice" report catch repeated attempts (which users will no
doubt elicit), and provide a note about informing a designated point
of contact. For that will require immediate attention like this, it
would be best to have a user-configurable list of contacts, even if
just the contents of a plaintext file, say.
2) Change the database definition in XNAT's code to use a Tomcat
datasource, perhaps providing some reasonable suggestions for the
datasource definition that should work for most production XNAT
instances, in case the site implementer needs it.
We view this as a fairly serious point of failure in light of the
robustness that's available, and have some in-house experience with
(2) & so can probably provide suggestions or perhaps assistance.
We may also look at upgrading the JDBC driver as needed; cf:
http://groups.google.com/group/xnat_discussion/browse_thread/thread/2b0ed41fe83a244f/5649542610e5a3bd?lnk=gst&q=jdbc3#5649542610e5a3bd
Thanks,
Adam
--
You received this message because you are subscribed to the Google Groups "xnat_discussion" group.
To post to this group, send email to
xnat_di...@googlegroups.com.
To unsubscribe from this group, send email to
xnat_discussi...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/xnat_discussion?hl=en.