Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0006030 [Squeak] Collections major unable to reproduce 02-12-07 17:08 02-16-07 17:01
Reporter Ron View Status public  
Assigned To
Priority normal Resolution open  
Status new   Product Version 3.9
Summary 0006030: Error in SortedCollection >> do:
Description Hi all,

I just ran into an error and was wondering if anyone has ever seen this before. I have a sorted collection with a computationally intensive sorting block.

It blew up on a nil. Low res jpg attached.

It appears to have worked for the first 12 items:
    newCollection in SortedCollection>>collect: has 12 items in it.

The 13th item returned a nil. This is because array on the sorted collection starts with 16 nils. firstIndex is set to 17.

Notice on the jpg it says firstIndex = 17 but index is 13. So I can only conclude that since index is 13 and 12 other objects were processed successfully that the array and first index changed during processing.

I am not sure that I can reproduce this error. I've been running the same code for quite a while without seeing it. If I can I will post it.

Has anyone seen this before or does anyone know why this may have happened?

Thanks for your help!

Ron Teitelbaum
Ron@USMedRec.com
Additional Information
Attached Files  SortedCollectionError.jpg [^] (10,214 bytes) 02-12-07 17:09

- Relationships

- Notes
(0009811 - 188 - 224 - 224 - 224 - 224 - 224)
nicolas cellier
02-15-07 00:31

It would happen if you would modify the original SortedCollection inside the loop.

| sc |
sc := (1 to: 12) asSortedCollection.
^sc collect: [:i | sc add: i negated]

But would you ?
 
(0009831 - 768 - 792 - 792 - 792 - 792 - 792)
Ron
02-15-07 15:44

No I didn't add to it. I've seen this some more and I am running multiple threads, but nothing that should be updating the collection. I've fixed my problem by adding aSortedCollection asOrderedCollection do: [...

That seems to fix the problem. I was expecting to just see the same problem in the asOrderedCollection code. Either loosing items, or having nils in the collection but that doesn't seem to happen. I'm wondering if the extra sends gives the collection a chance to settle down. Still I'm pretty concerned about this error.

I've tried to reproduce this with a simple case but so far no luck. It seems that I can only reproduce this with a huge amount of work going on, which includes multiple threads, SSL comm, and Seaside all running at once.
 
(0009904 - 640 - 694 - 694 - 694 - 694 - 694)
nicolas cellier
02-16-07 10:24

Ron, analysis of firstIndex inst var defs and the fact that a copy seems to cure sounds like your sortedCollection is modified.

I'am 99% sure that firstIndex ~= 1 will happen if and only if #add: is used.
So in my analysis, your sortedCollection is a live object modified with #add:, not the #asSortedCollection static kind (unless you use #add: only once at build time...).

Of course you wouldn't modify inside the loop.
And the fact that problem is not always reproduced indeed make think it is related to multithreading.

How can you make sure another thread didn't?
Did you try and inspect all owners of the sortedCollection?
 
(0009909 - 177 - 177 - 177 - 177 - 177 - 177)
Ron
02-16-07 17:01

I'm going to try and reproduce the error with the collection protected by a semaphore. That sould remove the possibility of adding. Thanks for looking at it, I'll report back.
 

- Issue History
Date Modified Username Field Change
02-12-07 17:08 Ron New Issue
02-12-07 17:09 Ron File Added: SortedCollectionError.jpg
02-15-07 00:31 nicolas cellier Note Added: 0009811
02-15-07 15:44 Ron Note Added: 0009831
02-16-07 10:24 nicolas cellier Note Added: 0009904
02-16-07 17:01 Ron Note Added: 0009909


Mantis 1.0.8[^]
Copyright © 2000 - 2007 Mantis Group
46 total queries executed.
33 unique queries executed.
Powered by Mantis Bugtracker