test_channel_id.js leaks a ton of stuff in the content process

RESOLVED FIXED in Firefox 54

Status

()

Core
Networking: HTTP
RESOLVED FIXED
a year ago
a year ago

People

(Reporter: Ehsan, Assigned: Ehsan)

Tracking

(Blocks: 1 bug)

unspecified
mozilla54
Points:
---

Firefox Tracking Flags

(firefox54 fixed)

Details

(Whiteboard: [necko-active])

Attachments

(1 attachment)

(Assignee)

Description

a year ago
STR:

Run the following:

$ XPCOM_MEM_LEAK_LOG=1 ./mach xpcshell-test netwerk/test/unit_ipc/test_channel_id.js

 0:05.01 PROCESS_OUTPUT: Thread-1 (pid:22095) "== BloatView: ALL (cumulative) LEAK STATISTICS, tab process 22096"
 0:05.01 PROCESS_OUTPUT: Thread-1 (pid:22095) "     |<----------------Class--------------->|<-----Bytes------>|<----Objects---->|"
 0:05.01 PROCESS_OUTPUT: Thread-1 (pid:22095) "     |                                      | Per-Inst   Leaked|   Total      Rem|"
 0:05.01 PROCESS_OUTPUT: Thread-1 (pid:22095) "   0 |TOTAL                                 |       53     7208|   27756      100|"
 0:05.01 PROCESS_OUTPUT: Thread-1 (pid:22095) "   8 |BackstagePass                         |      104      104|      39        1|"
 0:05.01 PROCESS_OUTPUT: Thread-1 (pid:22095) "  17 |ChannelEventQueue                     |       72       72|       3        1|"
 0:05.01 PROCESS_OUTPUT: Thread-1 (pid:22095) "  18 |ChildDNSService                       |      120      120|       1        1|"
 0:05.01 PROCESS_OUTPUT: Thread-1 (pid:22095) "  24 |CondVar                               |       40       80|      64        2|"
 0:05.01 PROCESS_OUTPUT: Thread-1 (pid:22095) "  26 |ConsoleReportCollector                |       64       64|       4        1|"
 0:05.01 PROCESS_OUTPUT: Thread-1 (pid:22095) "  31 |DataStorage                           |      336      672|       2        2|"
 0:05.01 PROCESS_OUTPUT: Thread-1 (pid:22095) "  54 |HttpChannelChild                      |     1560     1560|       3        1|"
 0:05.01 PROCESS_OUTPUT: Thread-1 (pid:22095) "  67 |LoadInfo                              |      216      216|     116        1|"
 0:05.01 PROCESS_OUTPUT: Thread-1 (pid:22095) "  76 |Mutex                                 |       32      320|     161       10|"
 0:05.01 PROCESS_OUTPUT: Thread-1 (pid:22095) "  84 |PHttpChannelChild                     |       40       40|       3        1|"
 0:05.01 PROCESS_OUTPUT: Thread-1 (pid:22095) "  96 |PollableEvent                         |       24       24|       1        1|"
 0:05.01 PROCESS_OUTPUT: Thread-1 (pid:22095) " 110 |ReentrantMonitor                      |       40       80|      30        2|"
 0:05.01 PROCESS_OUTPUT: Thread-1 (pid:22095) " 113 |RequestContextService                 |       88       88|       1        1|"
 0:05.01 PROCESS_OUTPUT: Thread-1 (pid:22095) " 160 |XPCNativeInterface                    |       56      168|     115        3|"
 0:05.01 PROCESS_OUTPUT: Thread-1 (pid:22095) " 161 |XPCNativeMember                       |       16       48|    2983        3|"
 0:05.01 PROCESS_OUTPUT: Thread-1 (pid:22095) " 162 |XPCNativeSet                          |       32       64|     125        2|"
 0:05.01 PROCESS_OUTPUT: Thread-1 (pid:22095) " 163 |XPCWrappedNative                      |       96      192|     510        2|"
 0:05.01 PROCESS_OUTPUT: Thread-1 (pid:22095) " 164 |XPCWrappedNativeProto                 |       40       40|     213        1|"
 0:05.01 PROCESS_OUTPUT: Thread-1 (pid:22095) " 166 |XPCWrappedNativeTearOff               |       32      128|     644        4|"
 0:05.01 PROCESS_OUTPUT: Thread-1 (pid:22095) " 191 |nsAuthURLParser                       |       24       24|       2        1|"
 0:05.01 PROCESS_OUTPUT: Thread-1 (pid:22095) " 204 |nsCategoryObserver                    |       96       96|       1        1|"
 0:05.01 PROCESS_OUTPUT: Thread-1 (pid:22095) " 234 |nsHttpAuthCache::OriginClearObserver  |       32       64|       2        2|"
 0:05.01 PROCESS_OUTPUT: Thread-1 (pid:22095) " 235 |nsHttpHandler                         |      736      736|       1        1|"
 0:05.01 PROCESS_OUTPUT: Thread-1 (pid:22095) " 236 |nsHttpRequestHead                     |      136      136|       3        1|"
 0:05.01 PROCESS_OUTPUT: Thread-1 (pid:22095) " 238 |nsIOService                           |      272      272|       1        1|"
 0:05.01 PROCESS_OUTPUT: Thread-1 (pid:22095) " 243 |nsJSPrincipals                        |       24       48|      10        2|"
 0:05.01 PROCESS_OUTPUT: Thread-1 (pid:22095) " 250 |nsMainThreadPtrHolder<T>              |       24       48|       5        2|"
 0:05.01 PROCESS_OUTPUT: Thread-1 (pid:22095) " 277 |nsSiteSecurityService                 |       80       80|       1        1|"
 0:05.01 PROCESS_OUTPUT: Thread-1 (pid:22095) " 278 |nsSocketTransportService              |      256      256|       1        1|"
 0:05.01 PROCESS_OUTPUT: Thread-1 (pid:22095) " 279 |nsStandardURL                         |      264      528|     423        2|"
 0:05.01 PROCESS_OUTPUT: Thread-1 (pid:22095) " 282 |nsStringBuffer                        |        8      168|   10314       21|"
 0:05.01 PROCESS_OUTPUT: Thread-1 (pid:22095) " 291 |nsTArray_base                         |        8      104|    4829       13|"
 0:05.01 PROCESS_OUTPUT: Thread-1 (pid:22095) " 298 |nsUUIDGenerator                       |       56       56|       1        1|"
 0:05.01 PROCESS_OUTPUT: Thread-1 (pid:22095) " 301 |nsWeakReference                       |       40      160|      23        4|"
 0:05.01 PROCESS_OUTPUT: Thread-1 (pid:22095) " 316 |nsXPCWrappedJS                        |      120      120|      47        1|"
 0:05.01 PROCESS_OUTPUT: Thread-1 (pid:22095) " 317 |nsXPCWrappedJSClass                   |       72       72|       8        1|"
 0:05.01 PROCESS_OUTPUT: Thread-1 (pid:22095) " 322 |xptiInterfaceInfo                     |       40      160|      99        4|"
 0:05.01 PROCESS_OUTPUT: Thread-1 (pid:22095) "nsTraceRefcnt::DumpStatistics: 323 entries"
 0:05.03 PROCESS_OUTPUT: Thread-1 (pid:22095) "== BloatView: ALL (cumulative) LEAK STATISTICS, default process 22095"
 0:05.03 PROCESS_OUTPUT: Thread-1 (pid:22095) "     |<----------------Class--------------->|<-----Bytes------>|<----Objects---->|"
 0:05.03 PROCESS_OUTPUT: Thread-1 (pid:22095) "     |                                      | Per-Inst   Leaked|   Total      Rem|"
 0:05.03 PROCESS_OUTPUT: Thread-1 (pid:22095) "   0 |TOTAL                                 |       52      200|   36907        2|"
 0:05.03 PROCESS_OUTPUT: Thread-1 (pid:22095) " 339 |nsLocalFile                           |      192      192|     668        1|"
 0:05.03 PROCESS_OUTPUT: Thread-1 (pid:22095) " 387 |nsStringBuffer                        |        8        8|   13010        1|"

I spent hours today trying to debug this.  Finally I found out that the leak is coming from the test itself, caused by ChannelListener._closurectx, which creates a cross-language cycle between the channel listener object and the channel itself, which leaks HttpChannelChild and as a result, the entire object graph above.
(Assignee)

Comment 1

a year ago
Created attachment 8840251 [details] [diff] [review]
Break a reference cycle caused by ChannelListener that creates leaks in all tests using it
Attachment #8840251 - Flags: review?(mcmanus)
(Assignee)

Updated

a year ago
Blocks: 1341961
Comment on attachment 8840251 [details] [diff] [review]
Break a reference cycle caused by ChannelListener that creates leaks in all tests using it

Review of attachment 8840251 [details] [diff] [review]:
-----------------------------------------------------------------

thank you
Attachment #8840251 - Flags: review?(mcmanus) → review+

Comment 3

a year ago
Pushed by eakhgari@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/c8b32cb1f15b
Break a reference cycle caused by ChannelListener that creates leaks in all tests using it; r=mcmanus
Whiteboard: [necko-active]

Comment 4

a year ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/c8b32cb1f15b
Status: NEW → RESOLVED
Last Resolved: a year ago
status-firefox54: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla54
(Assignee)

Updated

a year ago
No longer blocks: 1340710
You need to log in before you can comment on or make changes to this bug.