Opened 5 years ago

Last modified 6 months ago

#1564 new defect

srfi-18: (mutex-unlock) Internal scheduler error

Reported by: megane Owned by:
Priority: major Milestone: 6.0.0
Component: extensions Version: 5.0.0
Keywords: scheduler threads Cc:
Estimated difficulty:

Description

(import srfi-18)
(import (chicken random))

(define m (make-mutex))
(define (rt) (/ (pseudo-random-integer 100) 1000))
(define (y)
  (let lp4 ()
    (unless (= 0 (pseudo-random-integer 10))
      (print (current-thread) " " "yield")
      (thread-yield!)
      (lp4))))

(thread-start!
 (make-thread (lambda ()
                (let lp ()
                  (print (current-thread) " " "lock")
                  (mutex-lock! m (rt))
                  (print (current-thread) " " "unlock")
                  (mutex-unlock! m)
                  (y)
                  (lp)))))

(let lp2 ()
  (print (current-thread) " " "lock")
  (mutex-lock! m (rt))
  (print (current-thread) " " "sleep")
  (thread-sleep! (rt))
  (print (current-thread) " " "unlock")
  (mutex-unlock! m)
  (lp2))

Warning (#<thread: thread1>): in thread: (mutex-unlock) Internal scheduler error: unknown thread state
#<thread: primordial>
ready

        Call history:

        t.scm:7: chicken.random#pseudo-random-integer
        t.scm:7: scheme#/
        t.scm:19: srfi-18#mutex-lock!
        t.scm:20: srfi-18#current-thread
        t.scm:20: chicken.base#print
        t.scm:21: srfi-18#mutex-unlock!         <--
#

Change History (5)

comment:1 Changed 5 years ago by sjamaan

Milestone: 5.15.2

Getting ready for 5.1, moving tickets which won't make it in to 5.2.

comment:2 Changed 5 years ago by felix winkelmann

Milestone: 5.25.3

comment:3 Changed 4 years ago by megane

Jörg Wittenberger posted patches here:
https://lists.nongnu.org/archive/html/chicken-hackers/2018-12/msg00037.html

I've been using the C4 versions since 2019-02-15 without problems.

comment:4 Changed 3 years ago by sjamaan

Milestone: 5.35.4

Who knows, maybe the scheduler overhaul will make this ticket obsolete. I sure hope so...

comment:5 Changed 6 months ago by felix winkelmann

Milestone: 5.46.0.0
Note: See TracTickets for help on using tickets.