[prev in list] [next in list] [prev in thread] [next in thread] 

List:       sbcl-devel
Subject:    Re: [Sbcl-devel] [PATCH] win32: make pipes larger
From:       Stas Boukarev <stassats () gmail ! com>
Date:       2020-07-16 14:42:22
Message-ID: CAF63=13Lort9s55LC7Z=6Jg2B+797wg8r8poNetZptc-4p+7Hg () mail ! gmail ! com
[Download RAW message or body]

Applied.

On Thu, Jul 16, 2020 at 2:29 PM Luís Oliveira <luismbo@gmail.com> wrote:
>
> When SB-EXT:RUN-PROGRAM is asked to return streams for stdin and/or
> stdout, it creates pipes with a very small 256-byte buffer.  The
> smaller the buffer, the easier it becomes to enter deadlock,
> particularly because FORCE-OUTPUT blocks when flushing the stream
> buffer onto the pipe.
>
> An example of how things might go wrong:
>
> (let* ((process (sb-ext:run-program "program" nil
>                                     :input :stream
>                                     :output :stream
>                                     :wait nil))
>        (stdin (sb-ext:process-input process)))
>   ;;
>   ;; program writes out a startup banner larger than 256 bytes and blocks
>   ;;
>   (write-line "<a command larger than 256 bytes>" stdin)
>   (force-output stdin)) ; blocks writing to the pipe, leading to deadlock
>
> On the one hand, this might be considered a feature, an early warning
> of sorts, that forces users to set up a more robust scheme such as
> reading and writing from different threads. On the other hand, why
> should Windows be the sole beneficiary of such a feature?
>
> This patch changes SB-WIN32::WINDOWS-PIPE to use the system's default
> pipe size, usually 4 KB.
>
> Cheers,
>
> --
> Luís Oliveira
> http://kerno.org/~luis/
> _______________________________________________
> Sbcl-devel mailing list
> Sbcl-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sbcl-devel


_______________________________________________
Sbcl-devel mailing list
Sbcl-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sbcl-devel

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic