[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor-launcher/master] Bug 34164: Tor Launcher deadlocks during startup (Firefox 77)
commit 98f3df12d48daf277f2e3f056600c64294c628c1
Author: Kathy Brade <brade@xxxxxxxxxxxxxxxxx>
Date: Wed May 13 10:45:01 2020 -0400
Bug 34164: Tor Launcher deadlocks during startup (Firefox 77)
Initialize the DNS service as early as possible to avoid a problem
where DNS service initialization is dispatched to the main thread
while that thread is blocked.
---
src/components/tl-process.js | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/src/components/tl-process.js b/src/components/tl-process.js
index 31f6801..e9d7cde 100644
--- a/src/components/tl-process.js
+++ b/src/components/tl-process.js
@@ -100,6 +100,22 @@ TorProcessService.prototype =
if ("profile-after-change" == aTopic)
{
+ // Initialize the DNS service here (as early as possible). This
+ // avoids a deadlock that can occur inside TorProtocolService's
+ // _openAuthenticatedConnection() function. What happens in the
+ // deadlock case is that a Necko socket thread tries to dispatch
+ // initialization of the DNS service to the main thread while the
+ // main thread is blocked in a writeBytes() call inside the
+ // _sendCommand() function. The ultimate solution is to change
+ // our control port socket to use asynchronous I/O.
+ // References:
+ // netwerk/dns/nsDNSService2.cpp nsDNSService::GetSingleton()
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=1625151 (the
+ // fix for this bug introduced the deadlock because it changed
+ // DNS service initialization to occur on the main thread).
+ const dns = Cc["@mozilla.org/network/dns-service;1"]
+ .getService(Ci.nsIDNSService);
+
this.mObsSvc.addObserver(this, "quit-application-granted", false);
this.mObsSvc.addObserver(this, kOpenNetworkSettingsTopic, false);
this.mObsSvc.addObserver(this, kUserQuitTopic, false);
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits