Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0007320 [Squeak] VM minor always 03-22-09 03:59 03-30-09 09:55
Reporter mikevdg View Status public  
Assigned To mikevdg
Priority normal Resolution open  
Status assigned   Product Version 3.9
Summary 0007320: Seg fault on image start-up; EventSensor suspected.
Description 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.

(mikevdg/gulik note to self: image in ~/dpon/subcanvas-crashes/. Email Gulik for this image.)
Additional Information
Attached Files  07320-inputSemaphore-fix.2.cs [^] (1,196 bytes) 03-30-09 09:52

- Relationships

- Notes
(0013057 - 118 - 142 - 142 - 142 - 142 - 142)
mikevdg
03-22-09 07:58

To recreate:

Sensor primSetInputSemaphore: (Semaphore new).
Save the image.
The image will then crash on loading.
 
(0013058 - 407 - 453 - 453 - 453 - 453 - 453)
mikevdg
03-22-09 20:36

primSetInputSemaphore: takes an index into the external objects table rather than a Semaphore. To quote a great contributer to modern culture: "Doh!".

Need to:

- 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.
 
(0013059 - 580 - 640 - 640 - 640 - 640 - 640)
mikevdg
03-23-09 09:01

Looking at VM source, primSetInputSemaphore: takes either an integer, Semaphore or any other object as arg. If any other object, the current value gets nilled.

Code in Interpreter>>primitiveInputSemaphore is broken; TheInputSemaphore is undefined. It was defined in Object>>initializeSpecialObjectIndices, but somebody has clobberred and re-used special object 22 for ProcessSignallingLowSpace.

C code also gives a jolly good hint in interp.c:
#define TheInputSemaphore null
(that can't be healthy).

ioSetInputSemaphore for Unix (sqUnixMain.c) fails if events disabled.
 
(0013060 - 182 - 182 - 182 - 182 - 182 - 182)
mikevdg
03-23-09 10:17

The attached changeset ( 07320-inputSemaphore-fix.2.cs) is my first attempt at fixing this, but my VM just stopped working. Somebody else will need to pick it up and see if it works.
 
(0013069 - 489 - 543 - 543 - 543 - 543 - 543)
mikevdg
03-30-09 09:55

This latest attachment has been tested by me.

Tests run (manually):
- Invoking with a newly registered Semaphore object in the external object array (works as expected).
- Invoking with a Symbol (fails as expected).
- Invoking with a Symbol in the external object array (works as expected).
- Filling the external objects array with a mixed combination of junk and Semaphores; the primitive works on the semaphores but not the junk.

Tests not run:
- Trying to use the Semaphore.
 

- Issue History
Date Modified Username Field Change
03-22-09 03:59 mikevdg New Issue
03-22-09 03:59 mikevdg Status new => assigned
03-22-09 03:59 mikevdg Assigned To  => tim
03-22-09 07:58 mikevdg Note Added: 0013057
03-22-09 07:59 mikevdg Assigned To tim => mikevdg
03-22-09 20:36 mikevdg Note Added: 0013058
03-23-09 09:01 mikevdg Note Added: 0013059
03-23-09 10:16 mikevdg File Added: 07320-inputSemaphore-fix.2.cs
03-23-09 10:17 mikevdg Note Added: 0013060
03-23-09 10:27 mikevdg File Deleted: 07320-inputSemaphore-fix.2.cs
03-23-09 10:27 mikevdg File Added: 07320-inputSemaphore-fix.2.cs
03-30-09 09:52 mikevdg File Deleted: 07320-inputSemaphore-fix.2.cs
03-30-09 09:52 mikevdg File Added: 07320-inputSemaphore-fix.2.cs
03-30-09 09:55 mikevdg Note Added: 0013069
03-30-09 13:07 lewis Issue Monitored: lewis


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