Semaphore>>critical:

Chris Muller asqueaker at gmail.com
Wed Jun 17 18:03:15 UTC 2009


Hi, I would just like to say I don't really consider this a bug as
much as a necessary inconvenience.  Some multi-Process Magma
applications need safe access to the MagmaSession, it was necessary to
move the critical sections higher-up, causing the UI to potentially
find itself immediately waiting on the process that was waiting (at
the front of the critical block) on the one that threw the debugger.

In particular, the potential inconvenience is that responding to a
MagmaWarning is more difficult; you have to press Alt+. to "gain
control", then either Proceed or Abort the warning, then Proceed the
other interrupted process waiting on the Mutex.

> But although control is returned, possibly there is still a deadlock
> preventing other operations too, like mail out a bug report.
> Actually
> to mail out the report below I've implemented a #semaphore getter in
> Mutex and (inside the debugger) from Mutex>>critical: select the owner
> instance variable and signal the semaphore.

I understand you wanted to stay in the debugger to send out the bug
report, but otherwise I recommend never to signal the semphore of a
Mutex.  It's always best to let the processes finish / unwind so that
the normal guarded execution is maintained.

 - Chris


On Tue, Jun 16, 2009 at 12:50 AM, Hernán Morales
Durand<hernan.morales at gmail.com> wrote:
> Hi Chris and others,
>
>  I'm using Squeak 3.11.2 (alpha) 27/3/2009 VM, Squeak 3.9-7067 and
> Magma r42Gamma3.
>  With the latest release of Magma, whenever a Debugger with a Magma
> exception is raised, control is not returned, and is necessary to
> press Alt + . to quit this situation. Doing this you will get a "User
> Interrupt" debugger window.
> But although control is returned, possibly there is still a deadlock
> preventing other operations too, like mail out a bug report. Actually
> to mail out the report below I've implemented a #semaphore getter in
> Mutex and (inside the debugger) from Mutex>>critical: select the owner
> instance variable and signal the semaphore.
>
> 16 June 2009 2:30:06 am
> VM: Win32 - a SmalltalkImage
> Image: Squeak3.9 [latest update: #7067]
>
> SecurityManager state:
> Restricted: false
> FileAccess: true
> SocketAccess: true
> Working Dir D:\OpusApp
> Trusted Dir D:\OpusApp\compu
> Untrusted Dir C:\Documents and Settings\compu\Mis documentos\My Squeak
>
> Semaphore>>critical:
>        Receiver: a Semaphore()
>        Arguments and temporary variables:
>                mutuallyExcludedBlock:  [] in Mutex>>critical: {[owner :=
> activeProcess.  aBlock...etc...
>                blockValue:     nil
>        Receiver's instance variables:
>                firstLink:      nil
>                lastLink:       nil
>                excessSignals:  1
>
> Mutex>>critical:
>        Receiver: a Mutex
>        Arguments and temporary variables:
>                aBlock:         [] in MagmaSession>>submit:to: {[aMagmaRepositoryRequest
> waitCursor   s...etc...
>                activeProcess:  a Process in Semaphore>>critical:
>        Receiver's instance variables:
>                semaphore:      a Semaphore()
>                owner:  a Process in Process>>suspend
>
> MagmaSession>>submit:to:
>        Receiver: a MagmaSession D:\OpusApp\Magma
>        Arguments and temporary variables:
>                aMagmaRepositoryRequest:        a MagmaPathNameRequest
>                aMaServerLink:  a MaLocalServerLink
>                didTry:         nil
>                link:   nil
>                result:         nil
>                err:    nil
>                node:   nil
>        Receiver's instance variables:
>                id:     an UUID('2caca4db-5f85-a546-a057-f7978a775e9c')
>                user:   a MagmaUser
>        id = Opus
>                serializer:     a MaObjectSerializer
>                transaction:    a MaTransaction
>                readStrategy:   a MaReadStrategy
>                definition:     a MagmaRepositoryDefinition
>                preferences:    a MagmaPreferences
>                anchor:         nil
>                transactionLevel:       1
>                strongReferences:       an OrderedCollection()
>                cache:  a Dictionary()
>                guard:  a Mutex
>                statistics:     a MagmaSessionStatistics
>                primaryLink:    a MaLocalServerLink
>                secondaryLink:  a MaLocalServerLink
>                allowFailover:  true
>                oidCount:       12879073
>                lastClean:      26265480
>                requiredProgress:       0
>
> MagmaSession>>pathNamePrimary
>        Receiver: a MagmaSession D:\OpusApp\Magma
>        Arguments and temporary variables:
>
>        Receiver's instance variables:
>                id:     an UUID('2caca4db-5f85-a546-a057-f7978a775e9c')
>                user:   a MagmaUser
>        id = Opus
>                serializer:     a MaObjectSerializer
>                transaction:    a MaTransaction
>                readStrategy:   a MaReadStrategy
>                definition:     a MagmaRepositoryDefinition
>                preferences:    a MagmaPreferences
>                anchor:         nil
>                transactionLevel:       1
>                strongReferences:       an OrderedCollection()
>                cache:  a Dictionary()
>                guard:  a Mutex
>                statistics:     a MagmaSessionStatistics
>                primaryLink:    a MaLocalServerLink
>                secondaryLink:  a MaLocalServerLink
>                allowFailover:  true
>                oidCount:       12879073
>                lastClean:      26265480
>                requiredProgress:       0
>
>
> --- The full stack ---
> Semaphore>>critical:
> Mutex>>critical:
> MagmaSession>>submit:to:
> MagmaSession>>pathNamePrimary
>  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> MagmaSession>>maPrintAbbreviatedOn:
> MagmaSession(MaObject)>>printOn:
> [] in MagmaSession(Object)>>printStringLimitedTo: {[:s | self printOn: s]}
> String class(SequenceableCollection class)>>streamContents:limitedTo:
> MagmaSession(Object)>>printStringLimitedTo:
> [] in MethodContext>>printDetails: {[receiver printStringLimitedTo: 90]}
> BlockContext>>on:do:
> BlockContext>>ifError:
> MethodContext>>printDetails:
> MethodContext(ContextPart)>>errorReportOn:
> [] in Debugger>>mailOutBugReport {[messageStrm := WriteStream     on:
> (String new: 1500).  messageStrm nextPut...]}
> BlockContext>>ensure:
> CursorWithMask(Cursor)>>showWhile:
> Debugger>>mailOutBugReport
> Debugger(StringHolder)>>perform:orSendTo:
> Debugger>>perform:orSendTo:
> [] in MenuItemMorph>>invokeWithEvent: {[(selArgCount := selector
> numArgs) = 0   ifTrue: [target perform: selector] ...]}
> BlockContext>>ensure:
> CursorWithMask(Cursor)>>showWhile:
> MenuItemMorph>>invokeWithEvent:
> MenuItemMorph>>mouseUp:
> MenuItemMorph>>handleMouseUp:
> MouseButtonEvent>>sentTo:
> MenuItemMorph(Morph)>>handleEvent:
> MorphicEventDispatcher>>dispatchDefault:with:
> MorphicEventDispatcher>>dispatchEvent:with:
> MenuItemMorph(Morph)>>processEvent:using:
> MorphicEventDispatcher>>dispatchDefault:with:
> MorphicEventDispatcher>>dispatchEvent:with:
> MenuMorph(Morph)>>processEvent:using:
> MenuMorph(Morph)>>processEvent:
> MenuMorph>>handleFocusEvent:
> [] in HandMorph>>sendFocusEvent:to:clear: {[ActiveHand := self.
> ActiveEvent := anEvent.  result := focusHolder     han...]}
> [] in PasteUpMorph>>becomeActiveDuring: {[aBlock value]}
> BlockContext>>on:do:
> ...etc...
>
> Cheers,
>
> Hernan
> _______________________________________________
> Magma mailing list
> Magma at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/magma
>


More information about the Magma mailing list