Crash on start-up.

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

Crash on start-up.

Michael van der Gulik-2
 

Hi VM guys.

Does anybody have any insights into the following?:

I get the following crash. I've tried this on a Windows VM of unknown version and a 3.9-alpha Linux VM with the same result:

Segmentation fault

-1528952856 [] in Semaphore>critical:
-1528953680 BlockContext>ensure:
-1528953772 Semaphore>critical:
-1528953864 >clearExternalObjects
-1528953956 SystemDictionary>clearExternalObjects
-1529116848 SmalltalkImage>snapshot:andQuit:embedded:
-1529116940 SmalltalkImage>snapshot:andQuit:
-1529117032 TheWorldMenu>saveAndQuit
-1529117216 TheWorldMenu>doMenuItem:with:
-1529117308 [] in MenuItemMorph>invokeWithEvent:
-1529117400 BlockContext>ensure:
-1529117492 Cursor>showWhile:
-1529117712 MenuItemMorph>invokeWithEvent:
-1529117804 MenuItemMorph>mouseUp:
-1529117896 MenuItemMorph>handleMouseUp:
-1529118028 MouseButtonEvent>sentTo:
-1529118120 Morph>handleEvent:
-1529118212 MorphicEventDispatcher>dispatchDefault:with:
-1529118304 MorphicEventDispatcher>dispatchEvent:with:
-1529118396 Morph>processEvent:using:
-1529118488 MorphicEventDispatcher>dispatchDefault:with:
-1529118596 MorphicEventDispatcher>dispatchEvent:with:
-1529118728 Morph>processEvent:using:
-1529118820 Morph>processEvent:
-1529118912 MenuMorph>handleFocusEvent:
-1529119188 [] in HandMorph>sendFocusEvent:to:clear:
-1529119096 [] in PasteUpMorph>becomeActiveDuring:
-1529119280 BlockContext>on:do:
-1529119372 PasteUpMorph>becomeActiveDuring:
-1529119556 HandMorph>sendFocusEvent:to:clear:
-1529119648 HandMorph>sendEvent:focus:clear:
-1529119740 HandMorph>sendMouseEvent:
-1529119884 HandMorph>handleEvent:
-1529120168 HandMorph>processEvents
-1529120076 [] in WorldState>doOneCycleNowFor:
-1529120260 SequenceableCollection>do:
-1529120352 WorldState>handsDo:
-1529120444 WorldState>doOneCycleNowFor:
-1529120536 WorldState>doOneCycleFor:
-1529120628 PasteUpMorph>doOneCycle
-1529214452 [] in >spawnNewProcess
-1529214268 [] in BlockContext>newProcess
Segmentation fault (core dumped)

This happens on start-up. None of the VM flags I tried make a difference.

I suspect this may have caused it:

!EventSensor methodsFor: 'as yet unclassified' stamp: 'mvdg 3/17/2009 21:54' prior: 36505616!
startUp
 [
  panicButtonPressed := false.

  Smalltalk.Sensor shutDown.
  inputSemaphore := Semaphore new.
  Smalltalk.ExternalSemaphoreTable registerExternalObject: inputSemaphore.
  self primSetInputSemaphore: inputSemaphore.

  self enterEventLoop.
 ] ensure: [
  Smalltalk.Sensor startUp. 
  Smalltalk.Display restore.
 ].! !

This code worked fine until I saved, quit and tried to reopen the image.

Note that this class is actually defined in my namespaces implementation - it does not exist in the SystemDictionary and has it's environment set to an instance of Namespace. It is my own implementation of EventSensor and I've added the primitive methods to it. I'm not sure if any of this matters.

I'm going to put this image aside rather than try to fix the above and make a new image so I can continue my work. This problem will continue to exist, however, so if I have any breakthroughs as to what is happening, I'll post a reply.

Gulik.

--
http://gulik.pbwiki.com/
Reply | Threaded
Open this post in threaded view
|

Re: Crash on start-up.

Eliot Miranda-2
 

when you run it on linux under gdb what's teh stack trace for the seg fault?

On Wed, Mar 18, 2009 at 12:49 AM, Michael van der Gulik <[hidden email]> wrote:
 

Hi VM guys.

Does anybody have any insights into the following?:

I get the following crash. I've tried this on a Windows VM of unknown version and a 3.9-alpha Linux VM with the same result:

Segmentation fault

-1528952856 [] in Semaphore>critical:
-1528953680 BlockContext>ensure:
-1528953772 Semaphore>critical:
-1528953864 >clearExternalObjects
-1528953956 SystemDictionary>clearExternalObjects
-1529116848 SmalltalkImage>snapshot:andQuit:embedded:
-1529116940 SmalltalkImage>snapshot:andQuit:
-1529117032 TheWorldMenu>saveAndQuit
-1529117216 TheWorldMenu>doMenuItem:with:
-1529117308 [] in MenuItemMorph>invokeWithEvent:
-1529117400 BlockContext>ensure:
-1529117492 Cursor>showWhile:
-1529117712 MenuItemMorph>invokeWithEvent:
-1529117804 MenuItemMorph>mouseUp:
-1529117896 MenuItemMorph>handleMouseUp:
-1529118028 MouseButtonEvent>sentTo:
-1529118120 Morph>handleEvent:
-1529118212 MorphicEventDispatcher>dispatchDefault:with:
-1529118304 MorphicEventDispatcher>dispatchEvent:with:
-1529118396 Morph>processEvent:using:
-1529118488 MorphicEventDispatcher>dispatchDefault:with:
-1529118596 MorphicEventDispatcher>dispatchEvent:with:
-1529118728 Morph>processEvent:using:
-1529118820 Morph>processEvent:
-1529118912 MenuMorph>handleFocusEvent:
-1529119188 [] in HandMorph>sendFocusEvent:to:clear:
-1529119096 [] in PasteUpMorph>becomeActiveDuring:
-1529119280 BlockContext>on:do:
-1529119372 PasteUpMorph>becomeActiveDuring:
-1529119556 HandMorph>sendFocusEvent:to:clear:
-1529119648 HandMorph>sendEvent:focus:clear:
-1529119740 HandMorph>sendMouseEvent:
-1529119884 HandMorph>handleEvent:
-1529120168 HandMorph>processEvents
-1529120076 [] in WorldState>doOneCycleNowFor:
-1529120260 SequenceableCollection>do:
-1529120352 WorldState>handsDo:
-1529120444 WorldState>doOneCycleNowFor:
-1529120536 WorldState>doOneCycleFor:
-1529120628 PasteUpMorph>doOneCycle
-1529214452 [] in >spawnNewProcess
-1529214268 [] in BlockContext>newProcess
Segmentation fault (core dumped)

This happens on start-up. None of the VM flags I tried make a difference.

I suspect this may have caused it:

!EventSensor methodsFor: 'as yet unclassified' stamp: 'mvdg 3/17/2009 21:54' prior: 36505616!
startUp
 [
  panicButtonPressed := false.

  Smalltalk.Sensor shutDown.
  inputSemaphore := Semaphore new.
  Smalltalk.ExternalSemaphoreTable registerExternalObject: inputSemaphore.
  self primSetInputSemaphore: inputSemaphore.

  self enterEventLoop.
 ] ensure: [
  Smalltalk.Sensor startUp. 
  Smalltalk.Display restore.
 ].! !

This code worked fine until I saved, quit and tried to reopen the image.

Note that this class is actually defined in my namespaces implementation - it does not exist in the SystemDictionary and has it's environment set to an instance of Namespace. It is my own implementation of EventSensor and I've added the primitive methods to it. I'm not sure if any of this matters.

I'm going to put this image aside rather than try to fix the above and make a new image so I can continue my work. This problem will continue to exist, however, so if I have any breakthroughs as to what is happening, I'll post a reply.

Gulik.

--
http://gulik.pbwiki.com/


Reply | Threaded
Open this post in threaded view
|

Re: Crash on start-up.

Michael van der Gulik-2
 
I'll build a VM with debugging symbols this weekend if I can remember where I stashed my VM source.

I've rebuilt a working image, so hopefully I should be able to recreate the problem easily.

Gulik.

On Thu, Mar 19, 2009 at 4:27 AM, Eliot Miranda <[hidden email]> wrote:
 

when you run it on linux under gdb what's teh stack trace for the seg fault?

On Wed, Mar 18, 2009 at 12:49 AM, Michael van der Gulik <[hidden email]> wrote:
 

Hi VM guys.

Does anybody have any insights into the following?:

I get the following crash. I've tried this on a Windows VM of unknown version and a 3.9-alpha Linux VM with the same result:

Segmentation fault

-1528952856 [] in Semaphore>critical:
-1528953680 BlockContext>ensure:
-1528953772 Semaphore>critical:
-1528953864 >clearExternalObjects
-1528953956 SystemDictionary>clearExternalObjects
-1529116848 SmalltalkImage>snapshot:andQuit:embedded:
-1529116940 SmalltalkImage>snapshot:andQuit:
-1529117032 TheWorldMenu>saveAndQuit
-1529117216 TheWorldMenu>doMenuItem:with:
-1529117308 [] in MenuItemMorph>invokeWithEvent:
-1529117400 BlockContext>ensure:
-1529117492 Cursor>showWhile:
-1529117712 MenuItemMorph>invokeWithEvent:
-1529117804 MenuItemMorph>mouseUp:
-1529117896 MenuItemMorph>handleMouseUp:
-1529118028 MouseButtonEvent>sentTo:
-1529118120 Morph>handleEvent:
-1529118212 MorphicEventDispatcher>dispatchDefault:with:
-1529118304 MorphicEventDispatcher>dispatchEvent:with:
-1529118396 Morph>processEvent:using:
-1529118488 MorphicEventDispatcher>dispatchDefault:with:
-1529118596 MorphicEventDispatcher>dispatchEvent:with:
-1529118728 Morph>processEvent:using:
-1529118820 Morph>processEvent:
-1529118912 MenuMorph>handleFocusEvent:
-1529119188 [] in HandMorph>sendFocusEvent:to:clear:
-1529119096 [] in PasteUpMorph>becomeActiveDuring:
-1529119280 BlockContext>on:do:
-1529119372 PasteUpMorph>becomeActiveDuring:
-1529119556 HandMorph>sendFocusEvent:to:clear:
-1529119648 HandMorph>sendEvent:focus:clear:
-1529119740 HandMorph>sendMouseEvent:
-1529119884 HandMorph>handleEvent:
-1529120168 HandMorph>processEvents
-1529120076 [] in WorldState>doOneCycleNowFor:
-1529120260 SequenceableCollection>do:
-1529120352 WorldState>handsDo:
-1529120444 WorldState>doOneCycleNowFor:
-1529120536 WorldState>doOneCycleFor:
-1529120628 PasteUpMorph>doOneCycle
-1529214452 [] in >spawnNewProcess
-1529214268 [] in BlockContext>newProcess
Segmentation fault (core dumped)

This happens on start-up. None of the VM flags I tried make a difference.

I suspect this may have caused it:

!EventSensor methodsFor: 'as yet unclassified' stamp: 'mvdg 3/17/2009 21:54' prior: 36505616!
startUp
 [
  panicButtonPressed := false.

  Smalltalk.Sensor shutDown.
  inputSemaphore := Semaphore new.
  Smalltalk.ExternalSemaphoreTable registerExternalObject: inputSemaphore.
  self primSetInputSemaphore: inputSemaphore.

  self enterEventLoop.
 ] ensure: [
  Smalltalk.Sensor startUp. 
  Smalltalk.Display restore.
 ].! !

This code worked fine until I saved, quit and tried to reopen the image.

Note that this class is actually defined in my namespaces implementation - it does not exist in the SystemDictionary and has it's environment set to an instance of Namespace. It is my own implementation of EventSensor and I've added the primitive methods to it. I'm not sure if any of this matters.

I'm going to put this image aside rather than try to fix the above and make a new image so I can continue my work. This problem will continue to exist, however, so if I have any breakthroughs as to what is happening, I'll post a reply.

Gulik.

--
http://gulik.pbwiki.com/






--
http://gulik.pbwiki.com/
Reply | Threaded
Open this post in threaded view
|

Re: Crash on start-up.

Michael van der Gulik-2
 
<snip>

>>> Hi VM guys.
>>>
>>> Does anybody have any insights into the following?:
>>>
>>> I get the following crash. I've tried this on a Windows VM of unknown
>>> version and a 3.9-alpha Linux VM with the same result:
>>>
>>> Segmentation fault
>>> I suspect this may have caused it:
>>>
>>> !EventSensor methodsFor: 'as yet unclassified' stamp: 'mvdg 3/17/2009
>>> 21:54' prior: 36505616!
>>> startUp
>>>  [
>>>   panicButtonPressed := false.
>>>
>>>   Smalltalk.Sensor shutDown.
>>>   inputSemaphore := Semaphore new.
>>>   Smalltalk.ExternalSemaphoreTable registerExternalObject:
>>> inputSemaphore.
>>>   self primSetInputSemaphore: inputSemaphore.
>>>
>>>   self enterEventLoop.
>>>  ] ensure: [
>>>   Smalltalk.Sensor startUp.
>>>   Smalltalk.Display restore.
>>>  ].! !
>>>

gdb says:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1210165584 (LWP 21449)]
0x0807db94 in transferTo (aProc=599900164) at
/home/mikevdg/squeak/vmmaker/Squeak-3.9-7/platforms/unix/src/vm/interp.c:22468
22468                   tmp = longAt(((longAt((newProc +
BaseHeaderSize) + (SuspendedContextIndex << ShiftForWord))) +
BaseHeaderSize) + (MethodIndex << ShiftForWord));
(gdb) bt
#0  0x0807db94 in transferTo (aProc=599900164) at
/home/mikevdg/squeak/vmmaker/Squeak-3.9-7/platforms/unix/src/vm/interp.c:22468
#1  0x0807be70 in resume (aProcess=599900164) at
/home/mikevdg/squeak/vmmaker/Squeak-3.9-7/platforms/unix/src/vm/interp.c:21277
#2  0x0807da45 in synchronousSignal (aSemaphore=600188584) at
/home/mikevdg/squeak/vmmaker/Squeak-3.9-7/platforms/unix/src/vm/interp.c:22424
#3  0x08077859 in primitiveSignal () at
/home/mikevdg/squeak/vmmaker/Squeak-3.9-7/platforms/unix/src/vm/interp.c:18722
#4  0x08060ac6 in dispatchFunctionPointer (aFunctionPointer=0x80777a1)
at /home/mikevdg/squeak/vmmaker/Squeak-3.9-7/platforms/unix/src/vm/interp.c:3949
#5  0x080667cf in interpret () at
/home/mikevdg/squeak/vmmaker/Squeak-3.9-7/platforms/unix/src/vm/interp.c:7756
#6  0x0805d652 in main ()
(gdb) l
22463                   if ((longAt((newProc + BaseHeaderSize) +
(SuspendedContextIndex << ShiftForWord))) < foo->youngStart) {
22464                           beRootIfOld(longAt((newProc +
BaseHeaderSize) + (SuspendedContextIndex << ShiftForWord)));
22465                   }
22466                   foo->activeContext = longAt((newProc +
BaseHeaderSize) + (SuspendedContextIndex << ShiftForWord));
22467                   /* begin fetchContextRegisters: */
22468                   tmp = longAt(((longAt((newProc +
BaseHeaderSize) + (SuspendedContextIndex << ShiftForWord))) +
BaseHeaderSize) + (MethodIndex << ShiftForWord));
22469                   if ((tmp & 1)) {
22470                           tmp = longAt(((longAt((newProc +
BaseHeaderSize) + (SuspendedContextIndex << ShiftForWord))) +
BaseHeaderSize) + (HomeIndex << ShiftForWord));
22471                           if (tmp < foo->youngStart) {
22472                                   beRootIfOld(tmp);
(gdb) p newProc
$1 = 599900164

By my understanding, Interpreter>>fetchContextRegisters: is reading
from a corrupted method context when it changes processes (in
Semaphore>>critical:) . My next step would be to manually dissect that
context using gdb. I suspect this is related to start-up code somehow
which is changing processes before something is initialised (??).

I can recreate this problem very easily. If anybody is interested in
debugging this more, I can send you an image.

Otherwise I'll report this on bugs.squeak.org assigned to myself and
hack at it again when it annoys me enough.

Gulik.

--
http://gulik.pbwiki.com/
Reply | Threaded
Open this post in threaded view
|

Re: Crash on start-up.

Michael van der Gulik-2
 


On Sun, Mar 22, 2009 at 4:55 PM, Michael van der Gulik <[hidden email]> wrote:
<snip>
>>> Hi VM guys.
>>>
>>> Does anybody have any insights into the following?:

<bigger snip>

I've isolated the bug. To reproduce, do the following in a disposable image:

Sensor primSetInputSemaphore: (Semaphore new).

Save the image. Try to open it. It will crash.

http://bugs.squeak.org/view.php?id=7320

Gulik.

--

http://gulik.pbwiki.com/
Reply | Threaded
Open this post in threaded view
|

Re: Crash on start-up.

Igor Stasenko
 
2009/3/22 Michael van der Gulik <[hidden email]>:

>
>
>
> On Sun, Mar 22, 2009 at 4:55 PM, Michael van der Gulik <[hidden email]> wrote:
>>
>> <snip>
>> >>> Hi VM guys.
>> >>>
>> >>> Does anybody have any insights into the following?:
>
> <bigger snip>
>
> I've isolated the bug. To reproduce, do the following in a disposable image:
>
> Sensor primSetInputSemaphore: (Semaphore new).
>

self
        primSetInputSemaphore: (Smalltalk registerExternalObject: inputSemaphore).

> Save the image. Try to open it. It will crash.
>
> http://bugs.squeak.org/view.php?id=7320
>
> Gulik.
>
> --
>
> http://gulik.pbwiki.com/
>
>



--
Best regards,
Igor Stasenko AKA sig.
Reply | Threaded
Open this post in threaded view
|

Re: Crash on start-up.

Igor Stasenko

2009/3/22 Igor Stasenko <[hidden email]>:

> 2009/3/22 Michael van der Gulik <[hidden email]>:
>>
>>
>>
>> On Sun, Mar 22, 2009 at 4:55 PM, Michael van der Gulik <[hidden email]> wrote:
>>>
>>> <snip>
>>> >>> Hi VM guys.
>>> >>>
>>> >>> Does anybody have any insights into the following?:
>>
>> <bigger snip>
>>
>> I've isolated the bug. To reproduce, do the following in a disposable image:
>>
>> Sensor primSetInputSemaphore: (Semaphore new).
>>
>
> self
>        primSetInputSemaphore: (Smalltalk registerExternalObject: inputSemaphore).
>
That of couse is not excuse for VM crash, when you passing a semaphore
object intead of valid smallinteger index in external objects table.
It should check and fail if you do so.

>> Save the image. Try to open it. It will crash.
>>
>> http://bugs.squeak.org/view.php?id=7320
>>
>> Gulik.
>>
>> --
>>
>> http://gulik.pbwiki.com/
>>
>>
>
>
>
> --
> Best regards,
> Igor Stasenko AKA sig.
>



--
Best regards,
Igor Stasenko AKA sig.
Reply | Threaded
Open this post in threaded view
|

Re: Crash on start-up.

Michael van der Gulik-2
 


On Sun, Mar 22, 2009 at 11:40 PM, Igor Stasenko <[hidden email]> wrote:

2009/3/22 Igor Stasenko <[hidden email]>:
> 2009/3/22 Michael van der Gulik <[hidden email]>:
>>
>>
>>
>> On Sun, Mar 22, 2009 at 4:55 PM, Michael van der Gulik <[hidden email]> wrote:
>>>
>>> <snip>
>>> >>> Hi VM guys.
>>> >>>
>>> >>> Does anybody have any insights into the following?:
>>
>> <bigger snip>
>>
>> I've isolated the bug. To reproduce, do the following in a disposable image:
>>
>> Sensor primSetInputSemaphore: (Semaphore new).
>>
>
> self
>        primSetInputSemaphore: (Smalltalk registerExternalObject: inputSemaphore).
>
That of couse is not excuse for VM crash, when you passing a semaphore
object intead of valid smallinteger index in external objects table.
It should check and fail if you do so.

Thanks, Igor. I never was good at details.

When I next have time (Tuesday evening?) I'll submit a patch for this:

- rename primSetInputSemaphore: to primSetInputSemaphoreIndex:.
- Add checks in the VM: must be a SmallInteger, must be a valid index in the external objects table, must point to a Semaphore.
- Add error handling code in the method itself.

Gulik.

--
http://gulik.pbwiki.com/
Reply | Threaded
Open this post in threaded view
|

Re: Crash on start-up.

Michael van der Gulik-2
 
On 3/23/09, Michael van der Gulik <[hidden email]> wrote:

> When I next have time (Tuesday evening?) I'll submit a patch for this:
>
> - rename primSetInputSemaphore: to primSetInputSemaphoreIndex:.
> - Add checks in the VM: must be a SmallInteger, must be a valid index in
> the
> external objects table, must point to a Semaphore.
> - Add error handling code in the method itself.

I tried with some success, but now my compiled VM just starts up with
a black box in the top left, the rest of the screen is white and about
80% CPU is consumed. This is on Linux after accidently closing the
VMMaker window and reopening it.

Is this a common occurance that is easy to fix?

My attempt at fixing the input semaphore problem is attached to
http://bugs.squeak.org/view.php?id=7320, if anybody has interest. I
can't test it because of the above problem.

The original Interpreter>>primitiveInputSemaphore has problems. It
does not pop off the stack if the C code fails. "TheInputSemaphore" is
nil, and gets translated to "null" in interp.c.

Gulik.

--
http://gulik.pbwiki.com/
Reply | Threaded
Open this post in threaded view
|

Re: Crash on start-up.

Igor Stasenko
 
2009/3/23 Michael van der Gulik <[hidden email]>:

>
> On 3/23/09, Michael van der Gulik <[hidden email]> wrote:
>
>> When I next have time (Tuesday evening?) I'll submit a patch for this:
>>
>> - rename primSetInputSemaphore: to primSetInputSemaphoreIndex:.
>> - Add checks in the VM: must be a SmallInteger, must be a valid index in
>> the
>> external objects table, must point to a Semaphore.
>> - Add error handling code in the method itself.
>
> I tried with some success, but now my compiled VM just starts up with
> a black box in the top left, the rest of the screen is white and about
> 80% CPU is consumed. This is on Linux after accidently closing the
> VMMaker window and reopening it.
>
> Is this a common occurance that is easy to fix?

this is beyond my experience. I tried to build VM on linux only once,
and don't remember any serious problems with it.

>
> My attempt at fixing the input semaphore problem is attached to
> http://bugs.squeak.org/view.php?id=7320, if anybody has interest. I
> can't test it because of the above problem.
>
> The original Interpreter>>primitiveInputSemaphore has problems. It
> does not pop off the stack if the C code fails. "TheInputSemaphore" is
> nil, and gets translated to "null" in interp.c.
>

when primitive fails, it should keep the original stack state
unchanged, because it then used to enter a method, where primitive
located.

> Gulik.
>
> --
> http://gulik.pbwiki.com/
>



--
Best regards,
Igor Stasenko AKA sig.