You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Getting this crash invoking .getObject on GetObjectRequest.
Expected Behavior
No crash
Current Behavior
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x0000f17a0e3ca8dc, pid=7, tid=158
#
# JRE version: OpenJDK Runtime Environment Corretto-17.0.9.8.1 (17.0.9+8) (build 17.0.9+8-LTS)
# Java VM: OpenJDK 64-Bit Server VM Corretto-17.0.9.8.1 (17.0.9+8-LTS, mixed mode, sharing, tiered, compressed class ptrs, g1 gc, linux-aarch64)
# Problematic frame:
# C [AWSCRT_12530715878252778108libaws-crt-jni.so+0x10a8dc] aws_s3_client_make_meta_request+0x10c
#
# Core dump will be written. Default location: Core dumps may be processed with "/usr/share/apport/apport -p%p -s%s -c%c -d%d -P%P -u%u -g%g -- %E" (or dumping to /rush/job/core.7)
#
# An error report file with more information is saved as:
# /cache/hs_err_pid7.log
In the file above, top of the thread contained these frames:
Is there anything else in the crash report that could be of the interest to diagnose the issue?
Reproduction Steps
This is roughly what the code was doing (converted from Clojure into Java by chatGPT).
On top of this, this code used a single S3AsyncClient instance from a multiple threads. It was also consuming the InputStream using Channels.newChannel and invoking .read on it once and then closing it (often times not reading the input stream fully). It was then throwing and exception (due to premature EOF) and closing the input stream. When I fixed the code to invoke .read until the content is fully read, these crashes stopped.
import software.amazon.awssdk.services.s3.S3AsyncClient;
import software.amazon.awssdk.services.s3.model.GetObjectRequest;
import software.amazon.awssdk.core.async.AsyncResponseTransformer;
import java.io.InputStream;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
class ObjectRequestBuilder {
public static GetObjectRequest getObjectRequest(String bucket, String key, Long offset, Long length) {
GetObjectRequest.Builder builder = GetObjectRequest.builder()
.bucket(bucket)
.key(key);
if (offset != null || length != null) {
builder.range(bytesRange(offset, length));
}
return builder.build();
}
private static String bytesRange(Long offset, Long length) {
// Assuming bytesRange is a utility function that builds the range string.
if (offset == null) offset = 0L;
if (length == null) return "bytes=" + offset + "-";
return "bytes=" + offset + "-" + (offset + length - 1);
}
}
public class S3ObjectFetcher {
public static InputStream getObjectStream(S3AsyncClient client, String bucket, String key, Long offset, Long length) throws ExecutionException, InterruptedException {
// Build the GetObjectRequest using the previously translated method.
GetObjectRequest request = ObjectRequestBuilder.getObjectRequest(bucket, key, offset, length);
// Fetch the object as an InputStream using AsyncResponseTransformer.
CompletableFuture<InputStream> futureInputStream = client.getObject(request, AsyncResponseTransformer.toBlockingInputStream());
// Since getObject is asynchronous, we need to block and wait for the result.
return futureInputStream.get();
}
}
Describe the bug
Getting this crash invoking
.getObject
onGetObjectRequest
.Expected Behavior
No crash
Current Behavior
In the file above, top of the thread contained these frames:
Here are other details from the crash file:
Here are tops of other threads in the same crash report:
Is there anything else in the crash report that could be of the interest to diagnose the issue?
Reproduction Steps
This is roughly what the code was doing (converted from Clojure into Java by chatGPT).
On top of this, this code used a single S3AsyncClient instance from a multiple threads. It was also consuming the InputStream using Channels.newChannel and invoking
.read
on it once and then closing it (often times not reading the input stream fully). It was then throwing and exception (due to premature EOF) and closing the input stream. When I fixed the code to invoke.read
until the content is fully read, these crashes stopped.Possible Solution
No response
Additional Information/Context
AWS Java SDK version used
2.20.117
JDK version used
Corretto-17.0.9.8.1
Operating System and version
Ubuntu 22.04.4 LTS
The text was updated successfully, but these errors were encountered: