From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: =?utf-8?Q?Cl=C3=A9ment?= Lassieur Newsgroups: gmane.lisp.guile.devel Subject: crashes with Fibers Date: Fri, 29 Jun 2018 11:20:12 +0200 Message-ID: <8736x63q5v.fsf@lassieur.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1530276520 20313 195.159.176.226 (29 Jun 2018 12:48:40 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 29 Jun 2018 12:48:40 +0000 (UTC) User-Agent: mu4e 1.0; emacs 26.1 To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Fri Jun 29 14:48:36 2018 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fYspE-00055i-2y for guile-devel@m.gmane.org; Fri, 29 Jun 2018 14:48:32 +0200 Original-Received: from localhost ([::1]:41938 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fYsrJ-0003An-Hu for guile-devel@m.gmane.org; Fri, 29 Jun 2018 08:50:41 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41416) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fYpZl-0000Tl-UF for guile-devel@gnu.org; Fri, 29 Jun 2018 05:20:27 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fYpZg-0007hW-Vq for guile-devel@gnu.org; Fri, 29 Jun 2018 05:20:21 -0400 Original-Received: from mail.lassieur.org ([83.152.10.219]:47708) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fYpZg-0007fh-NB for guile-devel@gnu.org; Fri, 29 Jun 2018 05:20:16 -0400 Original-Received: from rodion (37-169-80-87.coucou-networks.fr [37.169.80.87]) by mail.lassieur.org (OpenSMTPD) with ESMTPSA id e5242ea7 (TLSv1.2:ECDHE-RSA-CHACHA20-POLY1305:256:NO); Fri, 29 Jun 2018 09:20:13 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 83.152.10.219 X-Mailman-Approved-At: Fri, 29 Jun 2018 08:50:22 -0400 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: "guile-devel" Xref: news.gmane.org gmane.lisp.guile.devel:19567 Archived-At: Hi, I'm encountering a few crashes with Fibers that happen when I call CALL-WITH-NEW-THREAD in a Fiber. TEST4 crashes every time. TEST5 never outputs, but it doesn't crash every time. TEST1 is exactly like TEST5 except that I replace CALL-WITH-NEW-THREAD with SPAWN-FIBER. Is it a mistake from me or a Guile bug? If it is a bug, do you know if there are workarounds? Thank you, Cl=C3=A9ment (use-modules (fibers channels) (fibers)) ;; good (define (test1) (run-fibers (lambda () (spawn-fiber (lambda () (let ((channel (make-channel))) (spawn-fiber (lambda () (put-message channel "hello world"))) (format #t "~a~%" (get-message channel)))))) #:drain? #t)) =E2=8A=A3 hello world ;; good (define (test2) (let ((channel (make-channel))) (call-with-new-thread (lambda () (put-message channel "hello world"))) (format #t "~a~%" (get-message channel)))) =E2=8A=A3 hello world =E2=87=92 #t ;; good (define (test3) (run-fibers (lambda () (let ((channel (make-channel))) (call-with-new-thread (lambda () (put-message channel "hello world"))) (format #t "~a~%" (get-message channel)))) #:drain? #t)) =E2=8A=A3 hello world =E2=87=92 #t ;; bad (define (test4) (run-fibers (lambda () (spawn-fiber (lambda () (let ((channel (make-channel))) (call-with-new-thread (lambda () (put-message channel "hello world"))))))) #:drain? #t)) =E2=8A=A3 scheme@(guile-user)> In /home/clement/.guix-profile/share/gui= le/site/2.2/fibers/internal.scm: 402:6 1 (suspend-current-fiber _) In unknown file: 0 (scm-error misc-error #f "~A" ("Attempt to suspend fiber= within continuation barrier") #f) ERROR: In procedure scm-error: Attempt to suspend fiber within continuation barrier ;; bad (define (test5) (run-fibers (lambda () (spawn-fiber (lambda () (let ((channel (make-channel))) (call-with-new-thread (lambda () (put-message channel "hello world"))) (format #t "~a~%" (get-message channel)))))) #:drain? #t)) =E2=8A=A3 scheme@(guile-user)> In /home/clement/.guix-profile/share/gui= le/site/2.2/fibers/operations.scm: 188:5 3 (perform-operation #< wrap-fn: #f try-fn: # block-fn: #>) In /home/clement/.guix-profile/share/guile/site/2.2/fibers/channels.s= cm: 88:26 2 (try-fn) In /home/clement/.guix-profile/share/guile/site/2.2/fibers/internal.s= cm: 219:6 1 (schedule-fiber! _ _) In unknown file: 0 (scm-error misc-error #f "~A" ("epoll instance is dead")= #f) ERROR: In procedure scm-error: epoll instance is dead