Closed Bug 396368 Opened 17 years ago Closed 13 years ago

JS LiveConnect usage leaks

Categories

(Core Graveyard :: Java: OJI, defect, P4)

x86
macOS
defect

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: sayrer, Assigned: sayrer)

References

()

Details

(Keywords: memory-leak, testcase)

Attachments

(6 files, 1 obsolete file)

The Java plugin on www.showmyip.com causes us to leak quite a bit.
Blocks: 394517
Over to right component.
Assignee: blackconnect → nobody
Component: Java-Implemented Plugins → Java: OJI
QA Contact: blackconnect → java.oji
So it looks to me like on Mac (where Robert is) we must be leaking an MRJPlugin, which leaks the JVMManager...  I'd be interested in a balance tree for the MRJPlugin.

At first blush, though, this looks like a refcount cycle between the MRJPlugin (which getService()s the JVM manager into a member) and the JVMManager (which sticks the return of nsPluginHostImpl::GetPluginFactory into a member).
Nevermind about balance tree; MRJPlugin doesn't log its addref and release.  I stand by my comment about a reference cycle.

That said, we leak on Linux too, with similar stacks, so there may be similar issues there.  But that code doesn't even live in our tree...
(In reply to comment #6)
> Created an attachment (id=281123) [details]
> This _might_ help with the MRJ leak.  It doesn't help the Linux one....
> 

nope, doesn't help on mac either
Does the balance tree for nsJVMManager still look the same?

I wonder whether there's a way to build with the in-tree MRJ so we could add refcount logging to it and see what leaks it.
Flags: blocking1.9?
Attached patch bloat diffSplinter Review
After trying again today, it looks like attachment 281123 [details] [diff] [review] did work a bit.
(In reply to comment #8)

> I wonder whether there's a way to build with the in-tree MRJ so we
> could add refcount logging to it and see what leaks it.

Not really.

But you could rebuild the MRJ Plugin JEP that comes with the Java
Embedding Plugin -- which was based on the in-tree MRJ Plugin Carbon.
Hmm.  That diff shows nsJVMManager as "went away", not "fixed-leaks"??
Keywords: mlk
How much memory are we leaking here? If it's not a lot we might let this one slip and hope it gets fixed when liveconnect goes away. Additionally, is this happening on a lot of java pages, or have we only found one so far?

Robert: Could you try to figure out who's responsible for the leak here? If it's us and the leak is bad we need to find an owner.
Assignee: nobody → sayrer
Flags: blocking1.9? → blocking1.9+
> How much memory are we leaking here?

This particular test leaks at least everything on the page (windows, document, stylesheets, DOM tree, etc).
Attached file small testcase (obsolete) —
nsCycleCollector: nsGlobalWindow 0x3691177c was not collected due to 1
  external references (2 total - 1 known)
  An object expected to be garbage could be reached from it by the path:
    nsGlobalWindow 0x3691177c
  The 1 known references to it were from:
    XPCWrappedNative (Window) 0x369124a0
nsCycleCollector: nsGlobalWindow 0x36346cbc was not collected due to 1
  external references (2 total - 1 known)
  An object expected to be garbage could be reached from it by the path:
    nsGlobalWindow 0x36346cbc
  The 1 known references to it were from:
    XPCWrappedNative (Window) 0x36347b60
nsCycleCollector: XPCWrappedNative (Window) 0x369124a0 was not collected due to 1
  external references (1 total - 0 known)
  An object expected to be garbage could be reached from it by the path:
    XPCWrappedNative (Window) 0x369124a0
    nsGlobalWindow 0x3691177c
  The 0 known references to it were from:
nsCycleCollector: XPCWrappedNative (Window) 0x36347b60 was not collected due to 1
  external references (1 total - 0 known)
  An object expected to be garbage could be reached from it by the path:
    XPCWrappedNative (Window) 0x36347b60
    nsGlobalWindow 0x36346cbc
  The 0 known references to it were from:
Summary: Java plugins leak → Java LiveConnect usage leaks
Summary: Java LiveConnect usage leaks → JS LiveConnect usage leaks
Attached file reduced
calling any LiveConnect-wrapped Java method causes a leak. 

I'll add a JS heap that shows LiveConnect Java methods still in the JS heap. These are rooted in jsj_ResolveExplicitMethod and add_java_method_to_class_descriptor.
Attachment #282221 - Attachment is obsolete: true
Attached file JS heap at shutdown
Would still be nice to have this fixed, but what with liveconnect going away and all there are more important leaks.
Priority: -- → P4
Keywords: testcase
Given comment 18 taking this off blocking list
Flags: blocking1.9+ → blocking1.9-
Product: Core → Core Graveyard
Sick of seeing this in my kw:mlk kw:testcase query.
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: