Closed Bug 302737 Opened 15 years ago Closed 14 years ago
[FIX]Plugins leak ns4x
Plugin Stream Listeners and whatever they entrain
We end up leaking listeners that are allocated when a plugin calls NPN_GetURL, with the following stack to the unbalanced addref: NPN_GetURL (/home/bzbarsky/plugins/libflashplayer.so) _geturl (../../../../../mozilla/modules/plugin/base/src/ns4xPlugin.cpp:964) MakeNew4xStreamInternal(_NPP*, char const*, char const*, eNPPStreamTypeInternal, int, void*, unsigned int, char const*, unsigned char) (../../../../../mozilla/modules/plugin/base/src/ns4xPlugin.cpp:928) ns4xPluginInstance::NewNotifyStream(nsIPluginStreamListener**, void*, int, char const*) (../../../../../mozilla/modules/plugin/base/src/ns4xPluginInstance.cpp:1357) And indeed, NewNotifyStream addrefs its our param and the caller never releases it here. Fixing that makes us crash, since ns4xPluginStreamListener::CallURLNotify helpfully calls NS_RELEASE_THIS() with the comment: 235 // Let's not leak this stream listener. Release the reference to the stream listener 236 // added for the notify callback in NewNotifyStream. Problem is, CallURLNotify has several early returns (in non-failure cases, even). So do the methods that call CallURLNotify. The net result is that it's pretty easy for us to leak this whole mess. What I think should happen is that this NS_RELEASE_THIS() should be removed, and that MakeNew4xStreamInternal should be just release its ptr. To make sure this is safe, though, have to trace through the ownership model between this class and ns4xPluginInstance...
I'm guessing this is 1.9-type stuff at this point.... :(
Attachment #191025 - Flags: review?(jst)
Comment on attachment 191025 [details] [diff] [review] Like this, perhaps? I'm not going to claim I completely understand the ownership model for the objects in question here, but from looking at this change and the surrounding code it *seems* like this is indeed what we want here. r=jst to give this some mileage on the trunk...
Attachment #191025 - Flags: review?(jst) → review+
Attachment #191025 - Flags: superreview?(dbaron)
Assignee: nobody → bzbarsky
Priority: -- → P2
Summary: Plugins leak ns4xPluginStreamListeners and whatever they entrain → [FIX]Plugins leak ns4xPluginStreamListeners and whatever they entrain
Target Milestone: --- → mozilla1.9alpha
Comment on attachment 191025 [details] [diff] [review] Like this, perhaps? jst, want to just make this an r+sr?
Attachment #191025 - Flags: superreview?(dbaron) → superreview?(jst)
Comment on attachment 191025 [details] [diff] [review] Like this, perhaps? Sure, sr=jst too.
Attachment #191025 - Flags: superreview?(jst) → superreview+
Fixed on trunk.
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
No idea. More importantly, I can't give a risk evaluation here; I have no idea what this patch could break.
JST - thoughts on a branch patch for this?
Seems worth doing. It's been on the trunk long enough IMO, and this patch applies cleanly (though with some offset) to the branch as well so IMO we could just land this.
Flags: blocking1.8.1? → blocking1.8.1+
Target Milestone: mozilla1.9alpha → mozilla1.8.1beta2
jst, want to land it now that it's approved?
Fixed on branch. Hadn't realized this got approved...
Target Milestone: mozilla1.8.1beta2 → mozilla1.9alpha
Comment on attachment 191025 [details] [diff] [review] Like this, perhaps? approved for 1.8.0 branch, a=dveditz for drivers
Attachment #191025 - Flags: approval126.96.36.199+
Fixed for 188.8.131.52
So this caused regression bug 354124... No idea why. :(
If my analysis in bug 354124 is correct, we probably need to back this out of branches.... and add more plug-in tests to whatever pre-release test suites we run, or not touch plug-in code on branches anymore. I also feel that this bug is just another indication that trunk is really not getting enough testing in the various modes we support to base decisions on "there haven't been any problems on trunk".
You need to log in before you can comment on or make changes to this bug.