From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Linas Vepstas Newsgroups: gmane.lisp.guile.bugs Subject: bug#25387: guile-2.2 multi-thread segfault in SCM_VALIDATE_WEAK_TABLE Date: Sat, 7 Jan 2017 18:18:20 -0600 Message-ID: Reply-To: linasvepstas@gmail.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: blaine.gmane.org 1483834759 17549 195.159.176.226 (8 Jan 2017 00:19:19 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 8 Jan 2017 00:19:19 +0000 (UTC) To: 25387@debbugs.gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Sun Jan 08 01:19:13 2017 Return-path: Envelope-to: guile-bugs@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 1cQ1CV-0002WU-1S for guile-bugs@m.gmane.org; Sun, 08 Jan 2017 01:19:07 +0100 Original-Received: from localhost ([::1]:59702 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cQ1CX-0004Zo-IY for guile-bugs@m.gmane.org; Sat, 07 Jan 2017 19:19:09 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40502) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cQ1CR-0004ZY-IY for bug-guile@gnu.org; Sat, 07 Jan 2017 19:19:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cQ1CQ-0003xL-7m for bug-guile@gnu.org; Sat, 07 Jan 2017 19:19:03 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:59166) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cQ1CQ-0003xH-4e for bug-guile@gnu.org; Sat, 07 Jan 2017 19:19:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cQ1CQ-0001uo-07 for bug-guile@gnu.org; Sat, 07 Jan 2017 19:19:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Linas Vepstas Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Sun, 08 Jan 2017 00:19:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 25387 X-GNU-PR-Package: guile X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-guile@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.14838347347347 (code B ref -1); Sun, 08 Jan 2017 00:19:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 8 Jan 2017 00:18:54 +0000 Original-Received: from localhost ([127.0.0.1]:46332 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cQ1CH-0001uR-KJ for submit@debbugs.gnu.org; Sat, 07 Jan 2017 19:18:53 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:49500) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cQ1CF-0001uD-7y for submit@debbugs.gnu.org; Sat, 07 Jan 2017 19:18:51 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cQ1C8-0003um-QW for submit@debbugs.gnu.org; Sat, 07 Jan 2017 19:18:46 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:41538) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cQ1C8-0003ui-NO for submit@debbugs.gnu.org; Sat, 07 Jan 2017 19:18:44 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40468) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cQ1C7-0004Z5-62 for bug-guile@gnu.org; Sat, 07 Jan 2017 19:18:44 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cQ1C5-0003u5-Pt for bug-guile@gnu.org; Sat, 07 Jan 2017 19:18:43 -0500 Original-Received: from mail-qk0-x22e.google.com ([2607:f8b0:400d:c09::22e]:32954) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cQ1C5-0003tw-Lz for bug-guile@gnu.org; Sat, 07 Jan 2017 19:18:41 -0500 Original-Received: by mail-qk0-x22e.google.com with SMTP id s140so86807926qke.0 for ; Sat, 07 Jan 2017 16:18:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:reply-to:from:date:message-id:subject:to; bh=wRUhpT0WaM8yxZPGfAZoe6QVQxf+Kd26z8XvVhU/Jcs=; b=fhYaPSGGhQGhLVn7v3Flt9rcT0gaJqQujf0IIuHYTCMuDkNIWi+G3aYuWR9GJE9NSW D07ZA1awRzyTyE8bJ951QPYXqPXl1m6Dk6xa+59IDLCGUvoiWwGtWvrtQvqxjLF9FpPM nvnKhjbakUYi4y1vk1KVrH9Jm+5SVDf5B3Q3FdFBtWWHo8DcZLZByY4XssGVJa/0kjNz ocqfuXUrtHXmcVT9hs9FEnyQpNXqYVokxOstInk5jpj3pcUP84g9c/mdI27xso1JcaSJ 0uRzjQu+2EXtkMjmxbqPcvbyjZA8nQXbdDMVAXtOBL52DDOFfi1pro843PsJvrPjsj9w 4PZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:from:date:message-id :subject:to; bh=wRUhpT0WaM8yxZPGfAZoe6QVQxf+Kd26z8XvVhU/Jcs=; b=QrUum9o3U73M/E3m9WJ1BhTKMk1f57LDY9Nf6xnMOwQb1Qhbf2fxvK6c+ZwnxdHVU/ MTMY37JySozu3wXOS34prZPtyua+bdb3WVCvQELY4ZBhnEq9jUJ3M9nhn1V8grTSAhqu +GkVXUKtpt+h66U9dk365j8YwExgetUQrZ6jVPjb6IrUcmxVxm6zs26z1QvcOM+zTfIJ 3OKGMOS1Le3JQCm8YUKBs1JJUZvSypGd9Fctpjs2Hq2xG46lpiO2AKF8kFvJMSmNNo3f JhFiGULCij4lZrDaSmPA4tSfxCZ+mNuh8u+bGsToAjnVNcub1Jm2Pb/2kadHyAo/Qkex 0CcA== X-Gm-Message-State: AIkVDXIXFwkZsUT2ZaJoXA+LqwLdOFTu/iKOnW1jGLlNqI5GfhoXzQiJpXEt1t2PCdOAdd8OFYXeVFz8JzZdZQ== X-Received: by 10.55.155.145 with SMTP id d139mr78741836qke.233.1483834720815; Sat, 07 Jan 2017 16:18:40 -0800 (PST) Original-Received: by 10.12.128.78 with HTTP; Sat, 7 Jan 2017 16:18:20 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Original-Sender: "bug-guile" Xref: news.gmane.org gmane.lisp.guile.bugs:8496 Archived-At: Following program crashes immediately (fraction of a second) in guile-2.2, current git version (as of 29 Dec 2016 a0656ad4cf976b3845e9b9663a90b46b4cf9fc5a ) It runs fine in guile-2.0. Its doing something slightly squonky: referencing the variable 'cnt' in a thread. Note definition of use before definition of variable Its deterministic - always crashes in the same place. (define junk 0) (define halt #f) (define (wtf-thr) (define start (- (current-time) 0.1)) ; Create thread that does junk and exits. Yes, the increment ; of `junk` is not protected, and its racey, but so what. (define (mkthr v) (call-with-new-thread (lambda () (if (eq? 0 (modulo cnt 30)) (gc)) ;;;; <<<< crashes here!!! (set! junk (+ junk 1))))) ; thread arguments (define thrarg (make-list 10 0)) (define cnt 0) (define (mke) ; Create a limited number of threads (define thr-list (map mkthr thrarg)) ; (display (length (all-threads))) (map join-thread thr-list) ; Some handy debug printing. (set! cnt (+ cnt 1)) (if (eq? 0 (modulo cnt 500)) (begin (display "rate=") (display (/ cnt (- (current-time) start))) (newline) (display "cnt=") (display cnt) (newline) (display (gc-stats)) (newline) (newline) ))) ; tail recursive infinite loop. (define (aloop) (mke) (if (not halt) (aloop))) ; while forever. (aloop) ) ; Run elsewhere, so that we have a shell prompt ; (not required for the bug) (call-with-new-thread wtf-thr) ; halt if desired. ; (set! halt #t) Thread 621 "guile" received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7fffedbe1700 (LWP 10504)] 0x00007ffff7b78af1 in scm_c_weak_table_ref (table=0x0, raw_hash=2738445758486295669, pred=0x7ffff7b77bb0 , closure=0x5555558fff00, dflt=0x904) at ../../libguile/weak-table.c:862 warning: Source file is more recent than executable. 862 SCM_VALIDATE_WEAK_TABLE (1, table); (gdb) bt #0 0x00007ffff7b78af1 in scm_c_weak_table_ref (table=0x0, raw_hash=2738445758486295669, pred=0x7ffff7b77bb0 , closure=0x5555558fff00, dflt=0x904) at ../../libguile/weak-table.c:862 #1 0x00007ffff7b02fa4 in fluid_ref (dynamic_state=0x555555f8ce60, fluid=0x5555558fff00) at ../../libguile/fluids.c:287 #2 0x00007ffff7b0325f in scm_fluid_ref (fluid=0x5555558fff00) at ../../libguile/fluids.c:308 #3 0x00007ffff7b34424 in scm_i_default_port_conversion_strategy () at ../../libguile/ports.c:1015 #4 0x00007ffff7b5e4df in scm_i_default_string_failed_conversion_handler () at ../../libguile/strings.c:1619 #5 scm_from_locale_stringn ( str=0x7ffff7b88d50 "Wrong type argument in position ~A: ~S", len=len@entry=18446744073709551615) at ../../libguile/strings.c:1626 #6 0x00007ffff7b5e51c in scm_from_locale_string (str=) at ../../libguile/strings.c:1613 #7 0x00007ffff7af76c6 in scm_error (key=0x5555558fa960, subr=subr@entry=0x7ffff7b8a080 "set-current-dynamic-state", message=, args=0x555555c6ce30, rest=rest@entry=0x555555c6ce50) at ../../libguile/error.c:59 #8 0x00007ffff7af7968 in scm_wrong_type_arg ( subr=subr@entry=0x7ffff7b8a080 "set-current-dynamic-state", pos=pos@entry=1, bad_value=bad_value@entry=0x555555c6c3b0) ---Type to continue, or q to quit--- at ../../libguile/error.c:251 #9 0x00007ffff7b03096 in scm_set_current_dynamic_state ( state=state@entry=0x555555c6c3b0) at ../../libguile/fluids.c:496 #10 0x00007ffff7b6351a in guilify_self_2 ( dynamic_state=dynamic_state@entry=0x555555c6c3b0) at ../../libguile/threads.c:466 #11 0x00007ffff7b63e0c in scm_i_init_thread_for_guile (base=0x7fffedbe0ec0, dynamic_state=0x555555c6c3b0) at ../../libguile/threads.c:595 #12 0x00007ffff7b63e59 in with_guile (base=base@entry=0x7fffedbe0ec0, data=data@entry=0x7fffedbe0ef0) at ../../libguile/threads.c:638 #13 0x00007ffff6c71812 in GC_call_with_stack_base ( fn=fn@entry=0x7ffff7b63e40 , arg=arg@entry=0x7fffedbe0ef0) at misc.c:1925 #14 0x00007ffff7b635cc in scm_i_with_guile (dynamic_state=, data=0x555555c6c410, func=0x7ffff7b635e0 ) at ../../libguile/threads.c:688 #15 launch_thread (d=0x555555c6c410) at ../../libguile/threads.c:750 #16 0x00007ffff735f464 in start_thread (arg=0x7fffedbe1700) at pthread_create.c:333 #17 0x00007ffff70a29df in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:105