[tor-commits] [snowflake/master] Log to io.Discard if no log file is set.

dcf at torproject.org dcf at torproject.org
Tue Jun 12 20:14:45 UTC 2018


commit 6077141f4affdab9b7ce97a9b1c6859825eaaa29
Author: David Fifield <david at bamsoftware.com>
Date:   Sun Jun 10 16:41:32 2018 -0700

    Log to io.Discard if no log file is set.
    
    https://bugs.torproject.org/25600#comment:14
    
    Snowflake in Tor Browser has been hanging after surfing for a while.
    (Tor reports "no running bridges".) It only began happening after commit
    12922a232b, which caused snowflake-client not to log to a file by
    default (leaving it to log to its default stderr). What seems to be
    happening is that tor doesn't read from its PT clients' stderr, leaving
    a buffer to fill up that eventually causes a hang.
---
 client/snowflake.go | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/client/snowflake.go b/client/snowflake.go
index e0f9746..a9841be 100644
--- a/client/snowflake.go
+++ b/client/snowflake.go
@@ -150,6 +150,8 @@ func main() {
 		}
 		defer logFile.Close()
 		log.SetOutput(logFile)
+	} else {
+		log.SetOutput(ioutil.Discard)
 	}
 
 	log.Println("\n\n\n --- Starting Snowflake Client ---")



More information about the tor-commits mailing list