Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to fill pool (no buffer space available)

I'm using Wildfly 8.2 and fire a series of DB requests when a certain web page is opened. All queries are invoked thru JPA Criteria API, return results as expected - and - none of them delivers a warning, error or exception. It all runs in Parallel Plesk.

Now, I noticed that within 2 to 3 days the following error appears and the site becomes unresponsive. I restart and I wait approx another 3 days till it happens again (depending on the number of requests I have). enter image description here

I checked the tcpsndbuf on my linux server and I noticed it is constantly at max. Unless I restart Wildfly. Apparently it fails to release the connections. enter image description here

The connections are managed by JPA/Hibernate and the Wildfly container. I don't do any special or custom transaction handling e.g. open, close. etc. I leave it all to Wildfly.

The MySQL Driver I'm using is 5.1.21 (mysql-connector-java-5.1.21-bin.jar)

In the standalone.xml I have defined the following datasource datasource values (among others):

<transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
<pool>
    <min-pool-size>3</min-pool-size>
    <max-pool-size>10</max-pool-size>
</pool>
<statement>
     <prepared-statement-cache-size>32</prepared-statement-cache-size>
     <shared-prepared-statements>true</shared-prepared-statements>
</statement

Has anyone experience the same rise of tcpsndbuf values (or this error)? In case you require more config or log files, let me know. Thanks!


UPDATE Despite the following additional timeout settings, it still runs into the hanger. And thus, it will then use 100% CPU time, whenever the max tcpsndbuf is reached.enter image description here, enter image description here

like image 748
feder Avatar asked Aug 13 '15 04:08

feder


1 Answers

Try adding this Hibernate property:

<property name="hibernate.connection.release_mode">after_transaction</property>

By default, JTA mandates that connection should be released after each statement, which is undesirable for most use cases. Most Drivers don't allow multiplexing a connection over multiple XA transactions anyway.

like image 132
Vlad Mihalcea Avatar answered Sep 17 '22 15:09

Vlad Mihalcea