[CONJ-297] Useless memory consumption when using Statement.setQueryTimeout Created: 2016-05-17 Updated: 2016-05-23 Resolved: 2016-05-18 |
|
| Status: | Closed |
| Project: | MariaDB Connector/J |
| Component/s: | Other |
| Affects Version/s: | 1.4.0, 1.4.1, 1.4.2, 1.4.3, 1.4.4 |
| Fix Version/s: | 1.4.5 |
| Type: | Task | Priority: | Major |
| Reporter: | Diego Dupin | Assignee: | Diego Dupin |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Since commit https://github.com/MariaDB/mariadb-connector-j/commit/efc6405. If timeout is set to a very big amount of time (like one hour), all those cancel task will consume memory needlessly. |
| Comments |
| Comment by Diego Dupin [ 2016-05-23 ] |
|
The initial commit version permits better thread handling when there is a lot of Statement.setQueryTimeout but create another problem: The problem is for very long timeout (like 1 hour), this will lead to memory consumption, and CPU (due to garbage). Immediate solution was to use java 1.7 ScheduledThreadPoolExecutor.setRemoveOnCancelPolicy(true), that remove immediately the task from queue when cancelled, but testing performance, the queue dynamic resizing lead to even more memory consumption (a lot more). Correction is done using java 1.5 Timer : |