Unable to fill pool (no buffer space available)

偶尔善良 提交于 2020-01-01 08:57:07

问题


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).

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.

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.,


回答1:


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.




回答2:


Do you use openvz? I think this question should be asked on serverfault. It is related to linux configuration. You can read: tcpsndbuf. You should count opened sockets and check condition:



来源:https://stackoverflow.com/questions/31979522/unable-to-fill-pool-no-buffer-space-available

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!