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

Re: [PATCH] mingw: workaround for hangs when sending STDIN

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Feb 13, 2020, 18:56 UTC
Message-ID
<CAPig+cQrxKuE=a99zPF7EGUSbye_s5ATEvUkz+EqsTZAfy_CbQ@mail.gmail.com>
In-Reply-To
<pull.553.git.1581619239467.gitgitgadget@gmail.com>

On Thu, Feb 13, 2020 at 1:40 PM Alexandr Miloslavskiy via GitGitGadget <gitgitgadget@gmail.com> wrote:

Show 8 quoted lines
> 3) Make `poll()` always reply "writable" for write end of the pipe
>    Afterall it seems that cygwin (accidentally?) does that for years.
>    Also, it should be noted that `pump_io_round()` writes 8MB blocks,
>    completely ignoring the fact that pipe's buffer size is only 8KB,
>    which means that pipe gets clogged many times during that single
>    write. This may invite a deadlock, if child's STDERR/STDOUT gets
>    clogged while it's trying to deal with 8MB of STDIN. Such deadlocks
>    could  be defeated with writing less then pipe's buffer size per
s/then/than/
Show 7 quoted lines
>    round, and always reading everything from STDOUT/STDERR before
>    starting next round. Therefore, making `poll()` always reply
>    "writable" shouldn't cause any new issues or block any future
>    solutions.
> 4) Increase the size of the pipe's buffer
>    The difference between `BytesInQueue` and `QuotaUsed` is the size
>    of pending reads. Therefore, if buffer is bigger then size of reads,
s/then/than/
Show 8 quoted lines
>    `poll()` won't hang so easily. However, I found that for example
>    `strbuf_read()` will get more and more hungry as it reads large inputs,
>    eventually surpassing any reasonable pipe buffer size.
> diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh
> +test_expect_success 'stash handles large files' '
> +       printf "%1023s\n%.0s" "x" {1..16384} >large_file.txt &&
> +       git stash push --include-untracked -- large_file.txt
> +'

Use of {1..16384} is not portable across shells. You should be able to achieve something similar by assigning a really large value to a shell variable and then echoing that value to "large_file.txt". Something like:

    x=0123456789
    x=$x$x$x$x$x$x$x$x$x$x
    x=$x$x$x$x$x$x$x$x$x$x
    ...and so on...
    echo $x >large_file.txt &&
or any other similar construct.
Previous: Alexandr MiloslavskiyNext: Alexandr Miloslavskiy
Message 3 of 12 in “mingw: workaround for hangs when sending STDIN”
  1. mingw: workaround for hangs when sending STDINAlexandr Miloslavskiy via GitGitGadget, Feb 13, 2020
  2. Test program used to prove quota's behaviorAlexandr Miloslavskiy, Feb 13, 2020
  3. Eric SunshineFeb 13, 2020
  4. Alexandr MiloslavskiyFeb 13, 2020
  5. mingw: workaround for hangs when sending STDINAlexandr Miloslavskiy via GitGitGadget, Feb 17, 2020
  6. Eric SunshineFeb 17, 2020
  7. Junio C HamanoFeb 17, 2020
  8. Alexandr MiloslavskiyFeb 17, 2020
  9. mingw: workaround for hangs when sending STDINAlexandr Miloslavskiy via GitGitGadget, Feb 17, 2020
  10. Junio C HamanoFeb 18, 2020
  11. Johannes SchindelinFeb 27, 2020
  12. Junio C HamanoFeb 27, 2020

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.