Closed Bug 1629457 Opened 10 months ago Closed 8 months ago

Intermittent netwerk/test/unit/test_trr.js | application crashed [@ __thiscall InitHash::InitHash + 0x12d3] | TRRServiceChannel using nsWeakReference OffMainThread

Categories

(Core :: Networking, defect, P2)

defect

Tracking

()

RESOLVED FIXED
mozilla78
Tracking Status
firefox-esr68 --- unaffected
firefox76 --- wontfix
firefox77 --- wontfix
firefox78 --- fixed

People

(Reporter: intermittent-bug-filer, Assigned: kershaw)

References

Details

(Keywords: crash, intermittent-failure, Whiteboard: [necko-triaged][trr])

Crash Data

Attachments

(1 file, 1 obsolete file)

Filed by: rmaries [at] mozilla.com
Parsed log: https://treeherder.mozilla.org/logviewer.html#?job_id=297317067&repo=autoland
Full log: https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/Mk8rs-1NRc2oI42gXI4CMA/runs/0/artifacts/public/logs/live_backing.log


[task 2020-04-13T01:27:41.679Z] 01:27:41 INFO - TEST-START | netwerk/test/unit/test_trr.js
[task 2020-04-13T01:27:45.714Z] 01:27:45 WARNING - TEST-UNEXPECTED-FAIL | netwerk/test/unit/test_trr.js | xpcshell return code: 1
[task 2020-04-13T01:27:45.714Z] 01:27:45 INFO - TEST-INFO took 4036ms
[task 2020-04-13T01:27:45.715Z] 01:27:45 INFO - >>>>>>>
[task 2020-04-13T01:27:45.872Z] 01:27:45 INFO - TEST-PASS | netwerk/test/unit/test_trr.js | test_resolve_not_confirmed - [test_resolve_not_confirmed : 174] Checking result for example.org - "127.0.0.1" == "127.0.0.1"
[task 2020-04-13T01:27:45.872Z] 01:27:45 INFO - PID 9172 | Hit MOZ_CRASH(nsWeakReference not thread-safe) at /builds/worker/checkouts/gecko/xpcom/base/nsISupportsImpl.cpp:40
[task 2020-04-13T01:27:45.872Z] 01:27:45 INFO - <<<<<<<
[task 2020-04-13T01:27:45.872Z] 01:27:45 INFO - mozcrash Copy/paste: Z:/task_1586739710/fetches\minidump_stackwalk\minidump_stackwalk.exe c:\users\task_1586739710\appdata\local\temp\xpc-other-hwlhnf\9f471ca7-30ed-4a74-b6bf-70b5ecb4f47c.dmp Z:\task_1586739710\build\symbols
[task 2020-04-13T01:28:17.629Z] 01:28:17 INFO - mozcrash Saved minidump as Z:\task_1586739710\build\blobber_upload_dir\9f471ca7-30ed-4a74-b6bf-70b5ecb4f47c.dmp
[task 2020-04-13T01:28:17.629Z] 01:28:17 INFO - mozcrash Saved app info as Z:\task_1586739710\build\blobber_upload_dir\9f471ca7-30ed-4a74-b6bf-70b5ecb4f47c.extra
[task 2020-04-13T01:28:17.636Z] 01:28:17 WARNING - PROCESS-CRASH | netwerk/test/unit/test_trr.js | application crashed [@ __thiscall InitHash::InitHash + 0x12d3]
[task 2020-04-13T01:28:17.636Z] 01:28:17 INFO - Crash dump filename: c:\users\task_1586739710\appdata\local\temp\xpc-other-hwlhnf\9f471ca7-30ed-4a74-b6bf-70b5ecb4f47c.dmp
[task 2020-04-13T01:28:17.637Z] 01:28:17 INFO - Operating system: Windows NT
[task 2020-04-13T01:28:17.638Z] 01:28:17 INFO - 6.1.7601 Service Pack 1
[task 2020-04-13T01:28:17.638Z] 01:28:17 INFO - CPU: x86
[task 2020-04-13T01:28:17.639Z] 01:28:17 INFO - GenuineIntel family 6 model 63 stepping 2
[task 2020-04-13T01:28:17.639Z] 01:28:17 INFO - 8 CPUs
[task 2020-04-13T01:28:17.640Z] 01:28:17 INFO - GPU: UNKNOWN
[task 2020-04-13T01:28:17.640Z] 01:28:17 INFO - Crash reason: EXCEPTION_NONCONTINUABLE_EXCEPTION
[task 2020-04-13T01:28:17.640Z] 01:28:17 INFO - Crash address: 0x0
[task 2020-04-13T01:28:17.641Z] 01:28:17 INFO - Assertion: Pure virtual function called
[task 2020-04-13T01:28:17.641Z] 01:28:17 INFO - Process uptime: 4 seconds
[task 2020-04-13T01:28:17.641Z] 01:28:17 INFO - Thread 9 (crashed)
[task 2020-04-13T01:28:17.642Z] 01:28:17 INFO - 0 VCRUNTIME140.dll!__thiscall InitHash::InitHash + 0x12d3
[task 2020-04-13T01:28:17.642Z] 01:28:17 INFO - eip = 0x73154d16 esp = 0x00cef344 ebp = 0x00cef364 ebx = 0x00ceed04
[task 2020-04-13T01:28:17.642Z] 01:28:17 INFO - esi = 0x00764050 edi = 0x00cef020 eax = 0x00ceefd0 ecx = 0x00000000
[task 2020-04-13T01:28:17.643Z] 01:28:17 INFO - edx = 0x00cef020 efl = 0x00000216
[task 2020-04-13T01:28:17.643Z] 01:28:17 INFO - Found by: given as instruction pointer in context
[task 2020-04-13T01:28:17.644Z] 01:28:17 INFO - 1 xul.dll!nsDNSPrefetch::OnLookupComplete(nsICancelable*, nsIDNSRecord*, nsresult) [nsDNSPrefetch.cpp:da2b1829e1fd5bb09b405214cfb8d80bd911f111 : 120 + 0x32]
[task 2020-04-13T01:28:17.644Z] 01:28:17 INFO - eip = 0x553052e5 esp = 0x00cef36c ebp = 0x00cef3a4
[task 2020-04-13T01:28:17.645Z] 01:28:17 INFO - Found by: previous frame's frame pointer
[task 2020-04-13T01:28:17.645Z] 01:28:17 INFO - 2 xul.dll!mozilla::net::DNSListenerProxy::OnLookupCompleteRunnable::Run() [DNSListenerProxy.cpp:da2b1829e1fd5bb09b405214cfb8d80bd911f111 : 25 + 0xf]
[task 2020-04-13T01:28:17.646Z] 01:28:17 INFO - eip = 0x553b0bbc esp = 0x00cef3ac ebp = 0x00cef3c4 esi = 0x0cf19460
[task 2020-04-13T01:28:17.646Z] 01:28:17 INFO - edi = 0x0ced27e0
[task 2020-04-13T01:28:17.646Z] 01:28:17 INFO - Found by: call frame info
[task 2020-04-13T01:28:17.647Z] 01:28:17 INFO - 3 xul.dll!nsThread::ProcessNextEvent(bool, bool*) [nsThread.cpp:da2b1829e1fd5bb09b405214cfb8d80bd911f111 : 1200 + 0x6]
[task 2020-04-13T01:28:17.647Z] 01:28:17 INFO - eip = 0x551f15d5 esp = 0x00cef3cc ebp = 0x00cef8e8 esi = 0x0070e838
[task 2020-04-13T01:28:17.647Z] 01:28:17 INFO - edi = 0x0070e790
[task 2020-04-13T01:28:17.648Z] 01:28:17 INFO - Found by: call frame info
[task 2020-04-13T01:28:17.648Z] 01:28:17 INFO - 4 xul.dll!NS_ProcessNextEvent(nsIThread*, bool) [nsThreadUtils.cpp:da2b1829e1fd5bb09b405214cfb8d80bd911f111 : 481 + 0xb]
[task 2020-04-13T01:28:17.649Z] 01:28:17 INFO - eip = 0x551f65e8 esp = 0x00cef8f0 ebp = 0x00cef90c ebx = 0x007ba500
[task 2020-04-13T01:28:17.649Z] 01:28:17 INFO - esi = 0x00cef8ff edi = 0x00cef9e0
[task 2020-04-13T01:28:17.650Z] 01:28:17 INFO - Found by: call frame info
[task 2020-04-13T01:28:17.650Z] 01:28:17 INFO - 5 xul.dll!mozilla::ipc::MessagePumpForNonMainThreads::Run(base::MessagePump::Delegate*) [MessagePump.cpp:da2b1829e1fd5bb09b405214cfb8d80bd911f111 : 332 + 0xa]
[task 2020-04-13T01:28:17.650Z] 01:28:17 INFO - eip = 0x559172fe esp = 0x00cef914 ebp = 0x00cef940 ebx = 0x007ba500
[task 2020-04-13T01:28:17.651Z] 01:28:17 INFO - esi = 0x007ba560
[task 2020-04-13T01:28:17.651Z] 01:28:17 INFO - Found by: call frame info
[task 2020-04-13T01:28:17.652Z] 01:28:17 INFO - 6 xul.dll!MessageLoop::RunInternal() [message_loop.cc:da2b1829e1fd5bb09b405214cfb8d80bd911f111 : 315 + 0x5]
[task 2020-04-13T01:28:17.652Z] 01:28:17 INFO - eip = 0x558c3f21 esp = 0x00cef948 ebp = 0x00cef964 ebx = 0x00cef9d8
[task 2020-04-13T01:28:17.653Z] 01:28:17 INFO - esi = 0x00cef9e0 edi = 0x00cef9e0
[task 2020-04-13T01:28:17.653Z] 01:28:17 INFO - Found by: call frame info
[task 2020-04-13T01:28:17.653Z] 01:28:17 INFO - 7 xul.dll!MessageLoop::RunHandler() [message_loop.cc:da2b1829e1fd5bb09b405214cfb8d80bd911f111 : 308 + 0x7]
[task 2020-04-13T01:28:17.654Z] 01:28:17 INFO - eip = 0x558c3e33 esp = 0x00cef96c ebp = 0x00cef998 esi = 0x00cef9e0
[task 2020-04-13T01:28:17.654Z] 01:28:17 INFO - Found by: call frame info
[task 2020-04-13T01:28:17.655Z] 01:28:17 INFO - 8 xul.dll!MessageLoop::Run() [message_loop.cc:da2b1829e1fd5bb09b405214cfb8d80bd911f111 : 290 + 0x5]
[task 2020-04-13T01:28:17.655Z] 01:28:17 INFO - eip = 0x558c3cf7 esp = 0x00cef9a0 ebp = 0x00cef9c8 ebx = 0x00cef9d8
[task 2020-04-13T01:28:17.655Z] 01:28:17 INFO - esi = 0x0070e790 edi = 0x00cef9e0
[task 2020-04-13T01:28:17.656Z] 01:28:17 INFO - Found by: call frame info
[task 2020-04-13T01:28:17.656Z] 01:28:17 INFO - 9 xul.dll!static nsThread::ThreadFunc(void*) [nsThread.cpp:da2b1829e1fd5bb09b405214cfb8d80bd911f111 : 444 + 0x7]
[task 2020-04-13T01:28:17.656Z] 01:28:17 INFO - eip = 0x551ee1a1 esp = 0x00cef9d0 ebp = 0x00cefad8
[task 2020-04-13T01:28:17.657Z] 01:28:17 INFO - Found by: call frame info
[task 2020-04-13T01:28:17.657Z] 01:28:17 INFO - 10 nss3.dll!_PR_NativeRunThread(void*) [pruthr.c:da2b1829e1fd5bb09b405214cfb8d80bd911f111 : 399 + 0x6]
[task 2020-04-13T01:28:17.658Z] 01:28:17 INFO - eip = 0x6b24b3eb esp = 0x00cefae0 ebp = 0x00cefb00 ebx = 0x003ec730
[task 2020-04-13T01:28:17.658Z] 01:28:17 INFO - esi = 0x007098d0 edi = 0x00709820
[task 2020-04-13T01:28:17.658Z] 01:28:17 INFO - Found by: call frame info
[task 2020-04-13T01:28:17.659Z] 01:28:17 INFO - 11 nss3.dll!pr_root(void*) [w95thred.c:da2b1829e1fd5bb09b405214cfb8d80bd911f111 : 139 + 0x7]
[task 2020-04-13T01:28:17.659Z] 01:28:17 INFO - eip = 0x6b23ce9d esp = 0x00cefb08 ebp = 0x00cefb0c ebx = 0x003ec730
[task 2020-04-13T01:28:17.660Z] 01:28:17 INFO - esi = 0x6b23ce90 edi = 0x003ec730
[task 2020-04-13T01:28:17.660Z] 01:28:17 INFO - Found by: call frame info
[task 2020-04-13T01:28:17.661Z] 01:28:17 INFO - 12 ucrtbase.dll!long __stdcall SwupReadIndirectTarget(struct _SWU_STATE *,struct _SWD_DECODE *,unsigned char,unsigned long *) + 0xf
[task 2020-04-13T01:28:17.661Z] 01:28:17 INFO - eip = 0x6b91e16f esp = 0x00cefb14 ebp = 0x00cefb48
[task 2020-04-13T01:28:17.661Z] 01:28:17 INFO - Found by: call frame info
[task 2020-04-13T01:28:17.662Z] 01:28:17 INFO - 13 kernel32.dll!virtual long __thiscall NtWin32LiveSystemProvider::EnumHandles(uint64_t *,unsigned long *,unsigned long *,unsigned long *,unsigned long *,unsigned short ,unsigned long,unsigned short ,unsigned long) + 0x99
[task 2020-04-13T01:28:17.662Z] 01:28:17 INFO - eip = 0x772fef3c esp = 0x00cefb50 ebp = 0x00cefb54
[task 2020-04-13T01:28:17.663Z] 01:28:17 INFO - Found by: call frame info
[task 2020-04-13T01:28:17.663Z] 01:28:17 INFO - 14 mozglue.dll!patched_BaseThreadInitThunk(int, void
, void
) [WindowsDllBlocklist.cpp:da2b1829e1fd5bb09b405214cfb8d80bd911f111 : 588 + 0x14]
[task 2020-04-13T01:28:17.663Z] 01:28:17 INFO - eip = 0x6bbc0227 esp = 0x00cefb5c ebp = 0x00cefb90
[task 2020-04-13T01:28:17.664Z] 01:28:17 INFO - Found by: call frame info
[task 2020-04-13T01:28:17.664Z] 01:28:17 INFO - 15 ntdll.dll!__thiscall CDiaEnumStackFrames<class CStackTrav,class CX86StackWalkHelper>::CDiaEnumStackFrames<class CStackTrav,class CX86StackWalkHelper> + 0x1
[task 2020-04-13T01:28:17.664Z] 01:28:17 INFO - eip = 0x77a13618 esp = 0x00cefb98 ebp = 0x00cefbd0 ebx = 0x003ec730
[task 2020-04-13T01:28:17.664Z] 01:28:17 INFO - esi = 0x00000000 edi = 0x00000000
[task 2020-04-13T01:28:17.665Z] 01:28:17 INFO - Found by: call frame info
[task 2020-04-13T01:28:17.665Z] 01:28:17 INFO - 16 iertutil.dll!virtual unsigned char * __thiscall WTI::pSymWidenTi(unsigned char *) + 0x137647
[task 2020-04-13T01:28:17.665Z] 01:28:17 INFO - eip = 0x7773946c esp = 0x00cefba0 ebp = 0x00cefbd0
[task 2020-04-13T01:28:17.666Z] 01:28:17 INFO - Found by: call frame info
[task 2020-04-13T01:28:17.666Z] 01:28:17 INFO - 17 ntdll.dll!long CreateStackWalker(struct IUnknown * *) + 0x15
[task 2020-04-13T01:28:17.666Z] 01:28:17 INFO - eip = 0x77a135eb esp = 0x00cefbd8 ebp = 0x00cefbe8
[task 2020-04-13T01:28:17.667Z] 01:28:17 INFO - Found by: previous frame's frame pointer

Whiteboard: [necko-triaged]

The priority flag is not set for this bug.
:michal, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(michal.novotny)

Not sure what happens here. Looks like nsDNSPrefetch might be already destroyed, but DNSListenerProxy holds a strong reference. Valentin, can you please have a look?

Flags: needinfo?(michal.novotny) → needinfo?(valentin.gosu)
Priority: -- → P2

Hit MOZ_CRASH(nsWeakReference not thread-safe)

OK, it seems the problem is that nsDNSPrefetch holds a weakReference to mListener, but the weakreference is not threadsafe.
I'm wondering if we really need to DNS prefetch in TRRServiceChannel, or if there's a simpler way of prefetching the DNS, without using nsDNSPrefetch. Maybe just a AsyncResolveNative would be enough?

Kershaw, what do you think?

Flags: needinfo?(valentin.gosu) → needinfo?(kershaw)
Summary: Intermittent netwerk/test/unit/test_trr.js | application crashed [@ __thiscall InitHash::InitHash + 0x12d3] after xpcshell return code: 1 → Intermittent netwerk/test/unit/test_trr.js | application crashed [@ __thiscall InitHash::InitHash + 0x12d3] | TRRServiceChannel using nsWeakReference OffMainThread
Whiteboard: [necko-triaged] → [necko-triaged][trr]
Duplicate of this bug: 1633614

(In reply to Valentin Gosu [:valentin] (he/him) from comment #5)

Hit MOZ_CRASH(nsWeakReference not thread-safe)

OK, it seems the problem is that nsDNSPrefetch holds a weakReference to mListener, but the weakreference is not threadsafe.
I'm wondering if we really need to DNS prefetch in TRRServiceChannel, or if there's a simpler way of prefetching the DNS, without using nsDNSPrefetch. Maybe just a AsyncResolveNative would be enough?

Kershaw, what do you think?

This is weird. mListener should be only accessed on the target thread. No idea why this is happening.
I think having DNS prefetch in TRRServiceChannel might be able to speed things up a bit, so I'll try to fix this bug.

Flags: needinfo?(kershaw)
Assignee: nobody → kershaw
Status: NEW → ASSIGNED

With this patch, the TRRServiceChannel is always released on main thread and causes the crash. The weird thing is that this not happens on macos, so I didn't see this during my local tests.

https://treeherder.mozilla.org/#/jobs?repo=try&revision=9fe1e20a4f5a1dbf9b2fd8f3dfcbc2d7df087362

[task 2020-05-04T15:26:55.290Z] 15:26:55     INFO -  PID 26796 | #01: nsSupportsWeakReference::ClearWeakReferences() [hg:hg.mozilla.org/try:xpcom/base/nsWeakReference.cpp:9fe1e20a4f5a1dbf9b2fd8f3dfcbc2d7df087362:157]
[task 2020-05-04T15:26:55.291Z] 15:26:55     INFO -  PID 26796 | #02: mozilla::net::TRRServiceChannel::~TRRServiceChannel() [hg:hg.mozilla.org/try:netwerk/protocol/http/TRRServiceChannel.cpp:9fe1e20a4f5a1dbf9b2fd8f3dfcbc2d7df087362:58]
[task 2020-05-04T15:26:55.292Z] 15:26:55     INFO -  PID 26796 | #03: mozilla::net::TRRServiceChannel::~TRRServiceChannel() [hg:hg.mozilla.org/try:netwerk/protocol/http/TRRServiceChannel.cpp:9fe1e20a4f5a1dbf9b2fd8f3dfcbc2d7df087362:56]
[task 2020-05-04T15:26:55.298Z] 15:26:55     INFO -  PID 26796 | #04: mozilla::net::TRRServiceChannel::Release() [hg:hg.mozilla.org/try:netwerk/protocol/http/TRRServiceChannel.cpp:9fe1e20a4f5a1dbf9b2fd8f3dfcbc2d7df087362:29]
[task 2020-05-04T15:26:55.299Z] 15:26:55     INFO -  PID 26796 | #05: mozilla::detail::RunnableMethodImpl<mozilla::net::TRRServiceChannel*, nsresult (mozilla::net::TRRServiceChannel::*)(), true, (mozilla::RunnableKind)0>::~RunnableMethodImpl() [hg:hg.mozilla.org/try:xpcom/threads/nsThreadUtils.h:9fe1e20a4f5a1dbf9b2fd8f3dfcbc2d7df087362:1195]
[task 2020-05-04T15:26:55.300Z] 15:26:55     INFO -  PID 26796 | #06: mozilla::detail::RunnableMethodImpl<mozilla::net::TRRServiceChannel*, nsresult (mozilla::net::TRRServiceChannel::*)(), true, (mozilla::RunnableKind)0>::~RunnableMethodImpl() [hg:hg.mozilla.org/try:xpcom/threads/nsThreadUtils.h:9fe1e20a4f5a1dbf9b2fd8f3dfcbc2d7df087362:1195]
[task 2020-05-04T15:26:55.303Z] 15:26:55     INFO -  PID 26796 | #07: mozilla::Runnable::Release() [hg:hg.mozilla.org/try:xpcom/threads/nsThreadUtils.cpp:9fe1e20a4f5a1dbf9b2fd8f3dfcbc2d7df087362:54]
[task 2020-05-04T15:26:55.303Z] 15:26:55     INFO -  PID 26796 | #08: nsThread::ProcessNextEvent(bool, bool*) [hg:hg.mozilla.org/try:xpcom/threads/nsThread.cpp:9fe1e20a4f5a1dbf9b2fd8f3dfcbc2d7df087362:1216]
[task 2020-05-04T15:26:55.303Z] 15:26:55     INFO -  PID 26796 | #09: NS_ProcessNextEvent(nsIThread*, bool) [hg:hg.mozilla.org/try:xpcom/threads/nsThreadUtils.cpp:9fe1e20a4f5a1dbf9b2fd8f3dfcbc2d7df087362:481]
[task 2020-05-04T15:26:55.304Z] 15:26:55     INFO -  PID 26796 | #10: nsThreadManager::SpinEventLoopUntilInternal(nsINestedEventLoopCondition*, bool) [hg:hg.mozilla.org/try:xpcom/threads/nsThreadManager.cpp:9fe1e20a4f5a1dbf9b2fd8f3dfcbc2d7df087362:693]
[task 2020-05-04T15:26:55.304Z] 15:26:55     INFO -  PID 26796 | #11: ??? [/builds/worker/workspace/build/application/firefox/libxul.so + 0x10bc542]
[task 2020-05-04T15:26:55.304Z] 15:26:55     INFO -  PID 26796 | #12: CallMethodHelper::Call() [hg:hg.mozilla.org/try:js/xpconnect/src/XPCWrappedNative.cpp:9fe1e20a4f5a1dbf9b2fd8f3dfcbc2d7df087362:1175]
[task 2020-05-04T15:26:55.305Z] 15:26:55     INFO -  PID 26796 | #13: XPCWrappedNative::CallMethod(XPCCallContext&, XPCWrappedNative::CallMode) [hg:hg.mozilla.org/try:js/xpconnect/src/XPCWrappedNative.cpp:9fe1e20a4f5a1dbf9b2fd8f3dfcbc2d7df087362:1141]
[task 2020-05-04T15:26:55.305Z] 15:26:55     INFO -  PID 26796 | #14: XPC_WN_CallMethod(JSContext*, unsigned int, JS::Value*) [hg:hg.mozilla.org/try:js/xpconnect/src/XPCWrappedNativeJSOps.cpp:9fe1e20a4f5a1dbf9b2fd8f3dfcbc2d7df087362:946]
[task 2020-05-04T15:26:55.305Z] 15:26:55     INFO -  PID 26796 | #15: CallJSNative(JSContext*, bool (*)(JSContext*, unsigned int, JS::Value*), js::CallReason, JS::CallArgs const&) [hg:hg.mozilla.org/try:js/src/vm/Interpreter.cpp:9fe1e20a4f5a1dbf9b2fd8f3dfcbc2d7df087362:493]
[task 2020-05-04T15:26:55.306Z] 15:26:55     INFO -  PID 26796 | #16: js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) [hg:hg.mozilla.org/try:js/src/vm/Interpreter.cpp:9fe1e20a4f5a1dbf9b2fd8f3dfcbc2d7df087362:585]
[task 2020-05-04T15:26:55.306Z] 15:26:55     INFO -  PID 26796 | #17: Interpret(JSContext*, js::RunState&) [hg:hg.mozilla.org/try:js/src/vm/Interpreter.cpp:9fe1e20a4f5a1dbf9b2fd8f3dfcbc2d7df087362:0]
[task 2020-05-04T15:26:55.307Z] 15:26:55     INFO -  PID 26796 | #18: js::RunScript(JSContext*, js::RunState&) [hg:hg.mozilla.org/try:js/src/vm/Interpreter.cpp:9fe1e20a4f5a1dbf9b2fd8f3dfcbc2d7df087362:465]
[task 2020-05-04T15:26:55.307Z] 15:26:55     INFO -  PID 26796 | #19: js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) [hg:hg.mozilla.org/try:js/src/vm/Interpreter.cpp:9fe1e20a4f5a1dbf9b2fd8f3dfcbc2d7df087362:620]
[task 2020-05-04T15:26:55.307Z] 15:26:55     INFO -  PID 26796 | #20: js::jit::DoCallFallback(JSContext*, js::jit::BaselineFrame*, js::jit::ICCall_Fallback*, unsigned int, JS::Value*, JS::MutableHandle<JS::Value>) [hg:hg.mozilla.org/try:js/src/jit/BaselineIC.cpp:9fe1e20a4f5a1dbf9b2fd8f3dfcbc2d7df087362:2928]
[task 2020-05-04T15:26:55.308Z] 15:26:55     INFO -  PID 26796 | #21: ??? (???:???)

So maybe we should just get rid of the weakReference entirely, since it's not thread safe?
We can replace mDNSPrefetch->PrefetchHigh with a nsIDNSService.asyncResolveNative(...). Then we just need to make sure we cancel the resolve in OnStopRequest and/or in TRRServiceChannel::Cancel.

Let me know if you want me to do that.

(In reply to Valentin Gosu [:valentin] (he/him) from comment #10)

So maybe we should just get rid of the weakReference entirely, since it's not thread safe?
We can replace mDNSPrefetch->PrefetchHigh with a nsIDNSService.asyncResolveNative(...). Then we just need to make sure we cancel the resolve in OnStopRequest and/or in TRRServiceChannel::Cancel.

Let me know if you want me to do that.

I think we can't directly call nsIDNSService.asyncResolveNative(...) from nsHttpChannel and TRRServiceChannel, since DNSListenerProxy always release the listener on the main thread.

But I agree with you that we should get rid off weakReference. I think I can work on this bug. Thanks.

Duplicate of this bug: 1635887
Crash Signature: [@ __thiscall InitHash::InitHash + 0x12d3] → [@ __thiscall InitHash::InitHash + 0x12d3] [@ mozilla::net::TRRServiceChannel::QueryInterface]
Attachment #9144689 - Attachment description: Bug 1629457 - Make sure nsDNSPrefetch::mListener is released on target thread → Bug 1629457 - Get rid off nsWeakPtr in nsDNSPrefetch
Pushed by kjang@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/8bfa7127e064
Get rid off nsWeakPtr in nsDNSPrefetch r=valentin
Crash Signature: [@ __thiscall InitHash::InitHash + 0x12d3] [@ mozilla::net::TRRServiceChannel::QueryInterface] → [@ __thiscall InitHash::InitHash + 0x12d3] [@ mozilla::net::TRRServiceChannel::QueryInterface]
Flags: needinfo?(kershaw)

(In reply to Dorel Luca [:dluca] from comment #14)

Backed out changeset 8bfa7127e064 (bug 1629457) for WPT and Mochitest failures. CLOSED TREE

Log:
https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=301214533&repo=autoland&lineNumber=2987

Push with failures:
https://treeherder.mozilla.org/#/jobs?repo=autoland&group_state=expanded&revision=8bfa7127e0643e0eb49029b4b487ce4182e03ef7

Backout:
https://hg.mozilla.org/integration/autoland/rev/3523714afacddd8e35b603a862229935c3139fdb

It turns out that nsHttpChannel::OnStopRequest will not be always called.
I'll update my patch.

Flags: needinfo?(kershaw)

So, we need to release mDNSPrefetch in nsHttpChannel::DoNotifyListenerCleanup and nsHttpChannel::ContinueAsyncRedirectChannelToURI. Looking at the comment here, nsHttpChannel::OnStopRequest will not be called when there is no pump created. This makes me think maybe not using nsSupportsWeakReference in nsDNSPrefetch is a bad idea.

I think maybe the correct way is to fix bug 1616014 first. After that, nsDNSPrefetch should be always released on the right thread.
What do you think, Valentin?

Flags: needinfo?(valentin.gosu)

(In reply to Kershaw Chang [:kershaw] from comment #16)

So, we need to release mDNSPrefetch in nsHttpChannel::DoNotifyListenerCleanup and nsHttpChannel::ContinueAsyncRedirectChannelToURI. Looking at the comment here, nsHttpChannel::OnStopRequest will not be called when there is no pump created. This makes me think maybe not using nsSupportsWeakReference in nsDNSPrefetch is a bad idea.

I think maybe the correct way is to fix bug 1616014 first. After that, nsDNSPrefetch should be always released on the right thread.
What do you think, Valentin?

I guess that's a step in the right direction. Ultimately I'd just rather that classes were threadsafe, and we wouldn't have to worry.
I suppose bug 1616014 will fix this crash? And we should file another bug for a follow-up?

Flags: needinfo?(valentin.gosu)
Attachment #9144689 - Attachment is obsolete: true
Pushed by kjang@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/fb341901c6f7
Make sure TRRServiceChannel is released on target thread r=dragana
Status: ASSIGNED → RESOLVED
Closed: 8 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla78
Duplicate of this bug: 1635558
Crash Signature: [@ __thiscall InitHash::InitHash + 0x12d3] [@ mozilla::net::TRRServiceChannel::QueryInterface] → [@ __thiscall InitHash::InitHash + 0x12d3] [@ mozilla::net::TRRServiceChannel::QueryInterface] [@ RtlNumberOfSetBitsUlongPtr + 0xfe]
You need to log in before you can comment on or make changes to this bug.