From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alexey Abramov Newsgroups: gmane.lisp.guile.user Subject: 8sync error in procedure select Date: Mon, 03 May 2021 17:57:46 +0200 Message-ID: <87zgxbn72d.fsf@delta.lan> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22606"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) To: guile-user Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Mon May 03 17:58:53 2021 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ldayD-0005lS-7Q for guile-user@m.gmane-mx.org; Mon, 03 May 2021 17:58:53 +0200 Original-Received: from localhost ([::1]:55090 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ldayC-0000r2-CA for guile-user@m.gmane-mx.org; Mon, 03 May 2021 11:58:52 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56804) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ldaxy-0000qt-Qm for guile-user@gnu.org; Mon, 03 May 2021 11:58:38 -0400 Original-Received: from mail.mmer.org ([178.22.65.174]:57940) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ldaxx-00035I-1R for guile-user@gnu.org; Mon, 03 May 2021 11:58:38 -0400 Original-Received: from mail.mmer.org (localhost [127.0.0.1]) by mail.mmer.org (OpenSMTPD) with ESMTP id c0ae90f0 for ; Mon, 3 May 2021 15:58:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=mmer.org; h=from:to :subject:date:message-id:mime-version:content-type; s=dkim; bh=+ TOiXolvR2x5iPt2N2bBHWifr0+nfhgtenhgCHQKLqM=; b=V5Y/f4TEGcwNspClR pJ1dEvO7spgsFxngBVBXF3hwgTMLsxF6rlpQTo6UreJhbGDHotGDPgs/XsZBIR3V sY/eZ6A2VSiBjCo59hbVZ1Fc0DhaUEMMYzATXg09kQfAMw1wl0f4SBygoibja17R /e5xG+Bl2n2x8VWyFIU2ZqET/I= Original-Received: from delta.lan (j74182.upc-j.chello.nl [24.132.74.182]) by mail.mmer.org (OpenSMTPD) with ESMTPSA id 43d58373 (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO) for ; Mon, 3 May 2021 15:58:27 +0000 (UTC) Received-SPF: pass client-ip=178.22.65.174; envelope-from=levenson@mmer.org; helo=mail.mmer.org X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.io gmane.lisp.guile.user:17507 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi, I am trying to test an actor I wrote with 8sync. I created a probe actor which sends messages to the main one. A problem I am having is that when I want to send a *cleanup* to the main (server) actor from the probe, I am getting the following backtrace: --8<---------------cut here---------------start------------->8--- =CE=BB guile --debug -s tests/test.scm Backtrace: In ice-9/boot-9.scm: 1736:10 11 (with-exception-handler _ _ #:unwind? _ # _) In unknown file: 10 (apply-smob/0 #) In ice-9/boot-9.scm: 718:2 9 (call-with-prompt _ _ #) In ice-9/eval.scm: 619:8 8 (_ #(#(#))) In ice-9/boot-9.scm: 2806:4 7 (save-module-excursion _) 4351:12 6 (_) In 8sync/actors.scm: 812:6 5 (run-hive #< 7fac08bdd0c0> _ #:cleanup _ # _) In ice-9/control.scm: 91:24 4 (call-with-escape-continuation _) In 8sync/agenda.scm: 569:6 3 (run-agenda #< queue: (() . #f) prompt-tag: ("=E2=80= =A6> =E2=80=A6) 470:7 2 (update-agenda-from-select! #< queue: (() . #f)=E2=80= =A6>) In ice-9/boot-9.scm: 1731:15 1 (with-exception-handler # =E2=80=A6) In unknown file: 0 (select (#) () () #f #f) ERROR: In procedure select: In procedure select: Wrong type argument in position 1: # --8<---------------cut here---------------end--------------->8--- I have attached a simple snippet to reproduce the problem, and also a naive patch I did. I am not sure if it is me doing the shutdown wrong, or it's a bug. --=20 Alexey --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-agenda-Honor-closed-ports.patch >From 020cdb7f7915876ff808b37430846a26dfab702b Mon Sep 17 00:00:00 2001 From: Alexey Abramov Date: Mon, 3 May 2021 16:53:04 +0200 Subject: [PATCH] agenda: Honor closed ports * 8sync/agenda.scm (update-agenda-from-select!)[ports-to-select?]: Cleanup ports which have been closed, before monitoring them with select. --- 8sync/agenda.scm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/8sync/agenda.scm b/8sync/agenda.scm index e91487e..6b851a8 100644 --- a/8sync/agenda.scm +++ b/8sync/agenda.scm @@ -514,6 +514,13 @@ Also handles sleeping when all we have to do is wait on the schedule." (not (= (hash-count (const #t) (selector agenda)) 0))) + (define (drop-closed-ports! table) + (for-each (lambda (port) + (when (port-closed? port) + (hash-remove! table port))) + (hash-keys table))) + (drop-closed-ports! (agenda-write-port-map agenda)) + (drop-closed-ports! (agenda-read-port-map agenda)) (or (has-items? agenda-read-port-map) (has-items? agenda-write-port-map))) -- 2.31.1 --=-=-= Content-Type: application/octet-stream Content-Disposition: attachment; filename=test.scm Content-Transfer-Encoding: base64 Ozs7IAoKKHVzZS1tb2R1bGVzIChvb3AgZ29vcHMpCiAgICAgICAgICAgICAoaWNlLTkgbWF0Y2gp CiAgICAgICAgICAgICAoOHN5bmMgYWN0b3JzKQogICAgICAgICAgICAgKDhzeW5jIHBvcnRzKQog ICAgICAgICAgICAgKDhzeW5jIHJlcGwpKQoKKGRlZmluZSAobWFrZS1zZXJ2ZXItc29ja2V0KQog IChsZXQgKChzIChzb2NrZXQgUEZfSU5FVCBTT0NLX1NUUkVBTSAwKSkpCiAgICAoc2V0c29ja29w dCBzIFNPTF9TT0NLRVQgU09fUkVVU0VBRERSIDEpCiAgICAoYmluZCBzIEFGX0lORVQgSU5BRERS X0xPT1BCQUNLIDQ1NDUpCiAgICAoc2V0LXBvcnQtbm9uYmxvY2tpbmchIHMpCiAgICBzKSkKCihk ZWZpbmUtYWN0b3IgPHNlcnZlcj4gKDxhY3Rvcj4pCiAgKCgqaW5pdCogKGxhbWJkYSAoc2VydmVy IG1lc3NhZ2UpCiAgICAgICAgICAgICAobGlzdGVuIChzZXJ2ZXItc29ja2V0IHNlcnZlcikgNSkK ICAgICAgICAgICAgICh3aGlsZSAjdAogICAgICAgICAgICAgICAobWF0Y2ggKGFjY2VwdCAoc2Vy dmVyLXNvY2tldCBzZXJ2ZXIpKQogICAgICAgICAgICAgICAgICgjZgogICAgICAgICAgICAgICAg ICAoY2xvc2UgKHNlcnZlci1zb2NrZXQgc2VydmVyKSkpCiAgICAgICAgICAgICAgICAgKChjbGll bnQgLiBfKQogICAgICAgICAgICAgICAgICAoc2V0LXBvcnQtbm9uYmxvY2tpbmchIGNsaWVudCkK ICAgICAgICAgICAgICAgICAgKGZvcm1hdCBjbGllbnQgIlM6IGhlbGxvfiUiKQogICAgICAgICAg ICAgICAgICAoY2xvc2UgY2xpZW50KSkpKSkpCiAgICgqY2xlYW51cCogKGxhbWJkYSAoc2VydmVy IG1lc3NhZ2UpCiAgICAgICAgICAgICAgICAoZmFsc2UtaWYtZXhjZXB0aW9uCiAgICAgICAgICAg ICAgICAgKGNsb3NlIChzZXJ2ZXItc29ja2V0IHNlcnZlcikpKSkpKQogIChzZXJ2ZXItc29ja2V0 CiAgICM6aW5pdC12YWx1ZSAjZgogICAjOmluaXQta2V5d29yZCAjOnNlcnZlci1zb2NrZXQKICAg IzpnZXR0ZXIgc2VydmVyLXNvY2tldCkpCgooZGVmaW5lLWFjdG9yIDxwcm9iZT4gKDxhY3Rvcj4p CiAgKCgqaW5pdCogKGxhbWJkYSAocHJvYmUgbWVzc2FnZSkKICAgICAgICAgICAgIChsZXQgKCh0 YXJnZXQgKGNyZWF0ZS1hY3RvciogcHJvYmUgPHNlcnZlcj4gInNlcnZlciIKICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIzpzZXJ2ZXItc29ja2V0IChtYWtlLXNlcnZl ci1zb2NrZXQpKSkpCiAgICAgICAgICAgICAgIChzbG90LXNldCEgcHJvYmUgJ3RhcmdldCB0YXJn ZXQpCiAgICAgICAgICAgICAgICg8LSB0YXJnZXQgJypjbGVhbnVwKikpKSkpCiAgKHRhcmdldAog ICAjOmluaXQtdmFsdWUgI2YKICAgIzpnZXR0ZXIgdGFyZ2V0KSkKCihsZXQqICgoaGl2ZSAobWFr ZS1oaXZlKSkKICAgICAgIDs7IChyZXBsIChib290c3RyYXAtYWN0b3IgaGl2ZSA8cmVwbC1tYW5h Z2VyPikpCiAgICAgICAocHJvYmUgKGJvb3RzdHJhcC1hY3RvciBoaXZlIDxwcm9iZT4pKSkKICAo cnVuLWhpdmUgaGl2ZSAnKCkpKQoK --=-=-=--