SequenceableCollection VM crash (was Re: [Pharo-users] XMLOrderedList Concantenation)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

SequenceableCollection VM crash (was Re: [Pharo-users] XMLOrderedList Concantenation)

Ben Coman
 
Just reporting, while looking into a query on [pharo-users] (which is attached for initial context only and can probably be deleted from any replies) I managed to crash the VM by evaluating the following in Workspace:

a := SequenceableCollection new.
a add: 1.
a , SequenceableCollection new.

Now the interesting thing is that while the system becomes immediately sluggish, Pharo.exe crashes about 20 seconds later.

This is with Pharo 3.0 Release (30846) http://files.pharo.org/platform/Pharo3.0-win.zip (dated 2014-04-30)
on Windows Home Premium 64-bit SP1.

cheers -ben

Ben Coman wrote:

Thanks. That info made it much easier to try.  Sorry I didn't end up with an answer for you, but I confirm there is some issue here, or something new I can learn when other chip in.

Here is what I tried.

* Installed XMLParser (monty.58) from Configuration Browser in Pharo 3.

* Ran your code. Got the same error.

* From the call stack I observed that XMLOrderedCollection(SequenceableCollection)>>copyReplaceFrom:to:with:
has the line "newSequenceableCollection := self species new: newSize." such that it seems your error might be reduced to the question of why the following two snippets fail:
    d := OrderedCollection new: 1.
    d at: 1 put: 1.

    e := OrderedCollection new: 3.
    e at: 2 put: 1.

However I'm sorry that is beyond my knowledge, and I'm hoping someone else can chip in so I can learn something.

Pushing on, I noticed that XMLOrderedList has an instance variable /collection/ which holds the OrderedCollection.

Now I wonder (without great experience and hoping to learn something) if it smells funny that XMLOrderedList inherits all of SequencableCollection methods that can not operate on /collection/.

I noticed that XMLOrderedList was using an inherited SequenceableCollection>>copyReplaceFrom:to:with
while OrderedCollection overrode that method with its own. So taking inspiration XMLOrderedList>>copyFrom:to: to override SequencableCollection>>copyReplaceFrom:to:with: to work with /collection/
seems to solve your problem:
    XMLOrderedList>>copyReplaceFrom: start to: stop with: replacementCollection
        ^ self newWithCollection:
            (collection copyReplaceFrom: start to: stop with: replacementCollection )


Along the way I noticed a few (possible) bugs that seems not related to your problem:

* When stepping through XMLOrderedList>>setCollection:
there is a red-box-of-death for the instance variables, which can be solved by defining the following.
    XMLOrderedList>>size
        ^ collection ifNil: [ 0 ] ifNotNil: [ collection size]

* In the debugger the /collection/ instance variable is not shown! (e.g. line XMLOrderedList>>at:put:).
Can someone confirm this should show?

HTH
cheers -ben

Thushar G R wrote:
XMLOrderedList belongs to package XML-Parser-Nodes.

a := XMLOrderedList new.
a add:'1'.
a , XMLOrderedList new.

Here select all and Do it. On line 3 (a , XMLOrderedList new.)  i am expected to get a copy of 'a' , but instead it throws an error SubscriptOutOfBounds. 




OrderedCollection(Object)>>errorSubscriptBounds:
OrderedCollection>>ensureBoundsFrom:to:
OrderedCollection>>at:put:
OrderedCollection(SequenceableCollection)>>replaceFrom:to:with:startingAt:
XMLOrderedList>>replaceFrom:to:with:startingAt:
XMLOrderedList(SequenceableCollection)>>copyReplaceFrom:to:with:
XMLOrderedList(SequenceableCollection)>>,
UndefinedObject>>DoIt
OpalCompiler>>evaluate
SmalltalkEditor>>evaluateSelectionAndDo:
PluggableTextMorph>>inspectIt in Block: [ textMorph editor evaluateSelectionAndDo: [ :resu...etc...
PluggableTextMorph>>handleEdit: in Block: [ result := editBlock value ]
TextMorphForEditView(TextMorph)>>handleEdit:
PluggableTextMorph>>handleEdit:
PluggableTextMorph>>inspectIt
SmalltalkEditor class>>buildSmalltalkEditorKeymappingsOn: in Block: [ :morph | morph inspectIt ]
BlockClosure>>cull:
BlockClosure>>cull:cull:
BlockClosure>>cull:cull:cull:
KMCategoryBinding>>completeMatch:buffer:
KMKeymap>>notifyCompleteMatchTo:buffer: in Block: [ :l | l completeMatch: self buffer: aBuffer ]
Array(SequenceableCollection)>>do:
KMKeymap>>notifyCompleteMatchTo:buffer:
KMKeymap>>onMatchWith:notify:andDo:
KMCategory>>onMatchWith:notify:andDo: in Block: [ :entry | entry onMatchWith: anEventBuffer notify...etc...
Set>>do:
KMCategory>>onMatchWith:notify:andDo:
KMCategoryBinding>>verifyMatchWith:notifying:thenDoing:
KMDispatcher>>dispatch: in Block: [ :aTarget | ...
OrderedCollection>>do:


Plese refer to the above stack.

Thanks in advance.

thushar


On Mon, May 5, 2014 at 6:28 PM, Ben Coman <[hidden email]> wrote:
Thushar G R wrote:
Hi,

I am getting an error while doing this.

a := XMLOrderedList new.
a add:'1'.
a , XMLOrderedList new.

Thanks,

Thushar
I could give you "an answer" ;) - but it would be what you wanted.  It would help if you told what the error was, where it occurs (which of the three lines), and what you expect each line is doing (especially the third line).

Also I don't see XMLOrderedList in the default Pharo image, so it would help if you describe where you got that from and how you installed it.

cheers -ben




Reply | Threaded
Open this post in threaded view
|

Re: SequenceableCollection VM crash (was Re: [Pharo-users] XMLOrderedList Concantenation)

Eliot Miranda-2
 
Hi Ben,


On Mon, May 5, 2014 at 10:27 AM, Ben Coman <[hidden email]> wrote:
 
Just reporting, while looking into a query on [pharo-users] (which is attached for initial context only and can probably be deleted from any replies) I managed to crash the VM by evaluating the following in Workspace:

a := SequenceableCollection new.
a add: 1.
a , SequenceableCollection new.

What's the image, the OS and the VM version?
 

Now the interesting thing is that while the system becomes immediately sluggish, Pharo.exe crashes about 20 seconds later.

This is with Pharo 3.0 Release (30846) http://files.pharo.org/platform/Pharo3.0-win.zip (dated 2014-04-30)
on Windows Home Premium 64-bit SP1.

cheers -ben

Ben Coman wrote:

Thanks. That info made it much easier to try.  Sorry I didn't end up with an answer for you, but I confirm there is some issue here, or something new I can learn when other chip in.

Here is what I tried.

* Installed XMLParser (monty.58) from Configuration Browser in Pharo 3.

* Ran your code. Got the same error.

* From the call stack I observed that XMLOrderedCollection(SequenceableCollection)>>copyReplaceFrom:to:with:
has the line "newSequenceableCollection := self species new: newSize." such that it seems your error might be reduced to the question of why the following two snippets fail:
    d := OrderedCollection new: 1.
    d at: 1 put: 1.

    e := OrderedCollection new: 3.
    e at: 2 put: 1.

However I'm sorry that is beyond my knowledge, and I'm hoping someone else can chip in so I can learn something.

Pushing on, I noticed that XMLOrderedList has an instance variable /collection/ which holds the OrderedCollection.

Now I wonder (without great experience and hoping to learn something) if it smells funny that XMLOrderedList inherits all of SequencableCollection methods that can not operate on /collection/.

I noticed that XMLOrderedList was using an inherited SequenceableCollection>>copyReplaceFrom:to:with
while OrderedCollection overrode that method with its own. So taking inspiration XMLOrderedList>>copyFrom:to: to override SequencableCollection>>copyReplaceFrom:to:with: to work with /collection/
seems to solve your problem:
    XMLOrderedList>>copyReplaceFrom: start to: stop with: replacementCollection
        ^ self newWithCollection:
            (collection copyReplaceFrom: start to: stop with: replacementCollection )


Along the way I noticed a few (possible) bugs that seems not related to your problem:

* When stepping through XMLOrderedList>>setCollection:
there is a red-box-of-death for the instance variables, which can be solved by defining the following.
    XMLOrderedList>>size
        ^ collection ifNil: [ 0 ] ifNotNil: [ collection size]

* In the debugger the /collection/ instance variable is not shown! (e.g. line XMLOrderedList>>at:put:).
Can someone confirm this should show?

HTH
cheers -ben

Thushar G R wrote:
XMLOrderedList belongs to package XML-Parser-Nodes.

a := XMLOrderedList new.
a add:'1'.
a , XMLOrderedList new.

Here select all and Do it. On line 3 (a , XMLOrderedList new.)  i am expected to get a copy of 'a' , but instead it throws an error SubscriptOutOfBounds. 




OrderedCollection(Object)>>errorSubscriptBounds:
OrderedCollection>>ensureBoundsFrom:to:
OrderedCollection>>at:put:
OrderedCollection(SequenceableCollection)>>replaceFrom:to:with:startingAt:
XMLOrderedList>>replaceFrom:to:with:startingAt:
XMLOrderedList(SequenceableCollection)>>copyReplaceFrom:to:with:
XMLOrderedList(SequenceableCollection)>>,
UndefinedObject>>DoIt
OpalCompiler>>evaluate
SmalltalkEditor>>evaluateSelectionAndDo:
PluggableTextMorph>>inspectIt in Block: [ textMorph editor evaluateSelectionAndDo: [ :resu...etc...
PluggableTextMorph>>handleEdit: in Block: [ result := editBlock value ]
TextMorphForEditView(TextMorph)>>handleEdit:
PluggableTextMorph>>handleEdit:
PluggableTextMorph>>inspectIt
SmalltalkEditor class>>buildSmalltalkEditorKeymappingsOn: in Block: [ :morph | morph inspectIt ]
BlockClosure>>cull:
BlockClosure>>cull:cull:
BlockClosure>>cull:cull:cull:
KMCategoryBinding>>completeMatch:buffer:
KMKeymap>>notifyCompleteMatchTo:buffer: in Block: [ :l | l completeMatch: self buffer: aBuffer ]
Array(SequenceableCollection)>>do:
KMKeymap>>notifyCompleteMatchTo:buffer:
KMKeymap>>onMatchWith:notify:andDo:
KMCategory>>onMatchWith:notify:andDo: in Block: [ :entry | entry onMatchWith: anEventBuffer notify...etc...
Set>>do:
KMCategory>>onMatchWith:notify:andDo:
KMCategoryBinding>>verifyMatchWith:notifying:thenDoing:
KMDispatcher>>dispatch: in Block: [ :aTarget | ...
OrderedCollection>>do:


Plese refer to the above stack.

Thanks in advance.

thushar


On Mon, May 5, 2014 at 6:28 PM, Ben Coman <[hidden email]> wrote:
Thushar G R wrote:
Hi,

I am getting an error while doing this.

a := XMLOrderedList new.
a add:'1'.
a , XMLOrderedList new.

Thanks,

Thushar
I could give you "an answer" ;) - but it would be what you wanted.  It would help if you told what the error was, where it occurs (which of the three lines), and what you expect each line is doing (especially the third line).

Also I don't see XMLOrderedList in the default Pharo image, so it would help if you describe where you got that from and how you installed it.

cheers -ben








--
best,
Eliot
Reply | Threaded
Open this post in threaded view
|

Re: SequenceableCollection VM crash (was Re: [Pharo-users] XMLOrderedList Concantenation)

Nicolas Cellier
In reply to this post by Ben Coman
 



2014-05-05 19:27 GMT+02:00 Ben Coman <[hidden email]>:
 
Just reporting, while looking into a query on [pharo-users] (which is attached for initial context only and can probably be deleted from any replies) I managed to crash the VM by evaluating the following in Workspace:

a := SequenceableCollection new.
a add: 1.
a , SequenceableCollection new.

Now the interesting thing is that while the system becomes immediately sluggish, Pharo.exe crashes about 20 seconds later.

This is with Pharo 3.0 Release (30846) http://files.pharo.org/platform/Pharo3.0-win.zip (dated 2014-04-30)
on Windows Home Premium 64-bit SP1.

cheers -ben


SequenceableCollection is supposed to be abstract.
above code causes an infinite loop because size is implemented in terms of do: and do: sends size.
 
Ben Coman wrote:

Thanks. That info made it much easier to try.  Sorry I didn't end up with an answer for you, but I confirm there is some issue here, or something new I can learn when other chip in.

Here is what I tried.

* Installed XMLParser (monty.58) from Configuration Browser in Pharo 3.

* Ran your code. Got the same error.

* From the call stack I observed that XMLOrderedCollection(SequenceableCollection)>>copyReplaceFrom:to:with:
has the line "newSequenceableCollection := self species new: newSize." such that it seems your error might be reduced to the question of why the following two snippets fail:
    d := OrderedCollection new: 1.
    d at: 1 put: 1.

    e := OrderedCollection new: 3.
    e at: 2 put: 1.

However I'm sorry that is beyond my knowledge, and I'm hoping someone else can chip in so I can learn something.

Pushing on, I noticed that XMLOrderedList has an instance variable /collection/ which holds the OrderedCollection.

Now I wonder (without great experience and hoping to learn something) if it smells funny that XMLOrderedList inherits all of SequencableCollection methods that can not operate on /collection/.

I noticed that XMLOrderedList was using an inherited SequenceableCollection>>copyReplaceFrom:to:with
while OrderedCollection overrode that method with its own. So taking inspiration XMLOrderedList>>copyFrom:to: to override SequencableCollection>>copyReplaceFrom:to:with: to work with /collection/
seems to solve your problem:
    XMLOrderedList>>copyReplaceFrom: start to: stop with: replacementCollection
        ^ self newWithCollection:
            (collection copyReplaceFrom: start to: stop with: replacementCollection )


Along the way I noticed a few (possible) bugs that seems not related to your problem:

* When stepping through XMLOrderedList>>setCollection:
there is a red-box-of-death for the instance variables, which can be solved by defining the following.
    XMLOrderedList>>size
        ^ collection ifNil: [ 0 ] ifNotNil: [ collection size]

* In the debugger the /collection/ instance variable is not shown! (e.g. line XMLOrderedList>>at:put:).
Can someone confirm this should show?

HTH
cheers -ben

Thushar G R wrote:
XMLOrderedList belongs to package XML-Parser-Nodes.

a := XMLOrderedList new.
a add:'1'.
a , XMLOrderedList new.

Here select all and Do it. On line 3 (a , XMLOrderedList new.)  i am expected to get a copy of 'a' , but instead it throws an error SubscriptOutOfBounds. 




OrderedCollection(Object)>>errorSubscriptBounds:
OrderedCollection>>ensureBoundsFrom:to:
OrderedCollection>>at:put:
OrderedCollection(SequenceableCollection)>>replaceFrom:to:with:startingAt:
XMLOrderedList>>replaceFrom:to:with:startingAt:
XMLOrderedList(SequenceableCollection)>>copyReplaceFrom:to:with:
XMLOrderedList(SequenceableCollection)>>,
UndefinedObject>>DoIt
OpalCompiler>>evaluate
SmalltalkEditor>>evaluateSelectionAndDo:
PluggableTextMorph>>inspectIt in Block: [ textMorph editor evaluateSelectionAndDo: [ :resu...etc...
PluggableTextMorph>>handleEdit: in Block: [ result := editBlock value ]
TextMorphForEditView(TextMorph)>>handleEdit:
PluggableTextMorph>>handleEdit:
PluggableTextMorph>>inspectIt
SmalltalkEditor class>>buildSmalltalkEditorKeymappingsOn: in Block: [ :morph | morph inspectIt ]
BlockClosure>>cull:
BlockClosure>>cull:cull:
BlockClosure>>cull:cull:cull:
KMCategoryBinding>>completeMatch:buffer:
KMKeymap>>notifyCompleteMatchTo:buffer: in Block: [ :l | l completeMatch: self buffer: aBuffer ]
Array(SequenceableCollection)>>do:
KMKeymap>>notifyCompleteMatchTo:buffer:
KMKeymap>>onMatchWith:notify:andDo:
KMCategory>>onMatchWith:notify:andDo: in Block: [ :entry | entry onMatchWith: anEventBuffer notify...etc...
Set>>do:
KMCategory>>onMatchWith:notify:andDo:
KMCategoryBinding>>verifyMatchWith:notifying:thenDoing:
KMDispatcher>>dispatch: in Block: [ :aTarget | ...
OrderedCollection>>do:


Plese refer to the above stack.

Thanks in advance.

thushar


On Mon, May 5, 2014 at 6:28 PM, Ben Coman <[hidden email]> wrote:
Thushar G R wrote:
Hi,

I am getting an error while doing this.

a := XMLOrderedList new.
a add:'1'.
a , XMLOrderedList new.

Thanks,

Thushar
I could give you "an answer" ;) - but it would be what you wanted.  It would help if you told what the error was, where it occurs (which of the three lines), and what you expect each line is doing (especially the third line).

Also I don't see XMLOrderedList in the default Pharo image, so it would help if you describe where you got that from and how you installed it.

cheers -ben






Reply | Threaded
Open this post in threaded view
|

Re: SequenceableCollection VM crash (was Re: [Pharo-users] XMLOrderedList Concantenation)

Nicolas Cellier
 



2014-05-05 19:53 GMT+02:00 Nicolas Cellier <[hidden email]>:



2014-05-05 19:27 GMT+02:00 Ben Coman <[hidden email]>:
 
Just reporting, while looking into a query on [pharo-users] (which is attached for initial context only and can probably be deleted from any replies) I managed to crash the VM by evaluating the following in Workspace:

a := SequenceableCollection new.
a add: 1.
a , SequenceableCollection new.

Now the interesting thing is that while the system becomes immediately sluggish, Pharo.exe crashes about 20 seconds later.

This is with Pharo 3.0 Release (30846) http://files.pharo.org/platform/Pharo3.0-win.zip (dated 2014-04-30)
on Windows Home Premium 64-bit SP1.

cheers -ben


SequenceableCollection is supposed to be abstract.
above code causes an infinite loop because size is implemented in terms of do: and do: sends size.

Note that the VM terminates with an out of memory, but it seems that the infinite loop is triggered while logging the debugger call stack in a file, and this logging seems to be performed in background now, thus the sluggish behavior.

 
Ben Coman wrote:

Thanks. That info made it much easier to try.  Sorry I didn't end up with an answer for you, but I confirm there is some issue here, or something new I can learn when other chip in.

Here is what I tried.

* Installed XMLParser (monty.58) from Configuration Browser in Pharo 3.

* Ran your code. Got the same error.

* From the call stack I observed that XMLOrderedCollection(SequenceableCollection)>>copyReplaceFrom:to:with:
has the line "newSequenceableCollection := self species new: newSize." such that it seems your error might be reduced to the question of why the following two snippets fail:
    d := OrderedCollection new: 1.
    d at: 1 put: 1.

    e := OrderedCollection new: 3.
    e at: 2 put: 1.

However I'm sorry that is beyond my knowledge, and I'm hoping someone else can chip in so I can learn something.

Pushing on, I noticed that XMLOrderedList has an instance variable /collection/ which holds the OrderedCollection.

Now I wonder (without great experience and hoping to learn something) if it smells funny that XMLOrderedList inherits all of SequencableCollection methods that can not operate on /collection/.

I noticed that XMLOrderedList was using an inherited SequenceableCollection>>copyReplaceFrom:to:with
while OrderedCollection overrode that method with its own. So taking inspiration XMLOrderedList>>copyFrom:to: to override SequencableCollection>>copyReplaceFrom:to:with: to work with /collection/
seems to solve your problem:
    XMLOrderedList>>copyReplaceFrom: start to: stop with: replacementCollection
        ^ self newWithCollection:
            (collection copyReplaceFrom: start to: stop with: replacementCollection )


Along the way I noticed a few (possible) bugs that seems not related to your problem:

* When stepping through XMLOrderedList>>setCollection:
there is a red-box-of-death for the instance variables, which can be solved by defining the following.
    XMLOrderedList>>size
        ^ collection ifNil: [ 0 ] ifNotNil: [ collection size]

* In the debugger the /collection/ instance variable is not shown! (e.g. line XMLOrderedList>>at:put:).
Can someone confirm this should show?

HTH
cheers -ben

Thushar G R wrote:
XMLOrderedList belongs to package XML-Parser-Nodes.

a := XMLOrderedList new.
a add:'1'.
a , XMLOrderedList new.

Here select all and Do it. On line 3 (a , XMLOrderedList new.)  i am expected to get a copy of 'a' , but instead it throws an error SubscriptOutOfBounds. 




OrderedCollection(Object)>>errorSubscriptBounds:
OrderedCollection>>ensureBoundsFrom:to:
OrderedCollection>>at:put:
OrderedCollection(SequenceableCollection)>>replaceFrom:to:with:startingAt:
XMLOrderedList>>replaceFrom:to:with:startingAt:
XMLOrderedList(SequenceableCollection)>>copyReplaceFrom:to:with:
XMLOrderedList(SequenceableCollection)>>,
UndefinedObject>>DoIt
OpalCompiler>>evaluate
SmalltalkEditor>>evaluateSelectionAndDo:
PluggableTextMorph>>inspectIt in Block: [ textMorph editor evaluateSelectionAndDo: [ :resu...etc...
PluggableTextMorph>>handleEdit: in Block: [ result := editBlock value ]
TextMorphForEditView(TextMorph)>>handleEdit:
PluggableTextMorph>>handleEdit:
PluggableTextMorph>>inspectIt
SmalltalkEditor class>>buildSmalltalkEditorKeymappingsOn: in Block: [ :morph | morph inspectIt ]
BlockClosure>>cull:
BlockClosure>>cull:cull:
BlockClosure>>cull:cull:cull:
KMCategoryBinding>>completeMatch:buffer:
KMKeymap>>notifyCompleteMatchTo:buffer: in Block: [ :l | l completeMatch: self buffer: aBuffer ]
Array(SequenceableCollection)>>do:
KMKeymap>>notifyCompleteMatchTo:buffer:
KMKeymap>>onMatchWith:notify:andDo:
KMCategory>>onMatchWith:notify:andDo: in Block: [ :entry | entry onMatchWith: anEventBuffer notify...etc...
Set>>do:
KMCategory>>onMatchWith:notify:andDo:
KMCategoryBinding>>verifyMatchWith:notifying:thenDoing:
KMDispatcher>>dispatch: in Block: [ :aTarget | ...
OrderedCollection>>do:


Plese refer to the above stack.

Thanks in advance.

thushar


On Mon, May 5, 2014 at 6:28 PM, Ben Coman <[hidden email]> wrote:
Thushar G R wrote:
Hi,

I am getting an error while doing this.

a := XMLOrderedList new.
a add:'1'.
a , XMLOrderedList new.

Thanks,

Thushar
I could give you "an answer" ;) - but it would be what you wanted.  It would help if you told what the error was, where it occurs (which of the three lines), and what you expect each line is doing (especially the third line).

Also I don't see XMLOrderedList in the default Pharo image, so it would help if you describe where you got that from and how you installed it.

cheers -ben







Reply | Threaded
Open this post in threaded view
|

Re: SequenceableCollection VM crash (was Re: [Pharo-users] XMLOrderedList Concantenation)

Ben Coman
 
Thanks for the explanation Nicolas.  I thought maybe it was something like that, and should have said I didn't necessarily consider it a bug, but its good to get that confirmation.

Eliot wrote:
> What's the image, the OS and the VM version?

The referenced zip [1]  has image and VM packaged together.

* Image = Pharo3.0 Latest update: #30846 Unnamed

* VM = NBCoInterpreter NativeBoost-CogPlugin-GuillermoPolito.19 uuid: acc98e51-2fba-4841-a965-2975997bba66 Dec  7 2013
NBCogit NativeBoost-CogPlugin-GuillermoPolito.19 uuid: acc98e51-2fba-4841-a965-2975997bba66 Dec  7 2013
https://github.com/pharo-project/pharo-vm.git Commit: 71adca113a9aff2876288927e5c1c86bf7ac13e2 Date: 2013-12-07 05:00:47 -0800 By: Philippe Back [hidden email] Jenkins build #14776

* OS = Windows 7 Home Premium 64-bit SP1

[1] http://files.pharo.org/platform/Pharo3.0-win.zip

cheers -ben

Nicolas Cellier wrote:
 





2014-05-05 19:53 GMT+02:00 Nicolas Cellier <[hidden email]>:



2014-05-05 19:27 GMT+02:00 Ben Coman <[hidden email]>:
 
Just reporting, while looking into a query on [pharo-users] (which is attached for initial context only and can probably be deleted from any replies) I managed to crash the VM by evaluating the following in Workspace:

a := SequenceableCollection new.
a add: 1.
a , SequenceableCollection new.

Now the interesting thing is that while the system becomes immediately sluggish, Pharo.exe crashes about 20 seconds later.

This is with Pharo 3.0 Release (30846) http://files.pharo.org/platform/Pharo3.0-win.zip (dated 2014-04-30)
on Windows Home Premium 64-bit SP1.

cheers -ben


SequenceableCollection is supposed to be abstract.
above code causes an infinite loop because size is implemented in terms of do: and do: sends size.

Note that the VM terminates with an out of memory, but it seems that the infinite loop is triggered while logging the debugger call stack in a file, and this logging seems to be performed in background now, thus the sluggish behavior.

 
Ben Coman wrote:

Thanks. That info made it much easier to try.  Sorry I didn't end up with an answer for you, but I confirm there is some issue here, or something new I can learn when other chip in.

Here is what I tried.

* Installed XMLParser (monty.58) from Configuration Browser in Pharo 3.

* Ran your code. Got the same error.

* From the call stack I observed that XMLOrderedCollection(SequenceableCollection)>>copyReplaceFrom:to:with:
has the line "newSequenceableCollection := self species new: newSize." such that it seems your error might be reduced to the question of why the following two snippets fail:
    d := OrderedCollection new: 1.
    d at: 1 put: 1.

    e := OrderedCollection new: 3.
    e at: 2 put: 1.

However I'm sorry that is beyond my knowledge, and I'm hoping someone else can chip in so I can learn something.

Pushing on, I noticed that XMLOrderedList has an instance variable /collection/ which holds the OrderedCollection.

Now I wonder (without great experience and hoping to learn something) if it smells funny that XMLOrderedList inherits all of SequencableCollection methods that can not operate on /collection/.

I noticed that XMLOrderedList was using an inherited SequenceableCollection>>copyReplaceFrom:to:with
while OrderedCollection overrode that method with its own. So taking inspiration XMLOrderedList>>copyFrom:to: to override SequencableCollection>>copyReplaceFrom:to:with: to work with /collection/
seems to solve your problem:
    XMLOrderedList>>copyReplaceFrom: start to: stop with: replacementCollection
        ^ self newWithCollection:
            (collection copyReplaceFrom: start to: stop with: replacementCollection )


Along the way I noticed a few (possible) bugs that seems not related to your problem:

* When stepping through XMLOrderedList>>setCollection:
there is a red-box-of-death for the instance variables, which can be solved by defining the following.
    XMLOrderedList>>size
        ^ collection ifNil: [ 0 ] ifNotNil: [ collection size]

* In the debugger the /collection/ instance variable is not shown! (e.g. line XMLOrderedList>>at:put:).
Can someone confirm this should show?

HTH
cheers -ben

Thushar G R wrote:
XMLOrderedList belongs to package XML-Parser-Nodes.

a := XMLOrderedList new.
a add:'1'.
a , XMLOrderedList new.

Here select all and Do it. On line 3 (a , XMLOrderedList new.)  i am expected to get a copy of 'a' , but instead it throws an error SubscriptOutOfBounds. 




OrderedCollection(Object)>>errorSubscriptBounds:
OrderedCollection>>ensureBoundsFrom:to:
OrderedCollection>>at:put:
OrderedCollection(SequenceableCollection)>>replaceFrom:to:with:startingAt:
XMLOrderedList>>replaceFrom:to:with:startingAt:
XMLOrderedList(SequenceableCollection)>>copyReplaceFrom:to:with:
XMLOrderedList(SequenceableCollection)>>,
UndefinedObject>>DoIt
OpalCompiler>>evaluate
SmalltalkEditor>>evaluateSelectionAndDo:
PluggableTextMorph>>inspectIt in Block: [ textMorph editor evaluateSelectionAndDo: [ :resu...etc...
PluggableTextMorph>>handleEdit: in Block: [ result := editBlock value ]
TextMorphForEditView(TextMorph)>>handleEdit:
PluggableTextMorph>>handleEdit:
PluggableTextMorph>>inspectIt
SmalltalkEditor class>>buildSmalltalkEditorKeymappingsOn: in Block: [ :morph | morph inspectIt ]
BlockClosure>>cull:
BlockClosure>>cull:cull:
BlockClosure>>cull:cull:cull:
KMCategoryBinding>>completeMatch:buffer:
KMKeymap>>notifyCompleteMatchTo:buffer: in Block: [ :l | l completeMatch: self buffer: aBuffer ]
Array(SequenceableCollection)>>do:
KMKeymap>>notifyCompleteMatchTo:buffer:
KMKeymap>>onMatchWith:notify:andDo:
KMCategory>>onMatchWith:notify:andDo: in Block: [ :entry | entry onMatchWith: anEventBuffer notify...etc...
Set>>do:
KMCategory>>onMatchWith:notify:andDo:
KMCategoryBinding>>verifyMatchWith:notifying:thenDoing:
KMDispatcher>>dispatch: in Block: [ :aTarget | ...
OrderedCollection>>do:


Plese refer to the above stack.

Thanks in advance.

thushar


On Mon, May 5, 2014 at 6:28 PM, Ben Coman <[hidden email]> wrote:
Thushar G R wrote:
Hi,

I am getting an error while doing this.

a := XMLOrderedList new.
a add:'1'.
a , XMLOrderedList new.

Thanks,

Thushar
I could give you "an answer" ;) - but it would be what you wanted.  It would help if you told what the error was, where it occurs (which of the three lines), and what you expect each line is doing (especially the third line).

Also I don't see XMLOrderedList in the default Pharo image, so it would help if you describe where you got that from and how you installed it.

cheers -ben