Ali cloud OSS call unreleased resources caused memory overflow

 

Some time ago online services out of memory problems frequently, sometimes at night will hang up, operation and maintenance colleagues had to climb up from their sleep to restart, giving us a great deal of distress. Operation and maintenance of a colleague before coming to hang jvm's heap dump took down to us through memory analysis tool MemoryAnalyzer open to see the results as follows

 

You can see a large number of org.apache.http.impl.conn.PoolingHttpClientConnectionManager object is not released, and you can see Ali cloud oss ​​in reference, inspiration, may be accessed oss ​​services when certain resources are not freed,

But oss library is another part of the company's packaging, our products are directly used, it would be right to look at their source code.

After viewing the source code found in every oss OSSClient request creates an instance of Ali cloud and did not call shutdown OSSClient after the call ossClient Interface End request () method to release resources. No wonder a few days after running too high memory does not work fullGC until the memory overflow. Feedback to the department after another complete change our hair repackaged version,

Run observation for some time, then no memory overflow. that's nice.

 

Guess you like

Origin www.cnblogs.com/jasonChai/p/11961839.html