Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

不使用OSSClient#shutdown()导致内存溢出 OutOfMemoryError #126

Open
chenjazz opened this issue Mar 15, 2018 · 5 comments
Open

不使用OSSClient#shutdown()导致内存溢出 OutOfMemoryError #126

chenjazz opened this issue Mar 15, 2018 · 5 comments

Comments

@chenjazz
Copy link

//-Xms20m -Xmx20m
for (int i = 0; i < 60000; i++) {
        OSSClient ossClient = new OSSClient(endpoint, accessKeyId, accessKeySecret);
        ossClient.putObject("<test-bucket>", "test1234" + UUID.randomUUID(), new File("d:/file.txt"));
        System.out.println("size="+IdleConnectionReaper.size());
        Thread.sleep(2);
}

PoolingHttpClientConnectionManager类无限增长~~~
项目里OSSClient没有使用单例,且没有调用shutdown(),我想问下原本就是这么设计的么?

@ChetWang
Copy link

这个我们也踩过坑,非单例一定要释放掉client

@chenjazz
Copy link
Author

chenjazz commented Apr 7, 2018

@ChetWang 我觉得官方应该限制PoolingHttpClientConnectionManager数量,防止用户犯错,超过数量抛出异常

@yqw2023
Copy link

yqw2023 commented May 6, 2019

关键官方的demo 里面没有shutdown

@wzk9261
Copy link

wzk9261 commented Dec 1, 2020

关键官方的demo 里面没有shutdown

官方的demo里面有shutdown啊

@chenjazz
Copy link
Author

关键官方的demo 里面没有shutdown

官方的demo里面有shutdown啊

应该是后加的吧

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants