Broken Pipe exception in Dropwizard application

I am getting a 'broken pipe' exception when the server is left running for a long time without any http requests. Upon some investigation I found that this exception occures because the server closes its database connection and occurs when a client requests resources when the connection is close. To fix this I added the following to the jdbc conenction url

?autoReconnect=true

I also upped the heap memory on the machine just in case. Also there are not many http clients requesting resources from this dropwizard server. Is there anything else that might be going on?

The error message for reference

You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.

I there a way to configure connection pool in dropwizard application? Or is it a good practice to change the 'interactive-timeout' and 'wait_timeout'property of mysqld to be more than 8 hours ?


Thanks for the help , I fixed this issue by adding the following to the yaml file

  • checkConnectionWhileIdle : true
  • checkConnectionOnReturn : true
  • checkConnectionOnBorrow : true
  • And making sure all transactions are committed, rolled back in case of exceptions and sessions are closed after use.


    Depending on whether you are using JDBi, Hibernate or something else, I recommend using the bundles provided to set up connectivity. Those bundles come with a built-in pool that's easily configurable as the examples on the links should show.

    If you use plain JDBC or another OR mapper, you can always write a Managed Object or a proper bundle yourself, or try to leverage a ManagedPooledDatasource directly during startup.

    链接地址: http://www.djcxy.com/p/61710.html

    上一篇: R统计软件包Gem for Rails应用程序

    下一篇: Dropwizard应用程序中的断管异常