Anonymous | Login | 03-01-2021 19:22 UTC |
Main | My View | View Issues | Change Log | Docs |
Viewing Issue Simple Details [ Jump to Notes ] | [ View Advanced ] [ Issue History ] [ Print ] | |||||||||||
ID | Category | Severity | Reproducibility | Date Submitted | Last Update | |||||||
0006830 | [Squeak] Kernel | major | always | 12-28-07 21:38 | 08-14-12 00:30 | |||||||
Reporter | orgsow | View Status | public | |||||||||
Assigned To | leves | |||||||||||
Priority | normal | Resolution | reopened | |||||||||
Status | feedback | Product Version | 3.10 | |||||||||
Summary | 0006830: A mutex can wind up with a semaphore with more than 1 excessSignal | |||||||||||
Description |
I am new to smalltalk and was playing around with processes to see how they work and I've encountered something that should never happen. It may be related to this bug: http://bugs.squeak.org/view.php?id=6576 [^] since I am using Delay. The semaphore in a mutex should never go above 1 excess signal. This script here will cause that to happen if you put it into a Transcript window and "do it": START |p keepGoing i t resume suspend stop semcounts m | m := Mutex new. p := Processor activeProcess.keepGoing := true.i := 0.t := Transcript.m critical: [t cr;cr;cr;cr;cr.]. m critical: [ t cr; show: 'init: ', Processor activeProcess oopString; cr]. semcounts := ''. semcounts := 'init:', m excessSignals asString, ' ', semcounts. resume := [ m critical: [ t cr; show: 'resume: ', Processor activeProcess oopString; cr]. semcounts := 'resume1:', m excessSignals asString, ' ', semcounts. (Delay forSeconds: 20) wait. m critical: [ t cr; show: 'resuming'; cr. p resume]. semcounts := 'resume2:', m excessSignals asString, ' ', semcounts. ]. suspend := [ m critical: [ t cr; show: 'pause: ', Processor activeProcess oopString; cr]. (Delay forSeconds: 10) wait. m critical: [ t cr; show: 'pausing'; cr. p suspend]. semcounts := 'suspend:', m excessSignals asString, ' ', semcounts. ]. stop := [ m critical: [ t cr; show: 'stop: ', Processor activeProcess oopString; cr]. (Delay forSeconds: 30) wait. m critical: [ t cr; show: 'stopping'; cr. keepGoing := false]. semcounts := 'stop:', m excessSignals asString, ' ', semcounts. ]. resume fork. suspend fork. stop fork. m critical: [ t cr; show: 'end: ', Processor activeProcess oopString; cr]. semcounts := 'end:', m excessSignals asString, ' ', semcounts. [keepGoing] whileTrue: [ m critical: [t show: i; space]. "Processor yield." i := i + 1]. semcounts := 'beforedone:', m excessSignals asString, ' ', semcounts. (Delay forSeconds: 10) wait. m critical: [ t cr; show: 'done.';cr.]. semcounts := 'done:', m excessSignals asString, ' ', semcounts. Transcript show: semcounts asString. END The output of the last line is: done:2 beforedone:2 stop:1 resume2:1 suspend:1 resume1:0 end:1 init:1 I have ran a version of this that stores the mutex in the Smalltalk dictionary for reuse and if it's reused it hangs the system. Infact, that's why I originally started trying to figure out what was going on because it was hanging on the second run every time. Also, notice the commented out "Processor yield." If you uncomment that then the program will function as expected (ie, excessSignals will not go over 1.) That may help diagnose the problem. This happens in 3.9 and 3.10 |
|||||||||||
Additional Information |
I added 2 methods to the system to expose excessSignals. You need to fileIn the attatched change set to get them, or you can add them manually from here: !Mutex methodsFor: '*miles-debug' stamp: 'mbg 12/28/2007 13:19'! excessSignals ^semaphore excessSignals.! ! !Semaphore methodsFor: '*miles-debug' stamp: 'mbg 12/28/2007 13:19'! excessSignals ^excessSignals.! ! |
|||||||||||
Attached Files |
![]() ![]() |
|||||||||||
|
Mantis 1.0.8[^]
Copyright © 2000 - 2007 Mantis Group
59 total queries executed. 37 unique queries executed. |