org.postgresql.util.PSQLException: An I/O error occured while sending to th

hello vaadiners

My project setup is the following:

  • tomcat 6
  • JDK 1.6
  • postgresql 9.0 database server
  • postgresql-9.0-801.jdbc4.jar JDBC driver (the latest version downloaded from postgresql.org)
  • I setup a datasource/connection pooling for my vaadin webapp
  • for the database calls I use prepared statement

So with this setup sometimes I get the following exception (especially with firefox 4 and chrome)


org.postgresql.util.PSQLException: An I/O error occured while sending to the backend.
	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:283)
	at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:500)
	at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:388)
	at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:273)
	at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96)
	at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96)
	at com.digicpictures.dproject.Dproject.tryToLogIn(Dproject.java:215)
	at com.digicpictures.dproject.Dproject.access$0(Dproject.java:189)
	at com.digicpictures.dproject.Dproject$1.buttonClick(Dproject.java:157)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:616)
	at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:490)
	at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:162)
	at com.vaadin.ui.AbstractComponent.fireEvent(AbstractComponent.java:1166)
	at com.vaadin.ui.Button.fireClick(Button.java:380)
	at com.vaadin.ui.Button$ClickShortcut.handleAction(Button.java:502)
	at com.vaadin.event.ActionManager.handleAction(ActionManager.java:233)
	at com.vaadin.event.ActionManager.handleAction(ActionManager.java:228)
	at com.vaadin.event.ActionManager.handleActions(ActionManager.java:198)
	at com.vaadin.ui.Panel.changeVariables(Panel.java:356)
	at com.vaadin.ui.Window.changeVariables(Window.java:1075)
	at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVariableBurst(AbstractCommunicationManager.java:1297)
	at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVariables(AbstractCommunicationManager.java:1217)
	at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.doHandleUidlRequest(AbstractCommunicationManager.java:733)
	at com.vaadin.terminal.gwt.server.CommunicationManager.handleUidlRequest(CommunicationManager.java:296)
	at com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:483)
	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:563)
	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:857)
	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:679)
Caused by: java.net.SocketException: Socket closed
	at java.net.SocketInputStream.socketRead0(Native Method)
	at java.net.SocketInputStream.read(SocketInputStream.java:146)
	at org.postgresql.core.VisibleBufferedInputStream.readMore(VisibleBufferedInputStream.java:145)
	at org.postgresql.core.VisibleBufferedInputStream.ensureBytes(VisibleBufferedInputStream.java:114)
	at org.postgresql.core.VisibleBufferedInputStream.read(VisibleBufferedInputStream.java:73)
	at org.postgresql.core.PGStream.ReceiveChar(PGStream.java:274)
	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1660)
	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
	... 41 more

What can cause this problem? And how can I solve it? Or where to look further to solve this problem?

This does not look like a Vaadin problem but a problem with a closed database connection or something like that - you just happen to see it when clicking a button. Maybe also related to some thread bound data.

I know this problem is not in connection with vaadin , but clients/my bosses dont care about that And it was especially embarassing because it occured on the login screen when the user clicked the login button (this was the applications first time to connect to the db)

It seems that there are some problems with tomcats default connection-pooling implementation (Apache DBCP)

Has anyone experience on how to properly configure tomcat 6 to provide connection-pooling/jdbc datasource for my appllication ? (which connection pooling implementation to use , configuration settings etc) ?

Or what other alternatives can I use (tomcat 7 or another servlet container or application server) ?

And also a detailed tutorial on how to make database CRUD application with user authenticaton with vaadin (besides the excellent spring roo plugin tutorial) with a sqlContainer or one of the JPA container implementation would be very usefull as well :slight_smile:

Or for example how to create a vaadin CRUD application from an existing database ? Which tools should I use besides vaadin to do that?

What other tools/JEE/web frameworks to use with vaadin?

A a lot of ( not just vaadin related ) important questions :slight_smile:

Vaadin is an excellent framework, but I think more information is needed on these topics :slight_smile: