chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] New egg: hopefully


From: Sudarshan S Chawathe
Subject: Re: [Chicken-users] New egg: hopefully
Date: Sun, 20 Dec 2015 09:50:24 -0500

Thanks for following up.  I hope the cause isn't something silly in my
setup.

I ran tested with a run.scm modified as you indicated, except that I'm
guessing you meant line 127, not 217.  (I couldn't find any obvious
match on line 217, so I replaced the one starting on line 127.)  The
results are attached.  It fails the assertion:

  (assert (= call-count -3))

Regards,

-chaw

> From: address@hidden
> Date: Sun, 20 Dec 2015 15:07:17 +0100
> Subject: Re: [Chicken-users] New egg: hopefully
> 
> Am 19.12.2015 um 23:31 schrieb Sudarshan S Chawathe:
> > Thanks for the update. I see the same behavior with tests/run.scm as
> > before: Compilation with csc is fine, but executing the resulting file
> > 'run' gives exactly the same error as before:
> > =
> 
> >   Error: assertion failed: (=3D (obox-v b1) 455)
> > =
> 
> > (Detailed error message is same as in my earlier message.)
> 
> Hm, that's strange.  I blindly assumed this to somehow follow from the
> import gone wrong.
> 
> Now I did no do much yesterday but re-run this over and over again to
> tune the implementation.  Neither on 4.9.1 or master.
> 
> Could you please _replace_ the let form in run.scm starting around line
> 217 with the one below and try.  Should give me more details.
> 
> The expected output:
> 
> D #<thread: thread182>: also in other thread former ref is still
> unchanged...
> D even after commit.  (Note: tests caching of references to fields.): 9
> T2 x cc 2 6
> T1 x cc 2 7
> T2 y cc 2 7
> T2 done cc 2 65
> T1 y cc -2 6
> T1 done cc -2 42
> T1 x cc -3 7
> T1 y cc -3 65
> T1 done cc -3 455
> D M1: not-owned
> D M2: not-abandoned
> Locking 20000 op in 1530.0 ms (13.0718954248366 op/ms)
> Optimistic 20000 op in 1324.0 ms (15.1057401812689 op/ms)
> 
> Thanks for your help.
> 
> /J=F6rg
> 
> Here the more verbose test expression:
> 
> (let ((mux1 (make-mutex 'T1)) (mux2 (make-mutex 'T2))
>       (call-count 0))
>   (define (step! msg mux1 mux2 val)
>     (mutex-unlock! mux1)
>     (if (and mux2 (> call-count 0) (< call-count 100)) (mutex-lock! mux2
> #f #f))
>     (if msg (format (current-error-port) "~a cc ~a ~a\n" msg call-count
> val))
>     val)
>   (mutex-lock! mux1 #f #f)
>   (mutex-lock! mux2 #f #f)
>   (thread-start!
>    (lambda ()
>      (call-with-transaction
>       (lambda (tnx)
>       (if (>=3D call-count 0) (set! call-count (add1 call-count))
>           (set! call-count (sub1 call-count)))
>       (if (< call-count 100)
>           (let ((a (obox-v-ref b2 tnx))
>                 (b (obox-v-ref b1 tnx)))
>             ;; Normally one should never do this.  We enforce thread
>             ;; switches during transaction.
>             (alter!
>              a
>              (let* ((x (step! "T2 x" mux1 mux2 (cell-ref a)))
>                    (y (step! "T2 y" mux1 mux2 (cell-ref b))))
>                (+ 23 (* x y))))
>             (step! "T2 done" mux1 #f (cell-ref a)))
>           (step! "T2 call count exceeded" mux1 #f call-count))))
>      (set! call-count (- call-count))))
>   (call-with-transaction
>    (lambda (tnx)
>      (if (>=3D call-count 0) (set! call-count (add1 call-count))
>         (set! call-count (sub1 call-count)))
>      (let ((a (obox-v-ref b1 tnx))
>          (b (obox-v-ref b2 tnx)))
>        (alter!
>       a
>       (let* ((x (step! "T1 x" mux2 mux1 (cell-ref a)))
>             (y (step! "T1 y" mux2 mux1 (cell-ref b))))
>         (* x y)))
>        (step! "T1 done" mux2 #f (cell-ref a)))))
>   (assert (=3D call-count -3)) ;; -- not defined to be -3, but normally
>   (dbg 'M1 (mutex-state mux1))
>   (dbg 'M2 (mutex-state mux2))
>   (assert (=3D (obox-v b1) 455))
>   (assert (=3D (obox-v b2) 65)))

$ csc run2.scm
$ ./run2
D CALL: #<procedure (hopefully-intern#with-current-transaction thunk667)>
D Initial: set
D Value in other thread is unchanged...: 9
D #<thread: thread5>: also in other thread former ref is still unchanged...
D even after commit.  (Note: tests caching of references to fields.): 9
D Value in other thread is unchanged...: 9
D Second round expecting changed value: 252
D #<thread: thread5>: also in other thread former ref is still unchanged...
D even after commit.  (Note: tests caching of references to fields.): 9
T2 x cc 2 6
T1 x cc 2 7
T1 y cc 2 6
T1 done cc 2 42

Error: (run2.scm:169) assertion failed: (= call-count -3)

        Call history:

        run2.scm:166: step!       
        run2.scm:130: mutex-unlock!       
        run2.scm:131: mutex-lock!         
        run2.scm:133: format      
        run2.scm:163: hopefully-intern#alter!     
        run2.scm:168: hopefully-intern#cell-ref   
        run2.scm:168: step!       
        run2.scm:130: mutex-unlock!       
        run2.scm:133: format      
        hopefully.scm:264: transaction-commit!    
        hopefully.scm:222: loop   
        hopefully.scm:228: loop   
        hopefully.scm:200: hopefully-intern-atomics#transaction-close!    
        hopefully-intern-atomics.scm:185: transaction-reset!      
        hopefully-intern-atomics.scm:34: ##sys#block-set!         
        run2.scm:169: ##sys#error               <--
$ diff run.scm run2.scm
131,132c131,134
<     (if (and mux2 (> call-count 0) (< call-count 100)) (mutex-lock! mux2 #f 
#f))
<     #;(if msg (format (current-error-port) "~a cc ~a ~a\n" msg call-count 
val))
---
>     (if (and mux2 (> call-count 0) (< call-count 100)) (mutex-lock! mux2
> #f #f))
>     (if msg (format (current-error-port) "~a cc ~a ~a\n" msg call-count
> val))
167c169,171
<   ;; (assert (= call-count -3)) -- not defined to be -3, but normally
---
>   (assert (= call-count -3)) ;; -- not defined to be -3, but normally
>   (dbg 'M1 (mutex-state mux1))
>   (dbg 'M2 (mutex-state mux2))
$  csc -version
(c) 2008-2014, The Chicken Team
(c) 2000-2007, Felix L. Winkelmann
Version 4.9.0.1 (stability/4.9.0) (rev 8b3189b)
linux-unix-gnu-x86 [ manyargs dload ptables ]
bootstrapped 2014-06-07

Enter `chicken -help' for information on how to use the compiler,
or try `csc' for a more convenient interface.

Run `csi' to start the interactive interpreter.
$ uname -a 
Linux vereq.eip10.org 3.16.0-4-686-pae #1 SMP Debian 3.16.7-ckt20-1+deb8u1 
(2015-12-14) i686 GNU/Linux
$

reply via email to

[Prev in Thread] Current Thread [Next in Thread]