Closed Bug 1344584 Opened 7 years ago Closed 7 years ago

test_be_conservative.js leaks TLSServerSocket and the world around it

Categories

(Core :: Networking, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: ehsan.akhgari, Assigned: keeler)

References

(Blocks 1 open bug)

Details

(Whiteboard: [necko-active])

Attachments

(2 files)

Attached patch WIP patchSplinter Review
$ XPCOM_MEM_LEAK_LOG=1 ./mach xpcshell-test netwerk/test/unit/test_be_conservative.js

 0:04.18 PROCESS_OUTPUT: Thread-1 (pid:66839) "== BloatView: ALL (cumulative) LEAK STATISTICS, default process 66839"
 0:04.19 PROCESS_OUTPUT: Thread-1 (pid:66839) "     |<----------------Class--------------->|<-----Bytes------>|<----Objects---->|"
 0:04.19 PROCESS_OUTPUT: Thread-1 (pid:66839) "     |                                      | Per-Inst   Leaked|   Total      Rem|"
 0:04.19 PROCESS_OUTPUT: Thread-1 (pid:66839) "   0 |TOTAL                                 |       54     8088|   22583      108|"
 0:04.19 PROCESS_OUTPUT: Thread-1 (pid:66839) "   8 |BackstagePass                         |      104      104|      12        1|"
 0:04.19 PROCESS_OUTPUT: Thread-1 (pid:66839) "  30 |CancelableRunnable                    |       48       96|      44        2|"
 0:04.19 PROCESS_OUTPUT: Thread-1 (pid:66839) "  38 |CondVar                               |       40       80|      70        2|"
 0:04.19 PROCESS_OUTPUT: Thread-1 (pid:66839) "  64 |IdlePeriod                            |       24       24|      28        1|"
 0:04.19 PROCESS_OUTPUT: Thread-1 (pid:66839) "  79 |Mutex                                 |       32      288|     249        9|"
 0:04.19 PROCESS_OUTPUT: Thread-1 (pid:66839) "  86 |PollableEvent                         |       24       24|       1        1|"
 0:04.19 PROCESS_OUTPUT: Thread-1 (pid:66839) "  99 |ReentrantMonitor                      |       40      160|      41        4|"
 0:04.19 PROCESS_OUTPUT: Thread-1 (pid:66839) " 106 |Runnable                              |       40       80|     351        2|"
 0:04.19 PROCESS_OUTPUT: Thread-1 (pid:66839) " 121 |TLSServerConnectionInfo               |      128      256|       4        2|"
 0:04.19 PROCESS_OUTPUT: Thread-1 (pid:66839) " 122 |TLSServerSecurityObserverProxy        |       32       64|       4        2|"
 0:04.19 PROCESS_OUTPUT: Thread-1 (pid:66839) " 123 |TLSServerSocket                       |      240      240|       2        1|"
 0:04.19 PROCESS_OUTPUT: Thread-1 (pid:66839) " 148 |XPCNativeInterface                    |       56      504|      65        9|"
 0:04.19 PROCESS_OUTPUT: Thread-1 (pid:66839) " 149 |XPCNativeMember                       |       16      144|    1873        9|"
 0:04.19 PROCESS_OUTPUT: Thread-1 (pid:66839) " 150 |XPCNativeSet                          |       32      160|      83        5|"
 0:04.19 PROCESS_OUTPUT: Thread-1 (pid:66839) " 151 |XPCWrappedNative                      |       96      480|     252        5|"
 0:04.19 PROCESS_OUTPUT: Thread-1 (pid:66839) " 152 |XPCWrappedNativeProto                 |       40      200|      90        5|"
 0:04.19 PROCESS_OUTPUT: Thread-1 (pid:66839) " 154 |XPCWrappedNativeTearOff               |       32      160|     305        5|"
 0:04.19 PROCESS_OUTPUT: Thread-1 (pid:66839) " 161 |nsAStreamCopier                       |      176      352|       8        2|"
 0:04.19 PROCESS_OUTPUT: Thread-1 (pid:66839) " 236 |nsJSPrincipals                        |       24       24|      20        1|"
 0:04.19 PROCESS_OUTPUT: Thread-1 (pid:66839) " 243 |nsMainThreadPtrHolder<T>              |       24       48|      24        2|"
 0:04.19 PROCESS_OUTPUT: Thread-1 (pid:66839) " 247 |nsNSSCertificate                      |       72       72|       7        1|"
 0:04.19 PROCESS_OUTPUT: Thread-1 (pid:66839) " 262 |nsPipe                                |      208      832|      11        4|"
 0:04.19 PROCESS_OUTPUT: Thread-1 (pid:66839) " 263 |nsPipeInputStream                     |      136      544|      11        4|"
 0:04.19 PROCESS_OUTPUT: Thread-1 (pid:66839) " 278 |nsServerSocket                        |      224      224|       2        1|"
 0:04.19 PROCESS_OUTPUT: Thread-1 (pid:66839) " 283 |nsSocketTransport                     |      760     1520|       9        2|"
 0:04.19 PROCESS_OUTPUT: Thread-1 (pid:66839) " 284 |nsSocketTransportService              |      256      256|       1        1|"
 0:04.19 PROCESS_OUTPUT: Thread-1 (pid:66839) " 290 |nsStringBuffer                        |        8       24|    8134        3|"
 0:04.19 PROCESS_OUTPUT: Thread-1 (pid:66839) " 296 |nsTArray_base                         |        8       64|    4098        8|"
 0:04.19 PROCESS_OUTPUT: Thread-1 (pid:66839) " 297 |nsThread                              |      352      352|      27        1|"
 0:04.19 PROCESS_OUTPUT: Thread-1 (pid:66839) " 323 |nsXPCWrappedJS                        |      120      240|      15        2|"
 0:04.19 PROCESS_OUTPUT: Thread-1 (pid:66839) " 324 |nsXPCWrappedJSClass                   |       72       72|      12        1|"
 0:04.19 PROCESS_OUTPUT: Thread-1 (pid:66839) " 329 |xptiInterfaceInfo                     |       40      400|      73       10|"
 0:04.19 PROCESS_OUTPUT: Thread-1 (pid:66839) "nsTraceRefcnt::DumpStatistics: 330 entries"

I spent a few hours today trying to debug this using refcount tracing logs.  As far as I can tell, the main object being leaked is TLSServerSocket.  My first theory was that there is a JS reference to this object which is leaking, but I kept eliminating them one by one, and I got to the patch attached but still the leak happens.  Note that the test creates two server objects, and only the second one leaks.  At this point I'm pretty sure the leak is coming from something inside Necko, but I don't have any good theories.  Unfortunately the refcount tracing log for TLSServerSocket is too complicated for me to understand.

I'm stuck on this one, would appreciate some help please.
No longer blocks: 1340710
I think this was yours david? remind me if it was mine :)
Assignee: nobody → dkeeler
Whiteboard: [necko-active]
Yes, I wrote this test. Looks like I wasn't closing the streams in the right places in the error case. I'll have a patch shortly.
Comment on attachment 8849683 [details]
bug 1344584 - proactively close streams in test_be_conservative.js to prevent leaks

https://reviewboard.mozilla.org/r/122460/#review124886

thanks!
Attachment #8849683 - Flags: review?(mcmanus) → review+
Pushed by dkeeler@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/d624f51d6ff3
proactively close streams in test_be_conservative.js to prevent leaks r=mcmanus
https://hg.mozilla.org/mozilla-central/rev/d624f51d6ff3
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: