Warning: Can't synchronize with repository "(default)" (/home/git/ome.git does not appear to be a Git repository.). Look in the Trac log for more information.
Notice: In order to edit this ticket you need to be either: a Product Owner, The owner or the reporter of the ticket, or, in case of a Task not yet assigned, a team_member"

Task #9456 (closed)

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

Bug: stateful service memory leak

Reported by: cxallan Owned by: jamoore
Priority: blocker Milestone: OMERO-4.4.4
Component: Performance Version: n.a.
Keywords: n.a. Cc: omero-team@…
Resources: n.a. Referenced By: n.a.
References: n.a. Remaining Time: 0.0d
Sprint: 2012-08-14 (2)

Description

In the pursuit of the closure of #9330, a subtle bug has been introduced where when a session's client reference count is at zero (near 99% of the time when used in conjunction with OMERO.web and the new decorator infrastructure which joins and closes sessions on each remote method call) the handler for DestroySessionMessage events does not remove the remaining stateful services from the object adapters resulting in a comparatively small memory leak.

The above is made significantly worse if cached rendering engines are used and even more catastrophic if those cached rendering engines contain instances of BfPixelBuffer or BfPyramidPixelBuffer. Both of which could occupy 10's of MBs of RAM.

Change History (7)

comment:1 Changed 12 years ago by cxallan

  • Cc omero-team@… added
  • Owner set to cxallan
  • Status changed from new to accepted

comment:2 Changed 12 years ago by jmoore

  • Owner changed from cxallan to jmoore

comment:3 Changed 12 years ago by jmoore

After refactoring and a couple of minor fixes, I'm seeing this output:

2012-08-10 15:22:50,452 INFO  [ ome.services.blitz.fire.SessionManagerI] (2-thread-1) Removing ServiceFactoryI(session-939040be-f4d1-42af-aa9f-dbef18b1a8de/648a0d8e-
aca5-4a32-a24e-259c4b843b4a)
2012-08-10 15:22:50,453 INFO  [ome.services.sessions.state.SessionCache] (2-thread-1) Destroying session e9705f27-79e6-4e77-80d0-067f0bbf7e5e due to : Timeout
2012-08-10 15:22:50,453 INFO  [                 org.perf4j.TimingLogger] (2-thread-1) start[1344604883402] time[87051] tag[omero.session]
2012-08-10 15:22:50,455 WARN  [ ome.services.blitz.fire.SessionManagerI] (2-thread-1) Reaping all remaining servants for e9705f27-79e6-4e77-80d0-067f0bbf7e5e: Count=
1
2012-08-10 15:22:50,455 WARN  [  ome.security.basic.BasicSecurityWiring] (2-thread-1) SessionTimeoutException on close:e9705f27-79e6-4e77-80d0-067f0bbf7e5e
2012-08-10 15:22:50,455 INFO  [        ome.services.util.ServiceHandler] (2-thread-1)  Meth:    interface ome.api.StatefulServiceInterface.close
2012-08-10 15:22:50,456 INFO  [        ome.services.util.ServiceHandler] (2-thread-1)  Args:    ()
2012-08-10 15:22:50,456 INFO  [                 org.perf4j.TimingLogger] (2-thread-1) start[1344604970456] time[0] tag[omero.call.success.ome.services.RenderingBean.
close]
2012-08-10 15:22:50,456 INFO  [        ome.services.util.ServiceHandler] (2-thread-1)  Rslt:    null
2012-08-10 15:22:50,456 INFO  [                      omero.cmd.SessionI] (2-thread-1) Unregistered servant:e9705f27-79e6-4e77-80d0-067f0bbf7e5e/c0:a8:b2:15:-3c66836:
13910b19219:-7ffbomero.api.RenderingEngine(omero.api._RenderingEngineTie@2937464f)

comment:4 Changed 12 years ago by jmoore

  • Remaining Time changed from 1.0 to 0
  • Resolution set to fixed
  • Status changed from accepted to closed

comment:5 Changed 12 years ago by Chris Allan <callan@…>

(In [2b1bb13372ec51107d9e9a4f6b98376bf3847375/ome.git] on branch develop) Potential solution for leaking stateful services. (See #9456)

comment:6 Changed 12 years ago by jmoore <josh@…>

(In [a4549547d5d766e17fda30b72a979d0102914448/ome.git] on branch develop) Refactor cleanup using statics (See #9456)

Initially, I tried to make use of a temporary SessionI instance in order
to re-use the cleanServants method. But since the session is timed out,
much of the ctor logic cannot be re-used. Instead, I've moved the
content of the methods to re-usable static versions.

comment:7 Changed 12 years ago by jmoore <josh@…>

(In [36004a8eb71ef4f915126a3348c20da0d6a88197/ome.git] on branch develop) Pass ServantHolder? to AbstractAmdServants? (See #9456)

Without a valid clientId, it wasn't possible to find the
ServiceFactoryI instance which owned the servant on close.
By passing in the ServantHolder?, we can cleanly clean up
using the static methods from the previous commit.

Note: See TracTickets for help on using tickets. You may also have a look at Agilo extensions to the ticket.

1.3.13-PRO © 2008-2011 Agilo Software all rights reserved (this page was served in: 0.67255 sec.)

We're Hiring!