From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-3.2 required=3.0 tests=AWL,BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by dcvr.yhbt.net (Postfix) with ESMTP id D564D1F404 for ; Wed, 18 Apr 2018 21:49:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752245AbeDRVtR (ORCPT ); Wed, 18 Apr 2018 17:49:17 -0400 Received: from mout.gmx.net ([212.227.17.22]:37139 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750981AbeDRVtQ (ORCPT ); Wed, 18 Apr 2018 17:49:16 -0400 Received: from [192.168.0.129] ([37.201.195.116]) by mail.gmx.com (mrgmx103 [212.227.17.168]) with ESMTPSA (Nemesis) id 0Le69A-1ef1Bp2bwi-00pwBM; Wed, 18 Apr 2018 23:48:53 +0200 Date: Wed, 18 Apr 2018 23:48:22 +0200 (DST) From: Johannes Schindelin X-X-Sender: virtualbox@MININT-6BKU6QN.europe.corp.microsoft.com To: Kim Gybels cc: git@vger.kernel.org, Junio C Hamano , Jeff King , Oleg Gubanov Subject: Re: [PATCH 2/2] daemon: graceful shutdown of client connection In-Reply-To: <20180415202122.GA4657@infogroep.be> Message-ID: References: <20180412210757.7792-1-kgybels@infogroep.be> <20180412210757.7792-3-kgybels@infogroep.be> <20180415202122.GA4657@infogroep.be> User-Agent: Alpine 2.21.1 (DEB 209 2017-03-23) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Provags-ID: V03:K1:0YmH18h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TtNQ4KakFH6hv47o7kpsykWzBu7FcmPGhdalW2Uutv44O648= Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Hi Kim, On Sun, 15 Apr 2018, Kim Gybels wrote: > On (13/04/18 15:03), Johannes Schindelin wrote: > > I wonder whether you found a reliable way to trigger this? It would be > > nice to have a regression test for this. > > On my system, it reproduced reliably using Oleg's example [1], below is > my bash version of it. Okay. > Script to generate repository with some history: > > $ cat example.sh > #!/bin/bash > > git init example > cd example > > git --help > foo.txt > > for i in $(seq 1 12); do > cat foo.txt foo.txt > bar.txt > mv bar.txt foo.txt > git add foo.txt > git commit -m v$i > done Okay, so this sets up a minimal repository with a moderate size, inflating foo.txt from the initial Git help text by factor 2**12 = 4096. The help text is around 2kB, so we end up with an ~8MB large file in the end that grew exponentially. > $ ./example.sh > Initialized empty Git repository in C:/git/bug/example/.git/ > [master (root-commit) 2e44b4a] v1 > 1 file changed, 84 insertions(+) > create mode 100644 foo.txt > [master 9791332] v2 > 1 file changed, 84 insertions(+) > [master 524e672] v3 > 1 file changed, 168 insertions(+) > [master afec6ef] v4 > 1 file changed, 336 insertions(+) > [master 1bcd9cc] v5 > 1 file changed, 672 insertions(+) > [master 2f38a8e] v6 > 1 file changed, 1344 insertions(+) > [master 33382fe] v7 > 1 file changed, 2688 insertions(+) > [master 6c2cbd6] v8 > 1 file changed, 5376 insertions(+) > [master 8d0770f] v9 > 1 file changed, 10752 insertions(+) > [master 517d650] v10 > 1 file changed, 21504 insertions(+) > [master 9e12406] v11 > 1 file changed, 43008 insertions(+) > [master 4c4f600] v12 > 1 file changed, 86016 insertions(+) > > Server side: > > $ git daemon --verbose --reuseaddr --base-path=$(pwd) --export-all > [4760] Ready to rumble > [696] Connection from 127.0.0.1:2054 > [696] unable to set SO_KEEPALIVE on socket: No such file or directory > [696] Extended attribute "host": 127.0.0.1 > [696] Request upload-pack for '/example' I guess apart from the generated repo size (which would make this an expensive test in and of itself), the fact that we have to run the daemon (and that lib-git-daemon.sh requires the PIPE prerequisite which we disabled on Windows) makes it hard to turn this into a regular regression test in t/. Although we *could* of course introduce a test that does not use lib-git-daemon.sh and is hidden behind the EXPENSIVE prerequisite or some such. BTW I just tested this, and it indeed fixes the problem, so I am eager to ship it to the Git for Windows users. Let's see whether we can convince Junio that your quite small and easy-to-review patches are not too much of a maintenance burden, and the fact that they fix a long-standing bug should help. BTW I had to apply this to build with DEVELOPER=1: diff --git a/daemon.c b/daemon.c index 97fadd62d10..1cc901e9739 100644 --- a/daemon.c +++ b/daemon.c @@ -1162,13 +1162,13 @@ static int service_loop(struct socketlist *socklist) signal(SIGCHLD, child_handler); for (;;) { - int i; + int i, ret; check_dead_children(); #ifdef NO_POLL poll_timeout = live_children ? 100 : -1; #endif - int ret = poll(pfd, socklist->nr, poll_timeout); + ret = poll(pfd, socklist->nr, poll_timeout); if (ret == 0) { continue; } else if (ret < 0) { Would you mind squashing that in? Thanks, Dscho