Anonymous | Login | 02-28-2021 15:08 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 | |||||||
0006955 | [Squeak] Collections | major | always | 02-26-08 14:30 | 02-26-08 14:30 | |||||||
Reporter | GazzaGuru | View Status | public | |||||||||
Assigned To | ||||||||||||
Priority | normal | Resolution | open | |||||||||
Status | new | Product Version | ||||||||||
Summary | 0006955: Weak collections are not thread safe with respect to finalization | |||||||||||
Description |
Weak collections (excluding WeakRegistry) may get finalized while being accessed (by a process with priority > userInterruptPriority) leading to a misrepresentation of whether they contain a particular element/key at any given moment. For instance, with a WeakKeyDictionary, on doing #at:ifAbsentPut: may insert new entries with identical keys. One option would be to expose the WeakArray FinalizationLock to process that modify such weak collections though this would effectively be a global lock across all weak collections. As a better approach, weak collections should be protected in a similar manner to WeakRegistry for any operation that could change their underlying state. |
|||||||||||
Additional Information |
The following code highlights the problem most of the time! d := WeakIdentityKeyDictionary new. WeakArray addWeakDependent: d. oc := OrderedCollection new. [1000 timesRepeat: [ o := Morph new. 2 atRandom > 1 ifTrue: [oc add: o]. d at: o ifAbsentPut: ['something']. 10 timesRepeat: [ d at: o ifAbsent: [self error: 'duplicate ', o oopString]. (Delay forMilliseconds: 1) wait]]. self inform: 'completed'] forkAt: Processor lowIOPriority |
|||||||||||
Attached Files | ||||||||||||
|
There are no notes attached to this issue. |
Mantis 1.0.8[^]
Copyright © 2000 - 2007 Mantis Group
27 total queries executed. 24 unique queries executed. |