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

BlockingCache may produce OutOfMemoryError #2043

Closed
liuyueve opened this issue Sep 5, 2020 · 1 comment
Closed

BlockingCache may produce OutOfMemoryError #2043

liuyueve opened this issue Sep 5, 2020 · 1 comment

Comments

@liuyueve
Copy link

liuyueve commented Sep 5, 2020

MyBatis version

3.5.5

Database vendor and version

Mysql

Test case or example project

====

SqlSession sqlSession = sqlSessionFactory.openSession();
BasicMapper mapper = sqlSession.getMapper(BasicMapper.class);
for (int i = 0; i < 2000000; i++) {
System.out.println(mapper.queryName(i));
}
sqlSession.commit();

====

@CacheNamespace(blocking = true)
public interface BasicMapper {
@select("select value from demo where id = #{id}")
String queryName(@param("id") int id);
}

Steps to reproduce

Running test case. Set jvm options -Xms20m -Xmx20m(this option just make result more easy to appear)
To make a compare.we can set blocking = flase then see whether OutOfMemoryErro happen.

Expected result

no error.

Actual result

Programe has been OutOfMemoryError.

@harawata
Copy link
Member

harawata commented Sep 5, 2020

This may be a duplicate of #1261 .

@harawata harawata closed this as completed Sep 6, 2020
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

2 participants