From mboxrd@z Thu Jan 1 00:00:00 1970 From: iyzsong@member.fsf.org (=?utf-8?B?5a6L5paH5q2m?=) Subject: Re: [WIP][PATCH] download: Don't report the progress too fast Date: Thu, 14 Sep 2017 22:20:10 +0800 Message-ID: <87d16ticpx.fsf@member.fsf.org> References: <87d17ilhzq.fsf@member.fsf.org> <87shg978ao.fsf@gnu.org> <87mv652phq.fsf@member.fsf.org> <877ex6456z.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:34782) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dsV0G-0001BX-V2 for guix-devel@gnu.org; Thu, 14 Sep 2017 10:20:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dsV0E-0003iR-LN for guix-devel@gnu.org; Thu, 14 Sep 2017 10:20:27 -0400 In-Reply-To: <877ex6456z.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Sun, 10 Sep 2017 23:25:08 +0200") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Ludovic =?utf-8?Q?Court=C3=A8s?= Cc: guix-devel@gnu.org ludo@gnu.org (Ludovic Court=C3=A8s) writes: > [...] >> Date: Fri, 8 Sep 2017 22:49:03 +0800 >> Subject: [PATCH] download: Report the progress asynchronously in another >> thread. >> >> * guix/utils.scm (): New record type. >> (call-with-progress-reporter): New procedure. >> * guix/build/download.scm (dump-port*, progress-reporter/file): New >> procedures. >> (ftp-fetch, http-fetch): Use them. >> (progress-proc): Remove procedure. >> * guix/scripts/substitute.scm (progress-report-port): Rewrite in terms of >> . >> (process-substitution): Adjust accordingly. > > Impressive! > > I have a couple of concerns though: > > 1. Using a thread =E2=80=9Cjust=E2=80=9D for progress reporting seems q= uite > heavyweight, though maybe that=E2=80=99s OK. Yes.. > > 2. As per POSIX, we cannot mix =E2=80=98fork=E2=80=99 and threads, so p= rograms that > use =E2=80=98primitive-fork=E2=80=99 should not also use threads. O= ne such program > is (guix scripts substitute), via =E2=80=98decompressed-port=E2=80= =99. Guile > rightfully emits a warning when a multithreaded program calls > =E2=80=98primitive-fork=E2=80=99: > > https://git.savannah.gnu.org/cgit/guile.git/tree/libguile/posix.c#= n1224 Oh, thanks for pointing it out! > > 3. =E2=80=9CAtomic boxes=E2=80=9D are a Guile 2.2 feature, but we stil= l support 2.0. > > To address these, I would use =E2=80=98abort-to-prompt=E2=80=99 & co., po= ssibly with > =E2=80=9Csuspendable ports=E2=80=9D, but this is a 2.2 feature. (It may = be that we > should use Fibers directly.) Sure, I=E2=80=99d like to try fibers. When we can drop the support of Guile 2.0? (I guess one sign is that 2.2 is in the debian stable.) > > Tricky! Not sure what to do here. > > Thoughts? How about replace the use of thread from =E2=80=98progress-reporter/file=E2= =80=99 by a =E2=80=98rate-limited=E2=80=99 render procedure, and then change the elapse= d time to ETA, which is okay without updating in seconds?