Closed Bug 711602 Opened 13 years ago Closed 13 years ago

"ASSERTION: bad size recorded" with mozVibrate

Categories

(Core :: DOM: Core & HTML, defect)

x86_64
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla11

People

(Reporter: jruderman, Assigned: justin.lebar+bug)

References

Details

(Keywords: assertion, testcase)

Attachments

(3 files)

Attached file testcase
###!!! ASSERTION: bad size recorded: 'aInstanceSize == 0 || entry->GetClassSize() == aInstanceSize', file /builds/slave/m-cen-osx64-dbg/build/xpcom/base/nsTraceRefcntImpl.cpp, line 473

NS_LogAddRef_P [xpcom/base/nsTraceRefcntImpl.cpp:998]
mozilla::ClearOnShutdown_Internal::ShutdownObserver<nsAutoPtr<InfallibleTArray<long long unsigned int> > >::AddRef [down.h:79]
nsObserverList::AddObserver [nsCOMPtr.h:889]
mozilla::ClearOnShutdown<nsAutoPtr<InfallibleTArray<long long unsigned int> > > [:519]
mozilla::hal::Vibrate [hal/Hal.cpp:115]
mozilla::dom::Navigator::MozVibrate [nsCOMPtr.h:519]
NS_InvokeByIndex_P [xpcom/reflect/xptcall/src/md/unix/xptcinvoke_x86_64_unix.cpp:197]

###!!! ASSERTION: bad size recorded: 'aInstanceSize == 0 || entry->GetClassSize() == aInstanceSize', file /builds/slave/m-cen-osx64-dbg/build/xpcom/base/nsTraceRefcntImpl.cpp, line 473

NS_LogAddRef_P [xpcom/base/nsTraceRefcntImpl.cpp:998]
mozilla::ClearOnShutdown_Internal::ShutdownObserver<nsRefPtr<mozilla::dom::<unnamed>::VibrateWindowListener> >::AddRef [ClearOnShutdown.h:79]
nsObserverList::FillObserverArray [nsCOMPtr.h:880]
nsObserverList::NotifyObservers [xpcom/ds/nsObserverList.cpp:127]
nsObserverService::NotifyObservers [nsTHashtable.h:163]
mozilla::ShutdownXPCOM [xpcom/glue/nsCOMPtr.h:519]
ScopedXPCOMStartup::~ScopedXPCOMStartup [toolkit/xre/nsAppRunner.cpp:1115]
XRE_main [nsCOMPtr.h:807]
main [browser/app/nsBrowserApp.cpp:201]

Tested with http://hg.mozilla.org/mozilla-central/rev/7cc472108eb4
Blocks: 706958
No longer blocks: 694862
This is almost surely a result of the NS_ISUPPORTS implementation hack I have for ClearOnShutdown<T>.  Sigh.
Assignee: nobody → justin.lebar+bug
Hm, I can't reproduce with a local debug, trace-malloc build, rev 7ccc472.  I verified that ClearOnShutdown is being called.
I do see this in the mochitest-3 logs, however.
Not the same stacks as in comment 0, strangely.
Maybe the trace refcnt assertions just aren't on when I run dist/bin/firefox?  I see the assertions when I run the vibrator mochitest locally.
Attached patch Patch v1Splinter Review
Reading through the implementation of INLINE_REFCOUNTING and DECL_{ADDREF,RELEASE}, it's not entirely clear to me why this works.  But it does seem to work.
Attachment #582902 - Flags: review?(benjamin)
Comment on attachment 582902 [details] [diff] [review]
Patch v1

This turns out to just be a name collision with the other ShutdownObserver in gfx-land.
Attachment #582902 - Flags: review?(benjamin) → review+
I'll fully qualify the class name in the NS_IMPL macros.
https://hg.mozilla.org/mozilla-central/rev/dd2f9236b591
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla11
(In reply to Justin Lebar [:jlebar] from comment #5)
> Maybe the trace refcnt assertions just aren't on when I run
> dist/bin/firefox?  I see the assertions when I run the vibrator mochitest
> locally.

I see the assertion (in an old build) if I run with XPCOM_MEM_LEAK_LOG=2.
Yes, refcnt logging isn't enabled by default, you have to set an environment variable to enable it. Mochitest does this by default:
http://mxr.mozilla.org/mozilla-central/source/testing/mochitest/runtests.py#543
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: