Ticket #25600: 0001-Log-to-io.Discard-if-no-log-file-is-set.patch

File 0001-Log-to-io.Discard-if-no-log-file-is-set.patch, 1.0 KB (added by dcf, 16 months ago)
  • client/snowflake.go

    From 6077141f4affdab9b7ce97a9b1c6859825eaaa29 Mon Sep 17 00:00:00 2001
    From: David Fifield <david@bamsoftware.com>
    Date: Sun, 10 Jun 2018 16:41:32 -0700
    Subject: [PATCH] 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 b func main() { 
    150150                }
    151151                defer logFile.Close()
    152152                log.SetOutput(logFile)
     153        } else {
     154                log.SetOutput(ioutil.Discard)
    153155        }
    154156
    155157        log.Println("\n\n\n --- Starting Snowflake Client ---")