Repository navigation
Bundle the Cloud Tasks client in the runtime jars and add an e2e session test - #547
Merged
Merged
Conversation
…ion test The runtime jars (runtime_impl_jetty12/121) include every class of com.google.appengine.api.taskqueue, so since fd92dbe they also contain CloudTasksClientWrapper and TaskProcessor, but none of the Cloud Tasks client libraries they use. The runtime itself uses the Task Queue API from its private class loader, e.g. DeferredDatastoreSessionStore for async session persistence. With APPENGINE_USE_CLOUDTASK_PUSH_QUEUE=true, storing a session then fails the request with NoClassDefFoundError: com/google/auth/Credentials. Add google-cloud-tasks and its dependencies (gax, gax-grpc, gax-httpjson, grpc, google-auth-library, google-http-client, opencensus, opentelemetry, threetenbp) to both runtime jars, merge META-INF/services files so gRPC finds its providers, and exclude the netty native libraries as the SDK jar does. CloudTasksSessionTest runs the allinone app with async session persistence and the Cloud Tasks flag enabled, and checks that the session request is served and that the runtime logs no class loading errors.
Collaborator
Author
Runtime jar size impactMeasured locally (JDK 25):
The runtime deployment ships both jars, so it grows by about 20.8 MB in total. No existing entries were removed. Where the added bytes come from (
|
This was referenced Oct 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The runtime jars (
runtime_impl_jetty12,runtime_impl_jetty121) include every class incom/google/appengine/api/taskqueue/*fromappengine-apis. Since fd92dbe that package containsCloudTasksClientWrapperandTaskProcessor(and the jars now includeSweeperServlet), but none of the Cloud Tasks client libraries they depend on, and none of them are relocated.The runtime uses the Task Queue API itself, from its private class loader: with
<async-session-persistence>,DeferredDatastoreSessionStoreadds a deferred task on every session save. WithAPPENGINE_USE_CLOUDTASK_PUSH_QUEUE=true, that goes through the runtime's copy ofQueueImplintoCloudTasksClientWrapper, and the request fails:appengine-api-1.0-sdkis not affected: it bundles and relocates the whole client stack.Fix
In both runtime poms:
appengine-api-1.0-sdk, minus Cloud Storage):google-cloud-tasks, the v2/v2beta3 protos and gRPC stubs,proto-google-iam-v1,gax,gax-grpc,gax-httpjson(referenced by theCloudTasksClientconstructor),api-common,protobuf-java-util,grpc-*,google-auth-library-*,google-http-client/-gson,opencensus,opentelemetry,threetenbp.ServicesResourceTransformer, so gRPC'sMETA-INF/servicesprovider files (name resolvers, load balancers, channel providers) are merged instead of overwriting each other.grpc-netty-shaded'sMETA-INF/native/**, as the SDK jar does.Test
New
CloudTasksSessionTest(runtime e2e, parameterized likeJavaRuntimeAllInOneTest): runs the allinone app with<async-session-persistence enabled="true"/>andAPPENGINE_USE_CLOUDTASK_PUSH_QUEUE=true, makes the session requests, and checks that they're served and that the runtime output has noClassNotFoundException/NoClassDefFoundError.JavaRuntimeViaHttpBase.RuntimeContextgets anoutputLinesContaining(Pattern)helper for that.There is no Cloud Tasks endpoint override, so the client really calls
cloudtasks.googleapis.comwith fake project1and gets an auth/permission error. The test therefore doesn't check that the session content survives the deferred write, only that the whole client stack loads and runs from the runtime class loader.Results (JDK 25, Jetty 12.1 EE8 and EE11):
NoClassDefFoundError: com/google/auth/Credentialsabove.PERMISSION_DENIED: Permission denied on resource project 1.The java17/java21 combinations (Jetty 12.0 jar) were not run locally; the Jetty 12.0 and 12.1 jars contain the same Cloud Tasks classes and merged gRPC service files. CI covers those JDKs.