git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[Proposed Fix] daemon.c: not initializing revents

From
Randall S. Becker <rsbecker@nexbridge.com>
Date
Feb 9, 2019, 19:56 UTC
Message-ID
<000a01d4c0b1$9ef9ea70$dcedbf50$@nexbridge.com>
In-Reply-To
<000901d4c0b1$1ea15160$5be3f420$@nexbridge.com>
Hi All,

I found this while trying to track down a hang in t5562 - this isn't the fix, but here it is something that could be considered a code-inspection. If there have been random unexplained hangs when git runs as a daemon, this might be the cause.

According to many systems (other than Linux), the revents field is supposed to be 0 on return to poll(). This was the cause of some heart-ache a while back in compat/poll/poll.c. I am not certain whether that copy of poll() is used in daemon, but I wanted to point out that the value is being returned to poll, outside of compat/poll/poll.c and may present a potential for poll returning an error on that FD due to random values that might be in revents.

Please see 61b2a1acaae for a related change/justification.
diff --git a/daemon.c b/daemon.c
index 9d2e0d20ef..1e275fc8b3 100644
--- a/daemon.c
+++ b/daemon.c
@@ -1194,6 +1194,7 @@ static int service_loop(struct socketlist *socklist)
                                }
                                handle(incoming, &ss.sa, sslen);
                        }
+                       pfd[i].revents = 0;
                }
        }
 }

Regards,
Randall
Next: Junio C Hamano
Message 1 of 5 in “[Proposed Fix] daemon.c: not initializing revents”
  1. Randall S. BeckerFeb 9, 2019
  2. Junio C HamanoFeb 11, 2019
  3. Randall S. BeckerFeb 11, 2019
  4. Junio C HamanoFeb 12, 2019
  5. Randall S. BeckerFeb 12, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.