-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
Describe the bug
The PR 40017 introduced the class PerCallTimeoutCall.
This class holds a static Timer with strong references to every call it processes.
When uploading a blob in blocks, each block is a call that gets added to the Timer, not released quickly enough and causing the Timer to hold all calls in memory without the garbage collector being able to free them. This causes the system to deplete its memory.
See BlobClient
public Response<BlockBlobItem> uploadWithResponse(BlobParallelUploadOptions options, Duration timeout,
Context context) {
To Reproduce
Set up any project using the Azure Java SDK and upload binaries at moderate pace using the method BlobClient.uploadWithResponse
Code Snippet
See PerCallTimeoutCall
private static final Timer TIMER = new Timer("azure-okhttp-response-timeout-tracker", true);
...
public void beginPerCallTimeout(Call call) {
if (perCallTimeout > 0) {
TimerTask currentTimeout = new PerCallTimerTask(this, call);
TIMER.schedule(currentTimeout, perCallTimeout);
TimerTask existing = CURRENT_TIMEOUT_UPDATER.getAndSet(this, currentTimeout);
if (existing != null) {
existing.cancel();
}
}
}
Expected behavior
The system shouldn't run out of memory.
Setup (please complete the following information):
- OS: Any
- IDE: Any
- Library/Libraries: com.azure:azure-core:1.51.0, com.azure:azure-core-http-okhttp:1.12.2 (the behavior was introduced in com.azure:azure-core-http-okhttp:1.12.0)
- Java version: 17
- App Server/Environment: Tomcat
- Frameworks: Any
If you suspect a dependency version mismatch (e.g. you see NoClassDefFoundError, NoSuchMethodError or similar), please check out Troubleshoot dependency version conflict article first. If it doesn't provide solution for the problem, please provide:
- verbose dependency tree (
mvn dependency:tree -Dverbose) - exception message, full stack trace, and any available logs
Additional context
Add any other context about the problem here.
Information Checklist
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report
- Bug Description Added
- Repro Steps Added
- Setup information Added
Metadata
Metadata
Assignees
Labels
Type
Projects
Status

