Closed
      
        Bug 302737
      
      
        Opened 20 years ago
          Closed 20 years ago
      
        
    
  
[FIX]Plugins leak ns4xPluginStreamListeners and whatever they entrain   
    Categories
(Core Graveyard :: Plug-ins, defect, P2)
        Core Graveyard
          
        
        
      
        
    
        Plug-ins
          
        
        
      
        
    Tracking
(Not tracked)
        RESOLVED
        FIXED
        
    
  
        
            mozilla1.9alpha1
        
    
  
People
(Reporter: bzbarsky, Assigned: bzbarsky)
References
()
Details
(Keywords: fixed1.8.0.7, fixed1.8.1, memory-leak)
Attachments
(1 file)
| 
        
        
         2.89 KB,
          patch         
       | 
      
           jst
 :
              
              review+
          jst
 :
              
              superreview+
          dveditz
 :
              
              approval1.8.0.7+
          mtschrep
 :
              
              approval1.8.1+
           | 
      Details | Diff | Splinter Review | 
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...
| Assignee | ||
          Comment 1•20 years ago
           
         | 
      ||
I'm guessing this is 1.9-type stuff at this point.... :(
        Attachment #191025 -
        Flags: review?(jst)
          Comment 2•20 years ago
           
         | 
      ||
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+
| Assignee | ||
          Updated•20 years ago
           
         | 
      
        Attachment #191025 -
        Flags: superreview?(dbaron)
| Assignee | ||
          Updated•20 years ago
           
         | 
      
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
| Assignee | ||
          Comment 3•20 years ago
           
         | 
      ||
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 4•20 years ago
           
         | 
      ||
Comment on attachment 191025 [details] [diff] [review]
Like this, perhaps?
Sure, sr=jst too.
        Attachment #191025 -
        Flags: superreview?(jst) → superreview+
| Assignee | ||
          Comment 5•20 years ago
           
         | 
      ||
Fixed on trunk.
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
          Comment 6•19 years ago
           
         | 
      ||
Is this leak worth fixing for 1.8.0.1 or 1.8.1?
| Assignee | ||
          Comment 7•19 years ago
           
         | 
      ||
No idea.  More importantly, I can't give a risk evaluation here; I have no idea what this patch could break.
          Comment 8•19 years ago
           
         | 
      ||
JST - thoughts on a branch patch for this?
          Updated•19 years ago
           
         | 
      
Flags: blocking1.8.1?
          Comment 9•19 years ago
           
         | 
      ||
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.
          Updated•19 years ago
           
         | 
      
Flags: blocking1.8.0.6?
          Updated•19 years ago
           
         | 
      
        Attachment #191025 -
        Flags: approval1.8.1?
          Updated•19 years ago
           
         | 
      
Flags: blocking1.8.1? → blocking1.8.1+
Target Milestone: mozilla1.9alpha → mozilla1.8.1beta2
          Updated•19 years ago
           
         | 
      
        Attachment #191025 -
        Flags: approval1.8.1? → approval1.8.1+
jst, want to land it now that it's approved?
| Assignee | ||
          Comment 11•19 years ago
           
         | 
      ||
Fixed on branch.  Hadn't realized this got approved...
Keywords: fixed1.8.1
| Assignee | ||
          Updated•19 years ago
           
         | 
      
Target Milestone: mozilla1.8.1beta2 → mozilla1.9alpha
          Updated•19 years ago
           
         | 
      
Flags: blocking1.8.0.7? → blocking1.8.0.7+
          Comment 12•19 years ago
           
         | 
      ||
Comment on attachment 191025 [details] [diff] [review]
Like this, perhaps?
approved for 1.8.0 branch, a=dveditz for drivers
        Attachment #191025 -
        Flags: approval1.8.0.7+
| Assignee | ||
          Comment 14•19 years ago
           
         | 
      ||
So this caused regression bug 354124...  No idea why.  :(
| Assignee | ||
          Comment 15•19 years ago
           
         | 
      ||
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".
          Updated•3 years ago
           
         | 
      
Product: Core → Core Graveyard
          You need to log in
          before you can comment on or make changes to this bug.
        
Description
•