Skip to content

Handle exception for decoder while uploading ISO from local #10879

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

Draft
wants to merge 1 commit into
base: 4.19
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
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;
Expand Down Expand Up @@ -229,8 +230,15 @@
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);
}

Check warning on line 238 in services/secondary-storage/server/src/main/java/org/apache/cloudstack/storage/resource/HttpUploadServerHandler.java

View check run for this annotation

Codecov / codecov/patch

services/secondary-storage/server/src/main/java/org/apache/cloudstack/storage/resource/HttpUploadServerHandler.java#L234-L238

Added lines #L234 - L238 were not covered by tests

decoder = null;

Check warning on line 240 in services/secondary-storage/server/src/main/java/org/apache/cloudstack/storage/resource/HttpUploadServerHandler.java

View check run for this annotation

Codecov / codecov/patch

services/secondary-storage/server/src/main/java/org/apache/cloudstack/storage/resource/HttpUploadServerHandler.java#L240

Added line #L240 was not covered by tests
}
}

private HttpResponseStatus readFileUploadData() throws IOException {
Expand Down