#858 Disabling Privoxy via right-click on tasktray icon hangs Pri

version 3.0.19
closed-fixed
Fabian Keil
5
2012-05-27
2012-05-11
Tim H
No

Privoxy very occasionally fatally hangs when it is disabled via right-clicking on the tasktray icon and unchecking "Enable".
CPU time drops to zero and there is no further response to right-clicks. Any communication in progress is interrupted. The only resolution is to kill the process.

I've had this happen twice since I upgraded to 3.0.19 on 2012-04-03. I disable/enable Privoxy frequently as my filters intentionally strip features of some sites that I occasionally need to re-enable. There is no information in the Privoxy log or system event log. I use both Chrome and Seamonkey as browsers and both were in use at the time of the failure. I also had several tabs open in each browser so I don't know which site was actually being accessed at the time. Killing the process appears to keep the final log entries from being flushed to the disk since the last entry in the Privoxy log is from over 10 minutes prior to the hang.

Sorry I can't give any more information. Is there something you'd like me to do if it happens again? Would you like me to upload my config & user files?

Privoxy version 3.0.19
Windows XP Pro SP3
External router and switch in use
Avast anti-virus

Discussion

  • Tim H
    Tim H
    2012-05-11

    • summary: Disabling Privoxy via right-click on tasktray icon hangs --> Disabling Privoxy via right-click on tasktray icon hangs Pri
     
  • Tim H
    Tim H
    2012-05-11

    I also have a background process that runs every 3 minutes (to issue an audio warning if Privoxy is disabled) and executes these commands (and more) in a Cygwin Bash script:

    http_proxy=http://127.0.0.1:8118
    wget --proxy -q -O - http://config.privoxy.org/ | ...

     
  • Fabian Keil
    Fabian Keil
    2012-05-11

    • status: open --> pending
     
  • Fabian Keil
    Fabian Keil
    2012-05-11

    Thanks for the report.

    If you have logging enabled, toggling Privoxy off through the taskbar is supposed to result in a "Now toggled OFF" log message.

    Do you never get those, or just not when Privoxy is hanging?

    It seems unlikely to me that log messages from 10 minutes ago would be lost on exit. A more likely explanation would be that there simply are no log messages (either because there was no log-worthy event, or because the problem affects logging as well).

    Is the GUI log not generally in sync with the logfile on disk?

    Can you reproduce the problem by running wget in a loop to toggle Privoxy on and off through the remote toggle?
    http://config.privoxy.org/user-manual/config.html#ENABLE-REMOTE-TOGGLE
    This would rule out a bug in Privoxy's Windows-specific code.

    While I expect this to be a bug in the Windows-specific code, it would still be good to rule out a platform-independent bug which would be a lot easier to debug.

     
  • Fabian Keil
    Fabian Keil
    2012-05-18

    • labels: --> windows-specific
     
  • Fabian Keil
    Fabian Keil
    2012-05-18

    https://skydrive.live.com/ doesn't work with my browser configuration so I wasn't able to access the config files or the script used to reproduce the problem.

    Anyway, it would be useful to know if you can still reproduce the problem after setting "activity-animation 0".

    If you can't, this could indicate a race condition that should be fixable without requiring a deeper understanding of the win32 API.

     
  • Tim H
    Tim H
    2012-05-23

    '...can still reproduce the problem after setting "activity-animation 0".'

    Yes, I can still reproduce it by right-clicking the tray icon and toggling the enable state. It typically takes less than 20 right-clicks for it to happen on my system. Note that a right-click forces the icon to update even with activity animation off. Also note that the HTTP toggle request does not get an "Info: Now toggled xxx." log entry while the right-click toggle does (if that helps).

    I've sent a new link to the files by email. This link is only valid until 2012-06-05.

     
  • Tim H
    Tim H
    2012-05-23

    • status: pending --> open
     
  • Lee
    Lee
    2012-05-25

    Have you tried not having the wget background process running every 3 minutes?

    I can't duplicate your problem on Vista .. tried toggling it off & on manually more than 20 times and no problem. Ran this script using cygwin
    -------- begin ----------
    #!/bin/sh
    while [ "1" == "1" ]; do
    curl -q --proxy 127.0.0.1:8118 --referer http://config.privoxy.org/toggle --silent \ http://config.privoxy.org/toggle?set=disable > /dev/null
    curl -q --proxy 127.0.0.1:8118 --referer http://config.privoxy.org/toggle --silent \ http://config.privoxy.org/toggle?set=enable > /dev/null
    done
    ------ end --------

    while browsing yahoo.com - still no problem.

    Here's the config I used for testing:

    The following options were given in the config file:

    user-manual ./doc/user-manual/
    forward / .
    forward 10.*.*.*/ .
    forward 127.*.*.*/ .
    forward 192.168.*.*/ .
    confdir .
    logdir c:\temp
    actionsfile match-all.action
    actionsfile default.action
    actionsfile user.action
    actionsfile blocksites.action
    actionsfile malwareSites.action
    actionsfile spw.action
    actionsfile winhelp.action
    actionsfile unblock.action
    filterfile default.filter
    filterfile user.filter
    logfile privoxy.log
    debug 1
    debug 1024
    debug 4096
    debug 8192
    listen-address 127.0.0.1:8118
    toggle 1
    enable-remote-toggle 1
    enable-remote-http-toggle 0
    enable-edit-actions 1
    enforce-blocks 0
    buffer-limit 4096
    forwarded-connect-retries 0
    accept-intercepted-requests 0
    allow-cgi-request-crunching 0
    split-large-forms 0
    keep-alive-timeout 600
    default-server-timeout 300
    connection-sharing 0
    socket-timeout 300
    max-client-connections 256
    handle-as-empty-doc-returns-ok 1
    log-max-lines 1000
    log-font-name Courier New
    log-font-size 9

    Regards,
    Lee

     
  • Fabian Keil
    Fabian Keil
    2012-05-25

    The other link doesn't work with my browser configuration either.

    The HTTP toggle isn't supposed to emit the log message, so the behavior is expected. This inconsistency should probably be fixed one way or the other, but given that the message from the tray toggle gets logged, it's probably unrelated to the hangs.

    I'll attach a patch that might help. Can anyone test it?

     
  • Fabian Keil
    Fabian Keil
    2012-05-25

    • status: open --> pending
     
  • Lee
    Lee
    2012-05-25

    Seems to me that the purpose of a log file is to allow one to reconstruct what happened - so I added code to log when toggled via the web page. It's not what I'd call "production ready" since it also emits a log msg when the toggle sttus page is opened..

    2012-05-24 22:36:20.665 000009c0 Crunch: CGI Call: http://p.p/
    2012-05-24 22:36:20.727 0000049c Crunch: CGI Call: http://config.privoxy.org/send-stylesheet
    2012-05-24 22:36:25.126 00000f74 Info: Now toggled ON.
    2012-05-24 22:36:25.126 00000f74 Crunch: CGI Call: http://config.privoxy.org/toggle
    2012-05-24 22:36:25.158 00000134 Crunch: CGI Call: http://config.privoxy.org/send-stylesheet
    2012-05-24 22:36:27.903 00000e78 Info: Now toggled OFF.
    2012-05-24 22:36:27.919 00000e78 Crunch: CGI Call: http://config.privoxy.org/toggle?set=disable
    2012-05-24 22:36:27.966 00000d20 Crunch: CGI Call: http://config.privoxy.org/send-stylesheet

    want me to try to fix that & submit a patch?

    I can't duplicate the problem of privoxy freezing. So while I can test the patch to see if Anyting Bad Happens, I'm not going to be able to tell if it fixes the hang issue.

    Lee

     
  • Fabian Keil
    Fabian Keil
    2012-05-26

    I have no strong opinions about whether or not toggling gets logged, as long as the behavior is consistent.

    I don't think duplicating the log message is the answer, though. I believe the global_toggle_state modification should be factored out into a separate function, that also takes care of the logging (or not) and the tray icon fiddling.

    Currently we mess with global_toggle_state in three separate files, but only in w32log.c the tray icon is explicitly set.

    In the other cases we seem to rely on the tray icon being set to the idle icon after the next tray icon animation is finished. Given that the tray icon animation can be deactivated, that doesn't seem like a sound strategy to me.

    A patch would be welcome, of course.

    If you could test whether or not my patch obviously makes things worse, I'd appreciate it even if the problem doesn't manifest on your system.

    I'd also be interested to know if the following patch causes hangs when multiple threads are active at the same time. If SetIdleIcon() isn't thread-safe, calling it more often should increase the chances of triggering the problem:

    diff --git a/w32log.c b/w32log.c
    index 4211a87..188fe6b 100644
    --- a/w32log.c
    +++ b/w32log.c
    @@ -550,6 +550,14 @@ int LogPutStringNoMatch(const char *pszText, int style)
    *********************************************************************/
    void LogShowActivity(void)
    {
    + int i;
    +
    + /* Try to figure out if SetIdleIcon() is thread-safe */
    + for (i = 0; i < 1000; i++)
    + {
    + SetIdleIcon();
    + }
    +
    /* Start some activity timers */
    if (g_bShowActivityAnimation)
    {

     
  • Lee
    Lee
    2012-05-26

    process explorer screenshot

     
  • Lee
    Lee
    2012-05-26

    notes on conditions & how to recreate

     
    Attachments
  • Lee
    Lee
    2012-05-26

    > If you could test whether or not my patch obviously makes things worse

    It seems like the icon stays the blue background/white P a bit more than without the patch, but not much & it might be a perception thing since I'm looking.for differences. But either ay - no problems.

    After adding your
    for (i = 0; i < 1000; i++)
    patch I was able to get privoxy to hang. See attached privoxy_hang.log

    Lee

     
  • Fabian Keil
    Fabian Keil
    2012-05-27

    • assigned_to: nobody --> fabiankeil
    • milestone: --> version 3.0.19
    • status: pending --> closed-fixed
     
  • Fabian Keil
    Fabian Keil
    2012-05-27

    Thanks for testing the patches, Lee.

    I committed a slightly reworded version of the patch to use TIMER_ANIMSTOP_ID instead of setting the tray icon directly.

    Hopefully this fixes the problem, otherwise the request can be reopened.

    I added the global_toggle_state refactoring to the TODO list as #104.