javamemory-leaksglassfish-4.1

Memory leak in grizzly Glassfish 4.1


I encounter the problem that the Glassfish process consumes too much memory. Below are the top lines of the jmap.

num     #instances         #bytes  class name
----------------------------------------------
   1:        431326     3252450960  [B
   2:       3540281      871974256  [C
   3:       6705066      375483696  org.glassfish.grizzly.http.util.ByteChunk
   4:       6891640      330798720  org.glassfish.grizzly.http.util.CharChunk
   5:       6853189      274127560  org.glassfish.grizzly.http.util.BufferChunk
   6:       6666497      213327904  org.glassfish.grizzly.http.util.DataChunk

I did a search but did not found any related issue. If this issue has ever rung your bell, please share me the cause and solution? May upgrade Glassfish help to solve the issue?


Solution

  • This leak happens after upgrading Spring from 5.0.2 to 5.0.4. Moving back to Spring 5.0.2, the problem is gone. It seems that Server Sent Event (SSE) does not release memory properly in Spring 5.0.4.