Re: Stack Overflow

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

Re: Stack Overflow

Andreas Rosenberg
Hi everybody!

I recently ran into the same problem that was reported by Thomas
at the beginning of this year.

I added some debug code to the VM to examine the interrupt queue
and discovered that at a certain time the interrupt queue did
contain about 800 interrupts signaling a code cache cleared condition.

Later I discovered how this happened. Somebody wrote code, that
did a lot of become's while the interrupts were disabled.
Each send of #become: clears the code cache and puts a codeCacheCleared
interrupt into the queue.

You can easily reproduce the situation with a code like this:

| coll1 coll2 int |
coll1 := OrderedCollection new.
coll2 := OrderedCollection new.
1 to: 800 do: [ :i | coll1 add: i printString ].
1 to: 800 do: [ :j | coll2 add: j negated printString. ].
int := Process enableInterrupts: false.
1 to: 800 do: [ :x |
    (coll1 at: x) become: (coll2 at: x) ].
Process enableInterrupts: int.


As soon as interrupts are enabled, each method send will trigger
a pending interrupt to be processed.

But the method sends being performed during the #codeCacheCleared
interrupt will also examine the interrupt queue and so
all the queued interrupts will fill up the stack until a stack
overflow happens.

Regarding the situation of Thomas, I'm betting that some
String>>#at:put: with Asian characters are the reason for
a bunch of becomes.

May be I could shed some light on this matter.

Regards

   Andreas

Andreas Rosenberg | eMail: [hidden email]
APIS GmbH         | Phone: +49 9482 9415-0
Im Haslet 42      | Fax: +49 9482 9415-55
93086 Wörth/D     | WWW: <http://www.apis.de/>
Germany           | <http://www.fmea.de/>




-----Original Message-----
From: Using Visual Smalltalk for Windows/Enterprise
[mailto:[hidden email]]On Behalf Of Thomas Muhr
Sent: Montag, 18. Januar 2010 17:18
To: [hidden email]
Subject: Stack Overflow


Dear all,
does anyone know what is happening here and what could be the cause? The OS
is running as a DBCS (Taiwan).

Regards and happy new year!
- Thomas

ATLAS.ti 6.1.8  SC/DUR: 143 /27764
OS: Windows XP Home Edition Comp: ACER-244074A865 - Tuesday 2009-12-08
18:08:22
Active Window: ¹ï«Ý¥Á²³ vs Psy P'T ªº®t§O

Runtime error: Stack overflow

StackOverflowError(Exception)>>defaultAction
StackOverflowError(Exception)>>activateHandler: <anUndefinedObject>
StackOverflowError(Exception)>>handle
StackOverflowError(Exception)>>signal
StackOverflowError class(Exception class)>>signal
Process>>stackOverflow
Process class>>codeCacheClearedInterrupt
ProcessScheduler(Object)>>vmInterrupt: <#codeCacheClearedInterrupt>
ProcessScheduler>>codeCacheCleared
Process class>>codeCacheClearedInterrupt
ProcessScheduler(Object)>>vmInterrupt: <#codeCacheClearedInterrupt>
ProcessScheduler>>codeCacheCleared
Process class>>codeCacheClearedInterrupt
ProcessScheduler(Object)>>vmInterrupt: <#codeCacheClearedInterrupt>
ProcessScheduler>>codeCacheCleared
Process class>>codeCacheClearedInterrupt
ProcessScheduler(Object)>>vmInterrupt: <#codeCacheClearedInterrupt>
...


„Computers, like every technology, are a vehicle for the transformation of
tradition" (Winograd & Flores, 1987) ATLAS.ti Scientific Software
Development GmbH - Berlin - www.atlasti.com

***           this signature added by listserv             ***
*** Visit  http://www.listserv.dfn.de/archives/vswe-l.html ***
*** for archive browsing and VSWE-L membership management  ***

***           this signature added by listserv             ***
*** Visit  http://www.listserv.dfn.de/archives/vswe-l.html ***
*** for archive browsing and VSWE-L membership management  ***
Reply | Threaded
Open this post in threaded view
|

Re: Stack Overflow

Thomas Muhr
Andreas,
thanks for the hint. I just tried the code below and it did not produce an
error. I set the size to 2000 and it still worked.
Sometimes, NOT having a problem in VSE is almost as surprising...

Thomas

> -----Original Message-----
> From: Using Visual Smalltalk for Windows/Enterprise [mailto:VSWE-
> [hidden email]] On Behalf Of Andreas Rosenberg
> Sent: Donnerstag, 18. November 2010 16:14
> To: [hidden email]
> Subject: Re: Stack Overflow
>
> Hi everybody!
>
> I recently ran into the same problem that was reported by Thomas at the
> beginning of this year.
>
> I added some debug code to the VM to examine the interrupt queue and
> discovered that at a certain time the interrupt queue did contain about
800

> interrupts signaling a code cache cleared condition.
>
> Later I discovered how this happened. Somebody wrote code, that did a lot
> of become's while the interrupts were disabled.
> Each send of #become: clears the code cache and puts a codeCacheCleared
> interrupt into the queue.
>
> You can easily reproduce the situation with a code like this:
>
> | coll1 coll2 int |
> coll1 := OrderedCollection new.
> coll2 := OrderedCollection new.
> 1 to: 800 do: [ :i | coll1 add: i printString ].
> 1 to: 800 do: [ :j | coll2 add: j negated printString. ].
> int := Process enableInterrupts: false.
> 1 to: 800 do: [ :x |
>     (coll1 at: x) become: (coll2 at: x) ].
> Process enableInterrupts: int.
>
>
> As soon as interrupts are enabled, each method send will trigger a pending
> interrupt to be processed.
>
> But the method sends being performed during the #codeCacheCleared
> interrupt will also examine the interrupt queue and so all the queued
> interrupts will fill up the stack until a stack overflow happens.
>
> Regarding the situation of Thomas, I'm betting that some
> String>>#at:put: with Asian characters are the reason for
> a bunch of becomes.
>
> May be I could shed some light on this matter.
>
> Regards
>
>    Andreas
>
> Andreas Rosenberg | eMail: [hidden email]
> APIS GmbH         | Phone: +49 9482 9415-0
> Im Haslet 42      | Fax: +49 9482 9415-55
> 93086 Wörth/D     | WWW: <http://www.apis.de/>
> Germany           | <http://www.fmea.de/>
>
>
>
>
> -----Original Message-----
> From: Using Visual Smalltalk for Windows/Enterprise [mailto:VSWE-
> [hidden email]]On Behalf Of Thomas Muhr
> Sent: Montag, 18. Januar 2010 17:18
> To: [hidden email]
> Subject: Stack Overflow
>
>
> Dear all,
> does anyone know what is happening here and what could be the cause?
> The OS is running as a DBCS (Taiwan).
>
> Regards and happy new year!
> - Thomas
>
> ATLAS.ti 6.1.8  SC/DUR: 143 /27764
> OS: Windows XP Home Edition Comp: ACER-244074A865 - Tuesday 2009-12-
> 08
> 18:08:22
> Active Window: ¹ï«Ý¥Á²³ vs Psy P'T ªº®t§O
>
> Runtime error: Stack overflow
>
> StackOverflowError(Exception)>>defaultAction
> StackOverflowError(Exception)>>activateHandler: <anUndefinedObject>
> StackOverflowError(Exception)>>handle
> StackOverflowError(Exception)>>signal
> StackOverflowError class(Exception class)>>signal
> Process>>stackOverflow
> Process class>>codeCacheClearedInterrupt
> ProcessScheduler(Object)>>vmInterrupt: <#codeCacheClearedInterrupt>
> ProcessScheduler>>codeCacheCleared
> Process class>>codeCacheClearedInterrupt
> ProcessScheduler(Object)>>vmInterrupt: <#codeCacheClearedInterrupt>
> ProcessScheduler>>codeCacheCleared
> Process class>>codeCacheClearedInterrupt
> ProcessScheduler(Object)>>vmInterrupt: <#codeCacheClearedInterrupt>
> ProcessScheduler>>codeCacheCleared
> Process class>>codeCacheClearedInterrupt
> ProcessScheduler(Object)>>vmInterrupt: <#codeCacheClearedInterrupt> ...
>
>
> „Computers, like every technology, are a vehicle for the transformation of
> tradition" (Winograd & Flores, 1987) ATLAS.ti Scientific Software
> Development GmbH - Berlin - www.atlasti.com
>
> ***           this signature added by listserv             ***
> *** Visit  http://www.listserv.dfn.de/archives/vswe-l.html ***
> *** for archive browsing and VSWE-L membership management  ***
>
> ***           this signature added by listserv             ***
> *** Visit  http://www.listserv.dfn.de/archives/vswe-l.html ***
> *** for archive browsing and VSWE-L membership management  ***

***           this signature added by listserv             ***
*** Visit  http://www.listserv.dfn.de/archives/vswe-l.html ***
*** for archive browsing and VSWE-L membership management  ***