• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Write failed: Broken pipe => com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException:

 
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using JForum 2.1.8 and am finding that I am getting the following error randomly but often:



I think the error generally appears after I leave the page alone for a time (an hour or more) and then come back and try to go to another page (or hit the back button). Although this error is random, I can also reproduce it by killing the connection in MySQL Administrator by doing the following:

  • Go to the home page and click on the 'Test Forum' link;
  • Open MySQL Administrator on the 'Server Connections' pane and kill the connections to JForum;
  • Refresh the page in JForum and the error will occur;
  • Refresh the page again and JForum gets a new connection and shows the page.


  • The last three items are repeatable. I am using the:



    I got the above debug by changing the debugUnreturnedConnectionStackTraces to true.

    I would guess that once a connection times out JForum does not immediatly get a new connection on the next request but waits until the request afterwards to do so.

    Any ideas please?
    [originally posted on jforum.net by klogger]
     
    Migrated From Jforum.net
    Ranch Hand
    Posts: 17424
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    It looks like the server is closing the TCP/IP DB connections before the C3P0 pooling agent does. So the pooling agent is supplying connections that have been closed.

    A couple of quick thoughts on how to fix this are... MySQL's JDBC driver URL has an autoReconnect parameter. Check that the URL in your config file has autoReconnect=true on it (and check the docs that I remembered this right).

    Another possibility is that you either need to lengthen the connection timeout on the MySQL server or shorten the C3p0 pooling time to be less than the MySQL server timeout.


    [originally posted on jforum.net by monroe]
     
    Migrated From Jforum.net
    Ranch Hand
    Posts: 17424
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Thanks for the suggestion, they have given me a place to start looking into this problem.

    I am really not sure what I am doing when it comes to the details of MySQL Administration or C3P0.

    I assume that if I kill the threads to JForum through MySQL Administrator, then refresh the JForum page, I should actually get the page as I expect rather than the error message? My Assumption would be that if the thread has died, then C3P0 should start a new thread for this connection as it is a fresh request.

    As I cannot really re-produce this error without killing the thread in MySQL Administrator, I will just need to wait and see if the changes I made had any effect. The changes I have made are:

  • Setting maxIdleTime=120 on the c3p0.extra.params
  • Setting connect_timeout to 150 (I assume it is in seconds as the default is 5) through a MySQL console


  • Does they look like sensible things to try?

    With the above setting, if I kill the thread in MySQL Administrator, I still get the error message.


    [originally posted on jforum.net by klogger]
     
    Migrated From Jforum.net
    Ranch Hand
    Posts: 17424
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    I have the same issue in my website.

    I have set autoReconnect=true ,but this issue still exist.
    I have changed the mysql driver, but this issue still exist.
    [originally posted on jforum.net by lynx286]
     
    Popeye has his spinach. I have this tiny ad:
    a bit of art, as a gift, that will fit in a stocking
    https://gardener-gift.com
    reply
      Bookmark Topic Watch Topic
    • New Topic