Mike,

Am 12.05.2018 um 21:45 schrieb Mike Gabriel:
> Would you be willing to propose the above upstream?
> https://github.com/tinyproxy/tinyproxy
> 
> Help with approaching upstream with above analysis will be highly welcome.
> 
> If you are not available for this, please let me know, and I will
> forward the necessary info.
> 

I already moved my set-up to another forward proxy, thus *personally* I
am not in a need for a bugfix. I created this bug to help other users
going forward.

I'd prefer if you'd handled the main communication with upstream. If you
link an upstream bug report here I'm going to subscribe and chime in if
absolutely necessary.

I have attached a proof of concept patch for the select(2) issue, which
properly reset the rfds array (and for some reason I don't understand
also fixes the accept(2) race condition). After applying the patch to
tinyproxy 1.8.4-2 (Debian Stretch) I was no longer able to reproduce the
issue.

This patch is CC-0 licensed, feel free to forward all or parts of my
initial bug report or this patch to upstream.

Best regards
Tim Düsterhus
Index: tinyproxy-1.8.4/src/child.c
===================================================================
--- tinyproxy-1.8.4.orig/src/child.c
+++ tinyproxy-1.8.4/src/child.c
@@ -202,6 +202,7 @@ static void child_main (struct child_s *
         ptr->connects = 0;
         srand(time(NULL));
 
+        while (!config.quit) {
         /*
          * We have to wait for connections on multiple fds,
          * so use select.
@@ -224,7 +225,6 @@ static void child_main (struct child_s *
                 maxfd = max(maxfd, *fd);
         }
 
-        while (!config.quit) {
                 int listenfd = -1;
 
                 ptr->status = T_WAITING;

Reply via email to