-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Labels
lifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale.Denotes an issue or PR has remained open with no activity and has become stale.
Description
Describe the bug
The ApiClient
cannot handle responses larger than 2GB.
Client Version
22.0.1-legacy
is what we're currently using, but this issue occurs in all versions
Kubernetes Version
1.30.9
Java Version
Java 21
To Reproduce
- Set up a
SharedIndexInformer
for a resource in a cluster where the total size of all resources > 2GB. - The initial
list()
in theReflectorRunnable
will fail with:
class io.kubernetes.client.openapi.models.V1Pod#Reflector loop failed unexpectedly
java.lang.IllegalArgumentException: byteCount: 2293832235
at okio.Buffer.readString(Buffer.kt:306)
at okio.Buffer.readString(Buffer.kt:302)
at okio.RealBufferedSource.readString(RealBufferedSource.kt:96)
at okhttp3.ResponseBody.string(ResponseBody.kt:187)
at io.kubernetes.client.openapi.ApiClient.deserialize(ApiClient.java:758)
at io.kubernetes.client.openapi.ApiClient.handleResponse(ApiClient.java:978)
at io.kubernetes.client.openapi.ApiClient.execute(ApiClient.java:905)
at io.kubernetes.client.informer.SharedInformerFactory$1.list(SharedInformerFactory.java:271)
at io.kubernetes.client.informer.cache.ReflectorRunnable.run(ReflectorRunnable.java:91)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:358)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.lang.Thread.run(Thread.java:1583)
Expected behavior
The ApiClient
can deserialize responses greater than 2GB.
Additional context
This issue occurs because the response body is converted to a String
here in the ApiClient
, which hits this validation in okhttp
:
require(byteCount >= 0 && byteCount <= Integer.MAX_VALUE) { "byteCount: $byteCount" }
because of Java's String
max length limit of Integer.MAX_VALUE
which is 2^31 - 1.
Metadata
Metadata
Assignees
Labels
lifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale.Denotes an issue or PR has remained open with no activity and has become stale.