Hi all, I got a few hiccups while updating some images. One of them occurred while rehashing some OrderedDictionary. For some reason, the dictionary was shrinked. Unfortunately rehash then tries to grow the 'order' ivar by a negative growSize. This causes an errorSubscriptBounds:
To reproduce, simply try: OrderedDictionary new compact.
I have had the same problem not too long ago. I eventually assumed that I had done something wrong with these dictionaries and ran a script with a combination of allInstances, newFrom: and become: to get rid of the error. But as you put it, it seems to be a bug after all.
Am So., 28. Nov. 2021 um 18:39 Uhr schrieb Nicolas Cellier nicolas.cellier.aka.nice@gmail.com:
Hi all, I got a few hiccups while updating some images. One of them occurred while rehashing some OrderedDictionary. For some reason, the dictionary was shrinked. Unfortunately rehash then tries to grow the 'order' ivar by a negative growSize. This causes an errorSubscriptBounds:
To reproduce, simply try: OrderedDictionary new compact.
Me too.
________________________________ Von: Squeak-dev squeak-dev-bounces@lists.squeakfoundation.org im Auftrag von Jakob Reschke jakres+squeak@gmail.com Gesendet: Sonntag, 28. November 2021 18:55:27 An: The general-purpose Squeak developers list Betreff: Re: [squeak-dev] problem while rehashing shrinked OrderedDictionary
I have had the same problem not too long ago. I eventually assumed that I had done something wrong with these dictionaries and ran a script with a combination of allInstances, newFrom: and become: to get rid of the error. But as you put it, it seems to be a bug after all.
Am So., 28. Nov. 2021 um 18:39 Uhr schrieb Nicolas Cellier nicolas.cellier.aka.nice@gmail.com:
Hi all, I got a few hiccups while updating some images. One of them occurred while rehashing some OrderedDictionary. For some reason, the dictionary was shrinked. Unfortunately rehash then tries to grow the 'order' ivar by a negative growSize. This causes an errorSubscriptBounds:
To reproduce, simply try: OrderedDictionary new compact.
Hi Nicolas,
On Sun, 28 Nov 2021, Nicolas Cellier wrote:
Hi all, I got a few hiccups while updating some images. One of them occurred while rehashing some OrderedDictionary. For some reason, the dictionary was shrinked. Unfortunately rehash then tries to grow the 'order' ivar by a negative growSize. This causes an errorSubscriptBounds:
To reproduce, simply try: OrderedDictionary new compact.
Thanks. That example made it easy to track down what causes the problem. Collections-ul.962 should have it fixed. The ideal solution would be to finally change the order variable to be an OrderedCollection, so that OrderedDictionary wouldn't have to reimplement most of the logic.
Levente
Hi all,
I just ran into this issue again while updating an older image that I had updated 8 months ago. So this seems to be a regression which effectively breaks our update stream if you were using OrderedDictionaries in older images already. Could - and should - we manipulate the update stream in any way to fix it again? :-)
Best, Christoph
--- Sent from Squeak Inbox Talk
On 2021-11-29T20:18:13+01:00, leves@caesar.elte.hu wrote:
Hi Nicolas,
On Sun, 28 Nov 2021, Nicolas Cellier wrote:
Hi all, I got a few hiccups while updating some images. One of them occurred while rehashing some OrderedDictionary. For some reason, the dictionary was shrinked. Unfortunately rehash then tries to grow the 'order' ivar by a negative growSize. This causes an errorSubscriptBounds:
To reproduce, simply try: OrderedDictionary new compact.
Thanks. That example made it easy to track down what causes the problem. Collections-ul.962 should have it fixed. The ideal solution would be to finally change the order variable to be an OrderedCollection, so that OrderedDictionary wouldn't have to reimplement most of the logic.
Levente
Workaround is to patch these two methods manually when you run into the error during updating your image:
OrderedDictionary >> growTo: anInteger
| newCapacity capacityDifference | super growTo: anInteger. newCapacity := self capacity. capacityDifference := newCapacity - order size. capacityDifference = 0 ifTrue: [ ^self ]. order := capacityDifference > 0 ifTrue: [ order grownBy: capacityDifference ] ifFalse: [ order first: newCapacity ]
HashedCollection >> growTo: anInteger "Grow the elements array and reinsert the old elements. Do it even if the size of the array is the same as the argument because this methods is also used to rehash the collection." | oldElements | oldElements := array. array := self arrayType new: anInteger. self noCheckNoGrowFillFrom: oldElements
And then restart the debugger.
Best, Christoph
--- Sent from Squeak Inbox Talk
On 2022-02-07T17:21:02+01:00, christoph.thiede@student.hpi.uni-potsdam.de wrote:
Hi all,
I just ran into this issue again while updating an older image that I had updated 8 months ago. So this seems to be a regression which effectively breaks our update stream if you were using OrderedDictionaries in older images already. Could - and should - we manipulate the update stream in any way to fix it again? :-)
Best, Christoph
Sent from Squeak Inbox Talk
On 2021-11-29T20:18:13+01:00, leves at caesar.elte.hu wrote:
Hi Nicolas,
On Sun, 28 Nov 2021, Nicolas Cellier wrote:
Hi all, I got a few hiccups while updating some images. One of them occurred while rehashing some OrderedDictionary. For some reason, the dictionary was shrinked. Unfortunately rehash then tries to grow the 'order' ivar by a negative growSize. This causes an errorSubscriptBounds:
To reproduce, simply try: ??? OrderedDictionary new compact.
Thanks. That example made it easy to track down what causes the problem. Collections-ul.962 should have it fixed. The ideal solution would be to finally change the order variable to be an OrderedCollection, so that OrderedDictionary wouldn't have to reimplement most of the logic.
Levente
Hi Christoph --
Thanks for reporting a workaround for this issue. The CI updates a 2-year old image every day and seems to have to issues. Thus, I would not make any changes there.
Best, Marcel Am 07.02.2022 17:24:40 schrieb christoph.thiede@student.hpi.uni-potsdam.de christoph.thiede@student.hpi.uni-potsdam.de: Workaround is to patch these two methods manually when you run into the error during updating your image:
OrderedDictionary >> growTo: anInteger
| newCapacity capacityDifference | super growTo: anInteger. newCapacity := self capacity. capacityDifference := newCapacity - order size. capacityDifference = 0 ifTrue: [ ^self ]. order := capacityDifference > 0 ifTrue: [ order grownBy: capacityDifference ] ifFalse: [ order first: newCapacity ]
HashedCollection >> growTo: anInteger "Grow the elements array and reinsert the old elements. Do it even if the size of the array is the same as the argument because this methods is also used to rehash the collection." | oldElements | oldElements := array. array := self arrayType new: anInteger. self noCheckNoGrowFillFrom: oldElements
And then restart the debugger.
Best, Christoph
--- Sent from Squeak Inbox Talk [https://github.com/hpi-swa-lab/squeak-inbox-talk]
On 2022-02-07T17:21:02+01:00, christoph.thiede@student.hpi.uni-potsdam.de wrote:
Hi all,
I just ran into this issue again while updating an older image that I had updated 8 months ago. So this seems to be a regression which effectively breaks our update stream if you were using OrderedDictionaries in older images already. Could - and should - we manipulate the update stream in any way to fix it again? :-)
Best, Christoph
Sent from Squeak Inbox Talk
On 2021-11-29T20:18:13+01:00, leves at caesar.elte.hu wrote:
Hi Nicolas,
On Sun, 28 Nov 2021, Nicolas Cellier wrote:
Hi all, I got a few hiccups while updating some images. One of them occurred while rehashing some OrderedDictionary. For some reason, the dictionary was shrinked. Unfortunately rehash then tries to grow the 'order' ivar by a negative growSize. This causes an errorSubscriptBounds:
To reproduce, simply try: ??? OrderedDictionary new compact.
Thanks. That example made it easy to track down what causes the problem. Collections-ul.962 should have it fixed. The ideal solution would be to finally change the order variable to be an OrderedCollection, so that OrderedDictionary wouldn't have to reimplement most of the logic.
Levente
Hi Marcel,
The CI updates a 2-year old image every day and seems to have to issues.
(assuming you meant "seems to have no issues" :))
I think this is simply because "OrderedDictionary allInstances size" answers 0 in a clean image. But not in various images in the wild, just like mine. :-)
Best, Christoph
--- Sent from Squeak Inbox Talk
On 2022-02-07T21:07:27+01:00, marcel.taeumel@hpi.de wrote:
Hi Christoph --
Thanks for reporting a workaround for this issue. The CI updates a 2-year old image every day and seems to have to issues. Thus, I would not make any changes there.
Best, Marcel Am 07.02.2022 17:24:40 schrieb christoph.thiede at student.hpi.uni-potsdam.de <christoph.thiede at student.hpi.uni-potsdam.de>: Workaround is to patch these two methods manually when you run into the error during updating your image:
OrderedDictionary >> growTo: anInteger
| newCapacity capacityDifference | super growTo: anInteger. newCapacity := self capacity. capacityDifference := newCapacity - order size. capacityDifference = 0 ifTrue: [ ^self ]. order := capacityDifference > 0 ifTrue: [ order grownBy: capacityDifference ] ifFalse: [ order first: newCapacity ]
HashedCollection >> growTo: anInteger "Grow the elements array and reinsert the old elements. Do it even if the size of the array is the same as the argument because this methods is also used to rehash the collection." | oldElements | oldElements := array. array := self arrayType new: anInteger. self noCheckNoGrowFillFrom: oldElements
And then restart the debugger.
Best, Christoph
Sent from Squeak Inbox Talk [https://github.com/hpi-swa-lab/squeak-inbox-talk]
On 2022-02-07T17:21:02+01:00, christoph.thiede at student.hpi.uni-potsdam.de wrote:
Hi all,
I just ran into this issue again while updating an older image that I had updated 8 months ago. So this seems to be a regression which effectively breaks our update stream if you were using OrderedDictionaries in older images already. Could - and should - we manipulate the update stream in any way to fix it again? :-)
Best, Christoph
Sent from Squeak Inbox Talk
On 2021-11-29T20:18:13+01:00, leves at caesar.elte.hu wrote:
Hi Nicolas,
On Sun, 28 Nov 2021, Nicolas Cellier wrote:
Hi all, I got a few hiccups while updating some images. One of them occurred while rehashing some OrderedDictionary. For some reason, the dictionary was shrinked. Unfortunately rehash then tries to grow the 'order' ivar by a negative growSize. This causes an errorSubscriptBounds:
To reproduce, simply try: ??? OrderedDictionary new compact.
Thanks. That example made it easy to track down what causes the problem. Collections-ul.962 should have it fixed. The ideal solution would be to finally change the order variable to be an OrderedCollection, so that OrderedDictionary wouldn't have to reimplement most of the logic.
Levente
squeak-dev@lists.squeakfoundation.org