Investigation of Unexpected Full GC Frequency Leading to Backend Service Failure

A Java backend service crashed during testing due to excessive Full GC events caused by unbounded queries that retrieved over 40,000 records, leading to massive List allocations, old‑generation memory pressure, and ultimately service failure.

FunTester
FunTester
FunTester
Investigation of Unexpected Full GC Frequency Leading to Backend Service Failure

During a test, the backend user service unexpectedly crashed; although the user count was small, the middle layer reported many timeout errors.

Examining the user service GC logs revealed an unusual pattern: the number of Full GC events was higher than Young GC events, as shown in the GC statistics chart.

A snapshot captured a second in which two Full GC events occurred back‑to‑back.

The GC logs also contained numerous failure messages, indicating that many GC cycles could not complete.

To keep the service running, the configuration was doubled and all tests were stopped except for a single debugging account; this allowed the service to survive long enough to discover the root cause: the middle‑layer call to the backend query interface omitted the limit parameter, causing each request to retrieve the entire dataset of over 40,000 records.

Each request from the middle layer initially succeeded, but quickly failed because it created an excessively large List and the query consumed substantial resources, leading the service to hang.

Recalling a recent book on Java memory management, the author noted that very large objects may be allocated directly in the old generation, which triggers frequent Full GC cycles; insufficient memory then causes Full GC failures.

Disclaimer: This article was first published on the “FunTester” public account and may not be reproduced by third parties (except Tencent Cloud).

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

javaMemory Managementgc
FunTester
Written by

FunTester

10k followers, 1k articles | completely useless

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.