Closed Bug 1316527 Opened 8 years ago Closed 8 years ago

XPCOM refcount logging doesn't work

Categories

(Core :: XPCOM, defect)

52 Branch
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla53
Tracking Status
firefox50 --- unaffected
firefox51 --- unaffected
firefox52 --- fixed
firefox53 --- fixed

People

(Reporter: heycam, Assigned: mccr8)

References

Details

(Keywords: regression)

Attachments

(1 file)

Since bug 1309051, I can't use XPCOM refcount logging. $ XPCOM_MEM_REFCNT_LOG=1 XPCOM_MEM_LOG_CLASSES=nsStandardURL ./obj/dist/bin/firefox -P test -no-remote ### XPCOM_MEM_REFCNT_LOG defined -- logging refcounts to stdout ### XPCOM_MEM_LOG_CLASSES defined -- only logging these classes: nsStandardURL Assertion failure: aCreate (If an object does not have a serial number, we should be creating it.), at /z/moz/central/xpcom/base/nsTraceRefcnt.cpp:590
Blocks: 1309051
No longer depends on: 1309051
Keywords: regression
You can work around this by commenting out the assertion. I'm not sure what is going wrong. I guess I didn't test the COM ptr case.
Assignee: nobody → continuation
I could have sworn I tested this locally, but I don't see how it could have ever worked. Anyways, no matter what class you are logging, NS_LogCOMPtrAddRef always looks up every object it gets passed, to try to get a serial number. Before my patch, when it passed in false, it would just get zero back, and then it would just return without doing any additional work. Now, it asserts. The most direct fix is to add a third state to getting a serial number, where you don't assert on failure to get a serial number.
Comment on attachment 8811472 [details] Bug 1316527 - Return 0 when GetSerialNumber fails to find an existing serial number. https://reviewboard.mozilla.org/r/93580/#review93630 Do you think we could add tests for these, with some manual calls to the appropriate functions?
Attachment #8811472 - Flags: review?(nfroyd) → review+
Version: unspecified → 52 Branch
(In reply to Nathan Froyd [:froydnj] from comment #6) > Do you think we could add tests for these, with some manual calls to the > appropriate functions? That's a good idea. I'm not sure exactly how that would work, though. Do we have any test suites we can use that start XPCOM but don't involve the full browser? Testing in a browser would involve starting up per-class logging during a run which might be weird.
Pushed by amccreight@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/811084dd7ec0 Return 0 when GetSerialNumber fails to find an existing serial number. r=froydnj
(In reply to Andrew McCreight [:mccr8] from comment #7) > (In reply to Nathan Froyd [:froydnj] from comment #6) > > Do you think we could add tests for these, with some manual calls to the > > appropriate functions? > > That's a good idea. I'm not sure exactly how that would work, though. Do we > have any test suites we can use that start XPCOM but don't involve the full > browser? Testing in a browser would involve starting up per-class logging > during a run which might be weird. I was thinking we could do a gtest (gtests start XPCOM), that had #ifdef DEBUG tests, with calls like: int placeholder; NS_LogAddRef(&placeholder, 1, "foo", sizeof(placeholder)); I mean, we could make up our own classes, but all we'd be doing with calls like these would be smoke-testing that things work. Maybe we could have introspection code into refcnt code so we could verify that when we log the final release, the object no longer exists in our tables or things like that. But the smoke tests were all I was thinking about initially, as nothing really checks the code until someone decides to run refcount logging on their browser.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla53
Comment on attachment 8811472 [details] Bug 1316527 - Return 0 when GetSerialNumber fails to find an existing serial number. Approval Request Comment [Feature/regressing bug #]: bug 1309051 [User impact if declined]: No direct impact. This makes investigating leaks harder. [Describe test coverage new/current, TreeHerder]: none [Risks and why]: Almost none. This is only a change to debug builds. [String/UUID change made/needed]: none
Attachment #8811472 - Flags: approval-mozilla-aurora?
Comment on attachment 8811472 [details] Bug 1316527 - Return 0 when GetSerialNumber fails to find an existing serial number. fix refcount logging issue in aurora52
Attachment #8811472 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
See Also: → 1321338
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: