Skip to content

Prevent accumulation of cancelled SockJS heartbeat tasks [SPR-11918] #16537

@spring-projects-issues

Description

@spring-projects-issues

Rossen Stoyanchev opened SPR-11918 and commented

From the Javadoc of java.util.concurrent.ScheduledThreadPoolExecutor:

"... a cancelled task is not automatically removed from
the work queue until its delay elapses. While this enables further
inspection and monitoring, it may also cause unbounded retention of
cancelled tasks. To avoid this, set setRemoveOnCancelPolicy to true,
which causes tasks to be immediately removed from the work queue at
time of cancellation."

Under sustained high load, a large number of tasks can accumulate leading to the "unbounded retention of cancelled tasks" mentioned in the Javadoc.

Note that when using STOMP messaging, after STOMP-level heartbeats are successfully negotiated, the SockJS heartbeats are suppressed. Hence this is only an issue if using the simple broker, or not using STOMP, or using a STOMP client that doesn't support heartbeats (e.g. simple test client) or has them explicitly disabled through the STOMP CONNECT frame header.


Affects: 4.0.5

Issue Links:

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions