Skip to content

chore: fix build, test, and CI workflow warnings - #532

Open
ludoch wants to merge 5 commits into
mainfrom
fix-build-warnings
Open

ludoch wants to merge 5 commits into
mainfrom
fix-build-warnings

Conversation

@ludoch

@ludoch ludoch commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Reduces noisy build/test warnings, uncaught background-thread exceptions, and excessive test log spam while speeding up Surefire test execution and GitHub Actions CI across all 4 JDKs (17, 21, 25, 28-ea).

Measured Gains (Before vs. After on GitHub Actions CI)

Metric Before (Baseline) After (This PR) Improvement
Total CI log lines (per JDK job) ~68,072 lines 23,614 lines -65% (-44,458 lines per job)
GitHub Actions ##[error] annotations 7 per job 0 100% eliminated
Uncaught background Exception in thread 12 per job 0 100% eliminated
CI jobs triggered per PR push 8 (push + pull_request) 4 (pull_request only) 50% fewer CI runner minutes
JDK 28-ea / JDK 25 CI job duration ~17m 30s – 21m+ 10m 42s (28-ea) / 13m 04s (25) ~5–8 minutes faster
api_dev test suite duration (5,008 tests) ~6m 07s (1 fork) ~2m 06s (2 forks) ~3x faster (-4 minutes)
external/geronimo_javamail test duration ~30s (35 forks) ~4.8s (reuseForks=true) ~6x faster
api test duration ~22s (22 forks) ~6.5s (reuseForks=true) ~3.4x faster
JVM Sharing is only supported warnings ~1,100 (local) / 82 (CI) 0 100% eliminated
JDK 24+ restricted method in java.lang.System ~360 (local) / 1+ (CI) 0 100% eliminated
JDK 24+ sun.misc.Unsafe::arrayBaseOffset warnings 112 (448 lines) 6 (24 lines) -95% eliminated
Dynamic Mockito/ByteBuddy agent warnings 6 (30 lines) 0 100% eliminated
Deprecated "CST" timezone warnings 13 0 100% eliminated
[MockitoHint] Unused stubbing warnings 81 lines 0 100% eliminated
protoc java_generic_services warnings 24 0 100% eliminated
appengine-api-stubs Javadoc warnings 14 0 100% eliminated
GMTransportTest DEBUG: getProvider() lines 39 0 100% eliminated
ApiCallsTest per-RPC INFO log spam 4,404 (~21,000 lines) 0 100% eliminated
InterruptedApiCallTest warning stack traces 1,569 (~11,000 lines) 5 (expected unit tests) -99.7% eliminated
LocalDatastoreService.init INFO logs 3,131 (~6,260 lines) 28 (~56 lines) -99% eliminated

Detailed Changes

  1. Protobuf java_generic_services deprecation warnings:
    • Remove unused option java_generic_services = true; from capability_service.proto, images_service.proto, memcache_service.proto, and urlfetch_service.proto.
  2. Surefire JVM warnings (-Xshare:off, --enable-native-access=ALL-UNNAMED, --sun-misc-unsafe-memory-access=allow, Mockito agent, and CST timezone):
    • Add -Xshare:off and --enable-native-access=ALL-UNNAMED to the root maven-surefire-plugin <argLine>, eliminating Sharing is only supported for boot loader classes and JDK 24+ restricted native access warnings across forked test JVMs.
    • Add a surefire-jdk24plus profile (<jdk>[24,)</jdk>) setting --sun-misc-unsafe-memory-access=allow (and pass it in JavaRuntimeViaHttpBase.optionalFlags() when Runtime.version().feature() >= 24) to silence sun.misc.Unsafe::arrayBaseOffset warnings from protobuf-java on JDK 25 and 28-ea while remaining compatible with JDK 17 and 21.
    • Update appengine_testing_tests/pom.xml, applications/guestbook/pom.xml, applications/guestbook_jakarta/pom.xml, and applications/jaxrs/pom.xml Surefire <argLine> configurations to include -Xshare:off, --enable-native-access=ALL-UNNAMED, ${surefire.unsafe.arg}, -javaagent:${org.mockito:mockito-core:jar}, and replace deprecated -Duser.timezone=CST with -Duser.timezone=America/Chicago.
  3. Faster Surefire Test Execution (reuseForks & forkCount):
    • Enable <reuseForks>true</reuseForks> in external/geronimo_javamail and api.
    • Set <forkCount>2</forkCount> in api_dev (preserving <reuseForks>false</reuseForks> process isolation per test class while running 2 forks in parallel, cutting api_dev test time from ~6m to ~2m).
  4. SLF4J No SLF4J providers were found warnings:
    • Add org.slf4j:slf4j-nop (<scope>test</scope>) to api, api_dev, appengine_testing_tests, and runtime/test.
  5. JSP compiler -source/-target warnings:
    • Update Application.compileJspJavaFiles in lib/tools_api to pass --release <javaVersion> -Xlint:-options instead of -source / -target.
  6. Mockito [MockitoHint] Unused stubbing warnings:
    • Clean up unused mock stubbings in ImagesServiceImplTest, AdminDatastoreServiceTest, BlobstoreServiceImplTest, DatastoreCallbacksTest, GCacheTest, and runtime_impl_jetty12's FileSenderTest.
  7. Uncaught background-thread exceptions & flaky memory assertion in tests:
    • GMTransportTest: Remove mail.debug=true and set explicit Content-Transfer-Encoding headers on non-String text/plain parts so DataHandler.getInputStream background threads don't throw ClassCastException in TextHandler.writeTo.
    • ApiProxyImplTest: Iterate over a snapshot copy (new ArrayList<>(futures)) when cancelling futures so synchronous cancellation listeners don't trigger ConcurrentModificationException on background threads.
    • HttpApiProxyImplTestBase: Restore thread interrupt status (Thread.currentThread().interrupt()) instead of throwing an uncaught RuntimeException(InterruptedException) when FakeHttpApiHost stops after timeout tests (eliminating all ##[error] sleep interrupted annotations on GitHub Actions).
    • TraceWriterMemoryTest: Measure actual used heap memory (runtime.totalMemory() - runtime.freeMemory()) instead of runtime.freeMemory() so G1GC committed-heap expansion does not cause false-positive failures on JDK 28-ea.
  8. Excessive test log spam & Javadoc warnings:
    • ApiCallsTest: Pass -Ddisable_api_call_logging_in_apiproxy=true via GAE_JAVA_OPTS to suppress ~21,000 lines of per-RPC INFO log spam during the 4,400-RPC concurrency/stress tests.
    • InterruptedApiCallTest: Temporarily set ApiProxyImpl logger level to SEVERE during the 1,000-interrupt spray loop to suppress ~11,000 lines of expected InterruptedException stack traces.
    • LocalImagesService, LocalDatastoreService, and LocalSearchService: Log initialization/missing-format messages at INFO/WARNING once per JVM and FINE thereafter in tests (eliminating ~6,700 lines of repetitive service init logs).
    • api_dev: Fix 5 malformed/unresolved Javadoc tags ({@local}, {@Link}, {@CapabilityStatus}, unqualified {@link Logger} and {@link LocalURLFetchService}) so appengine-api-stubs builds with 0 Javadoc warnings.
  9. GitHub Actions workflow (maven.yml):
    • Upgrade actions/checkout and actions/setup-java to SHA-pinned v5 releases and add top-level permissions: contents: read (satisfying zizmor).
    • Restrict push: trigger to main (avoiding duplicate 8-job push + pull_request runs on PR branches) and add a concurrency group with cancel-in-progress: true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant