From: SourceForge.net <no...@so...> - 2012-07-20 07:27:59
|
Bugs item #3545905, was opened at 2012-07-19 08:29 Message generated for change (Comment added) made by vtz You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=101355&aid=3545905&group_id=1355 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: multithreading Group: lisp error Status: Open Resolution: None Priority: 5 Private: No Submitted By: lmj () Assigned to: Vladimir Tzankov (vtz) Summary: Hang with exemption Initial Comment: The following RUN function eventually hangs for both the latest build (15589) and clisp-2.49. (defstruct sema (count 0) (lock (mt:make-mutex)) (cvar (mt:make-exemption))) (defun inc-sema (sema) (mt:with-mutex-lock ((sema-lock sema)) (incf (sema-count sema)) (mt:exemption-signal (sema-cvar sema)))) (defun dec-sema (sema) (mt:with-mutex-lock ((sema-lock sema)) (loop (cond ((plusp (sema-count sema)) (decf (sema-count sema)) (return)) (t (mt:exemption-wait (sema-cvar sema) (sema-lock sema))))))) (defun test (thread-count) (let ((from-threads (make-sema))) (loop repeat thread-count do (mt:make-thread (lambda () (inc-sema from-threads)) :name "test")) (loop repeat thread-count do (dec-sema from-threads)))) (defun run () (loop (test 16) (format t ".") (finish-output))) Sometimes the outcome with the latest build is: Internal error: statement in file "zthread.d", line 771 has been reached!! The number of iterations until hanging tends to decrease as thread-count increases. The following replacement for TEST should also be checked (it has exposed bugs in other CL implementations where the previous TEST did not). (defun test (thread-count) (let ((from-threads (make-sema)) (to-threads (make-sema))) (loop repeat thread-count do (mt:make-thread (lambda () (dec-sema to-threads) (inc-sema from-threads)) :name "test")) (loop repeat thread-count do (inc-sema to-threads)) (loop repeat thread-count do (dec-sema from-threads)))) Linux xi 3.2.0-24-generic-pae #39-Ubuntu SMP Mon May 21 18:54:21 UTC 2012 i686 i686 i386 GNU/Linux gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) GNU CLISP 2.49+ (2010-07-17) (built 3551638844) (memory 3551639097) Software: GNU C 4.6.3 gcc -g -O2 -W -Wswitch -Wcomment -Wpointer-arith -Wreturn-type -Wmissing-declarations -Wimplicit -Wno-sign-compare -Wno-format-nonliteral -O2 -fexpensive-optimizations -falign-functions=4 -pthread -DENABLE_UNICODE -DMULTITHREAD -DPOSIX_THREADS -DDYNAMIC_MODULES libgnu.a -lreadline -lncurses -ldl -lsigsegv SAFETY=0 HEAPCODES LINUX_NOEXEC_HEAPCODES GENERATIONAL_GC SPVW_BLOCKS SPVW_MIXED TRIVIALMAP_MEMORY libsigsegv 2.9 libreadline 6.2 Features: (REGEXP WILDCARD SYSCALLS I18N LOOP COMPILER CLOS MOP CLISP ANSI-CL COMMON-LISP LISP=CL INTERPRETER LOGICAL-PATHNAMES MT SOCKETS GENERIC-STREAMS SCREEN GETTEXT UNICODE BASE-CHAR=CHARACTER PC386 UNIX) C Modules: (clisp i18n syscalls regexp) Installation directory: /home/jlawrence/usr/stow/clisp-dev/lib/clisp-2.49+/ User language: ENGLISH Machine: I686 (I686) xi [127.0.1.1] ---------------------------------------------------------------------- >Comment By: Vladimir Tzankov (vtz) Date: 2012-07-20 00:27 Message: I can't reproduce it (tested both on Linux and OSX). I used up to 128 threads and waited about 5 minutes on each run. Also tested the second 'test' function without experiencing problems. Reaching zthread.d:771 means inconsistency in internal mutex record. Will continue to test - any additional info (though not sure what to ask for - debugging is an option but it's not easy one) will be helpful. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=101355&aid=3545905&group_id=1355 |