Closed Bug 1755767 Opened 3 years ago Closed 3 years ago

Intermittent LeakSanitizer | leak at mozilla::net::nsHttpTransaction::SetSecurityCallbacks, mozilla::net::nsHttpChannel::UpdateAggregateCallbacks, SetNotificationCallbacks, mozilla::net::nsHttpChannel::SetNotificationCallbacks

Categories

(Core :: Networking: HTTP, defect, P2)

defect

Tracking

()

RESOLVED FIXED
100 Branch
Tracking Status
firefox98 --- wontfix
firefox99 + fixed
firefox100 + fixed

People

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

References

(Blocks 1 open bug)

Details

(Keywords: intermittent-failure, Whiteboard: [necko-triaged][stockwell disable-recommended])

Attachments

(1 file)

Filed by: abutkovits [at] mozilla.com
Parsed log: https://treeherder.mozilla.org/logviewer?job_id=368078508&repo=mozilla-beta
Full log: https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/M-Dff10pQcu8jLl-K1BiUQ/runs/0/artifacts/public/logs/live_backing.log


[task 2022-02-16T14:00:13.357Z] 14:00:13     INFO - PID 1007 | Direct leak of 32 byte(s) in 1 object(s) allocated from:
[task 2022-02-16T14:00:13.357Z] 14:00:13     INFO - PID 1007 |     #0 0x55d6fef08d6d in malloc /builds/worker/fetches/llvm-project/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cpp:129:3
[task 2022-02-16T14:00:13.357Z] 14:00:13     INFO - PID 1007 |     #1 0x55d6fef43bed in moz_xmalloc /builds/worker/checkouts/gecko/memory/mozalloc/mozalloc.cpp:52:15
[task 2022-02-16T14:00:13.357Z] 14:00:13     INFO - PID 1007 |     #2 0x7f97ee863d89 in operator new /builds/worker/workspace/obj-build/dist/include/mozilla/cxxalloc.h:33:10
[task 2022-02-16T14:00:13.357Z] 14:00:13     INFO - PID 1007 |     #3 0x7f97ee863d89 in mozilla::net::AddStaticElement(nsTString<char> const&, nsTString<char> const&) /builds/worker/checkouts/gecko/netwerk/protocol/http/Http2Compression.cpp:96:18
[task 2022-02-16T14:00:13.357Z] 14:00:13     INFO - PID 1007 |     #4 0x7f97ee7b3596 in AddStaticElement /builds/worker/checkouts/gecko/netwerk/protocol/http/Http2Compression.cpp:101:3
[task 2022-02-16T14:00:13.357Z] 14:00:13     INFO - PID 1007 |     #5 0x7f97ee7b3596 in InitializeStaticHeaders /builds/worker/checkouts/gecko/netwerk/protocol/http/Http2Compression.cpp:126:5
[task 2022-02-16T14:00:13.358Z] 14:00:13     INFO - PID 1007 |     #6 0x7f97ee7b3596 in mozilla::net::nvFIFO::nvFIFO() /builds/worker/checkouts/gecko/netwerk/protocol/http/Http2Compression.cpp:183:20
[task 2022-02-16T14:00:13.358Z] 14:00:13     INFO - PID 1007 |     #7 0x7f97ee7b6363 in mozilla::net::Http2BaseCompressor::Http2BaseCompressor() /builds/worker/checkouts/gecko/netwerk/protocol/http/Http2Compression.cpp:234:22
[task 2022-02-16T14:00:13.358Z] 14:00:13     INFO - PID 1007 |     #8 0x7f97ee7cb21d in mozilla::net::Http2Compressor::Http2Compressor() /builds/worker/checkouts/gecko/netwerk/protocol/http/Http2Compression.h:155:3
[task 2022-02-16T14:00:13.358Z] 14:00:13     INFO - PID 1007 |     #9 0x7f97ee7ca245 in mozilla::net::Http2Session::Http2Session(nsISocketTransport*, mozilla::net::SpdyVersion, bool) /builds/worker/checkouts/gecko/netwerk/protocol/http/Http2Session.cpp:108:15
[task 2022-02-16T14:00:13.358Z] 14:00:13     INFO - PID 1007 |     #10 0x7f97ee7c915b in mozilla::net::Http2Session::CreateSession(nsISocketTransport*, mozilla::net::SpdyVersion, bool) /builds/worker/checkouts/gecko/netwerk/protocol/http/Http2Session.cpp:103:11
[task 2022-02-16T14:00:13.358Z] 14:00:13     INFO - PID 1007 |     #11 0x7f97ee9c60bd in mozilla::net::nsHttpConnection::StartSpdy(nsISSLSocketControl*, mozilla::net::SpdyVersion) /builds/worker/checkouts/gecko/netwerk/protocol/http/nsHttpConnection.cpp:285:9
[task 2022-02-16T14:00:13.358Z] 14:00:13     INFO - PID 1007 |     #12 0x7f97ee9da0a8 in mozilla::net::nsHttpConnection::HandshakeDoneInternal() /builds/worker/checkouts/gecko/netwerk/protocol/http/nsHttpConnection.cpp:2657:9
[task 2022-02-16T14:00:13.358Z] 14:00:13     INFO - PID 1007 |     #13 0x7f97ee9fbf6f in operator() /builds/worker/checkouts/gecko/netwerk/protocol/http/nsHttpConnection.cpp:2561:17
[task 2022-02-16T14:00:13.358Z] 14:00:13     INFO - PID 1007 |     #14 0x7f97ee9fbf6f in mozilla::detail::RunnableFunction<mozilla::net::nsHttpConnection::HandshakeDone()::$_49>::Run() /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:531:5
[task 2022-02-16T14:00:13.359Z] 14:00:13     INFO - PID 1007 |     #15 0x7f97edc73fbf in nsThread::ProcessNextEvent(bool, bool*) /builds/worker/checkouts/gecko/xpcom/threads/nsThread.cpp:1189:16
[task 2022-02-16T14:00:13.359Z] 14:00:13     INFO - PID 1007 |     #16 0x7f97edc7e85c in NS_ProcessNextEvent(nsIThread*, bool) /builds/worker/checkouts/gecko/xpcom/threads/nsThreadUtils.cpp:467:10
[task 2022-02-16T14:00:13.359Z] 14:00:13     INFO - PID 1007 |     #17 0x7f97ee029681 in mozilla::net::nsSocketTransportService::Run() /builds/worker/checkouts/gecko/netwerk/base/nsSocketTransportService2.cpp:1190:11
[task 2022-02-16T14:00:13.359Z] 14:00:13     INFO - PID 1007 |     #18 0x7f97ee02b2dc in non-virtual thunk to mozilla::net::nsSocketTransportService::Run() /builds/worker/checkouts/gecko/netwerk/base/nsSocketTransportService2.cpp
[task 2022-02-16T14:00:13.359Z] 14:00:13     INFO - PID 1007 |     #19 0x7f97edc73fbf in nsThread::ProcessNextEvent(bool, bool*) /builds/worker/checkouts/gecko/xpcom/threads/nsThread.cpp:1189:16
[task 2022-02-16T14:00:13.359Z] 14:00:13     INFO - PID 1007 |     #20 0x7f97edc7e85c in NS_ProcessNextEvent(nsIThread*, bool) /builds/worker/checkouts/gecko/xpcom/threads/nsThreadUtils.cpp:467:10
[task 2022-02-16T14:00:13.359Z] 14:00:13     INFO - PID 1007 |     #21 0x7f97eee08708 in mozilla::ipc::MessagePumpForNonMainThreads::Run(base::MessagePump::Delegate*) /builds/worker/checkouts/gecko/ipc/glue/MessagePump.cpp:300:20
[task 2022-02-16T14:00:13.360Z] 14:00:13     INFO - PID 1007 |     #22 0x7f97eed1a561 in RunInternal /builds/worker/checkouts/gecko/ipc/chromium/src/base/message_loop.cc:331:10
[task 2022-02-16T14:00:13.360Z] 14:00:13     INFO - PID 1007 |     #23 0x7f97eed1a561 in RunHandler /builds/worker/checkouts/gecko/ipc/chromium/src/base/message_loop.cc:324:3
[task 2022-02-16T14:00:13.360Z] 14:00:13     INFO - PID 1007 |     #24 0x7f97eed1a561 in MessageLoop::Run() /builds/worker/checkouts/gecko/ipc/chromium/src/base/message_loop.cc:306:3
[task 2022-02-16T14:00:13.360Z] 14:00:13     INFO - PID 1007 |     #25 0x7f97edc6cd15 in nsThread::ThreadFunc(void*) /builds/worker/checkouts/gecko/xpcom/threads/nsThread.cpp:391:10
[task 2022-02-16T14:00:13.360Z] 14:00:13     INFO - PID 1007 |     #26 0x7f980edd8ade in _pt_root /builds/worker/checkouts/gecko/nsprpub/pr/src/pthreads/ptthread.c:201:5
[task 2022-02-16T14:00:13.360Z] 14:00:13     INFO - PID 1007 |     #27 0x7f9810ba76da in start_thread /tmp/glibc/nptl/pthread_create.c:463
[task 2022-02-16T14:00:13.360Z] 14:00:13     INFO - PID 1007 | -----------------------------------------------------
[task 2022-02-16T14:00:13.360Z] 14:00:13     INFO - PID 1007 | Suppressions used:
[task 2022-02-16T14:00:13.360Z] 14:00:13     INFO - PID 1007 |   count      bytes template
[task 2022-02-16T14:00:13.360Z] 14:00:13     INFO - PID 1007 |       9        280 nsComponentManagerImpl
[task 2022-02-16T14:00:13.360Z] 14:00:13     INFO - PID 1007 |     631      18073 libfontconfig.so
[task 2022-02-16T14:00:13.360Z] 14:00:13     INFO - PID 1007 |       2      16393 libglib-2.0.so
[task 2022-02-16T14:00:13.360Z] 14:00:13     INFO - PID 1007 |       1        192 mozJSComponentLoader
[task 2022-02-16T14:00:13.360Z] 14:00:13     INFO - PID 1007 |       2         48 XPCWrappedNativeJSOps
[task 2022-02-16T14:00:13.361Z] 14:00:13     INFO - PID 1007 | -----------------------------------------------------
[task 2022-02-16T14:00:13.361Z] 14:00:13     INFO - PID 1007 | 1645020012545	geckodriver::browser	DEBUG	Browser process stopped: exit status: 0
[task 2022-02-16T14:00:13.361Z] 14:00:13     INFO - PID 1007 | 1645020012546	webdriver::server	DEBUG	<- 200 OK {"value":null}
[task 2022-02-16T14:00:13.361Z] 14:00:13     INFO - PID 1007 | 1645020012596	webdriver::server	DEBUG	-> GET /status
[task 2022-02-16T14:00:13.361Z] 14:00:13     INFO - PID 1007 | 1645020012597	webdriver::server	DEBUG	<- 200 OK {"value":{"message":"","ready":true}}
[task 2022-02-16T14:00:13.362Z] 14:00:13     INFO - INFO | LeakSanitizer | SUMMARY: AddressSanitizer: 1952 byte(s) leaked in 61 allocation(s).
[task 2022-02-16T14:00:13.363Z] 14:00:13     INFO - LeakSanitizer | To show the addresses of leaked objects add report_objects=1 to LSAN_OPTIONS
[task 2022-02-16T14:00:13.363Z] 14:00:13     INFO - This can be done in testing/mozbase/mozrunner/mozrunner/utils.py
[task 2022-02-16T14:00:13.364Z] 14:00:13     INFO - Allowed depth was 4
[task 2022-02-16T14:00:13.364Z] 14:00:13     INFO - TEST-FAIL | LeakSanitizer | leak at mozilla::net::AddStaticElement, InitializeStaticHeaders, mozilla::net::nvFIFO::nvFIFO, mozilla::net::Http2BaseCompressor::Http2BaseCompressor
[task 2022-02-16T14:00:13.364Z] 14:00:13     INFO - INFO | LeakSanitizer | Frame mozilla::net::AddStaticElement matched a expected leak
[task 2022-02-16T14:00:13.365Z] 14:00:13     INFO - TEST-FAIL | LeakSanitizer | leak at mozilla::net::AddStaticElement, AddStaticElement, InitializeStaticHeaders, mozilla::net::nvFIFO::nvFIFO
[task 2022-02-16T14:00:13.365Z] 14:00:13     INFO - INFO | LeakSanitizer | Frame mozilla::net::AddStaticElement matched a expected leak
[task 2022-02-16T14:00:13.366Z] 14:00:13     INFO - Closing logging queue
[task 2022-02-16T14:00:13.366Z] 14:00:13     INFO - queue closed
[task 2022-02-16T14:00:13.367Z] 14:00:13     INFO - Starting runner
[task 2022-02-16T14:00:13.368Z] 14:00:13     INFO - PID 1398 | 1645020013282	geckodriver	INFO	Listening on 127.0.0.1:38240
[task 2022-02-16T14:00:13.641Z] 14:00:13     INFO - TEST-START | /webdriver/tests/bidi/session/new/connect.py

Reported after: webdriver/tests/accept_alert/accept.py

This leak looks to be network related. Valentin, is that already something known?

Flags: needinfo?(valentin.gosu)

That's interesting. So, the static header object should get cleared during shutdown via nsNetShutdown, but my best guess is that we're reinitializing it again after nsNetShutdown has been called, leading to the leak.
It's possible this was a regression from bug 1382886 which touched nsHttpConnection::HandshakeDone().
Dragana, do you want to take this?

Severity: S4 → S3
Component: geckodriver → Networking: HTTP
Flags: needinfo?(valentin.gosu) → needinfo?(dd.mozilla)
Priority: P5 → P2
Product: Testing → Core
Whiteboard: [necko-triaged]
Blocks: LSan

This is nearly perma failing on mozilla-beta for wdspec jobs (see bug 1753888). Do we have a timeline when this gets investigated? Thanks.

Assignee: nobody → dd.mozilla
Flags: needinfo?(dd.mozilla)

I am not sure what is happening.
Bug 1382886 added some safeguards against this:
In nsHttpConnection::Close() function:

  • mTlsHandshakeComplitionPending is set to false and
  • ssl->SetHandshakeCallbackListener(nullptr) is called that resets the handshakeDone listener
    Therefore HandshakeDone will not be called and if a shutdown happens in between HandshakeDone call and execution of the runnable the unable will do nothing because mTlsHandshakeComplitionPending is set to false.

This is all happening on the SockettThread so there are no race issues.

The only thing I could think of is that this does not return the same securityInfo. I will make a patch to try to see if I can mitigate this.
If this is an issue with securityInfo, my work on refactoring nsHttpConnection for proxies will make this easier to reason about.

In the last 7 days, there are 68 failures on mozilla-beta.
All the failures are on linux1804-64-asan-qr/opt

Flags: needinfo?(dd.mozilla)

:dragana has there been any progress on this?
Tomorrow we have the last beta build, before we carry these intermittent failures over to release next week

Pushed by ddamjanovic@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/3eb685b55c41 Make sure not to call HandshakeDone after Close() is calleed r=necko-reviewers,kershaw
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 100 Branch

:dragana could I get a beta approval request for this?

Comment on attachment 9269207 [details]
Make sure not to call HandshakeDone after Close() is calleed

Beta/Release Uplift Approval Request

  • User impact if declined: Currently, this is only happening in tests, but it is possible that it could happen during normal usage.
    We are finishing handshake after a connection was closed, what kind of impact this has is hard to say, the connection is for sure in a wrong state.
  • Is this code covered by automated tests?: Yes
  • Has the fix been verified in Nightly?: Yes
  • Needs manual test from QE?: No
  • If yes, steps to reproduce:
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): This adds just a simple check if a connection was closed.
  • String changes made/needed:
Flags: needinfo?(dd.mozilla)
Attachment #9269207 - Flags: approval-mozilla-beta?

Comment on attachment 9269207 [details]
Make sure not to call HandshakeDone after Close() is calleed

Approved for beta uplift, available on the beta channel with 99RC1. Thanks

Attachment #9269207 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
See Also: → 1762911
Regressions: 1762911
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: