This is an automated email from the ASF dual-hosted git repository.

sureshanaparti pushed a commit to branch 4.19
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/4.19 by this push:
     new 9c6dfd2b264 Handle IllegalReferenceCountException for decoder, while 
uploading ISO from local (#10879)
9c6dfd2b264 is described below

commit 9c6dfd2b26457fecbb2f0676703756c40233949e
Author: Suresh Kumar Anaparti <sureshkumar.anapa...@gmail.com>
AuthorDate: Sun Jul 20 21:31:52 2025 +0530

    Handle IllegalReferenceCountException for decoder, while uploading ISO from 
local (#10879)
---
 .../cloudstack/storage/resource/HttpUploadServerHandler.java | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git 
a/services/secondary-storage/server/src/main/java/org/apache/cloudstack/storage/resource/HttpUploadServerHandler.java
 
b/services/secondary-storage/server/src/main/java/org/apache/cloudstack/storage/resource/HttpUploadServerHandler.java
index 9b1c81284f4..73103c37660 100644
--- 
a/services/secondary-storage/server/src/main/java/org/apache/cloudstack/storage/resource/HttpUploadServerHandler.java
+++ 
b/services/secondary-storage/server/src/main/java/org/apache/cloudstack/storage/resource/HttpUploadServerHandler.java
@@ -27,6 +27,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 
+import io.netty.util.IllegalReferenceCountException;
 import org.apache.cloudstack.storage.template.UploadEntity;
 import org.apache.cloudstack.utils.imagestore.ImageStoreUtil;
 import org.apache.commons.lang3.StringUtils;
@@ -229,8 +230,15 @@ public class HttpUploadServerHandler extends 
SimpleChannelInboundHandler<HttpObj
     private void reset() {
         request = null;
         // destroy the decoder to release all resources
-        decoder.destroy();
-        decoder = null;
+        if (decoder != null) {
+            try {
+                decoder.destroy();
+            } catch (IllegalReferenceCountException e) {
+                logger.warn("Decoder already destroyed", e);
+            }
+
+            decoder = null;
+        }
     }
 
     private HttpResponseStatus readFileUploadData() throws IOException {

Reply via email to