Bug 41956

GemBuilder for Java

2.3, 2.2, 2.1.2.1, 2.1.2, 2.1.1, 2.1, 2.0

All platforms

GBJ can miss static exception handlers, especially SigAbort

GBJ sets up several dynamic exception handlers to trap any error that might occur during event processing, particularly for problems that might occur during message transmission between the java client and the gem server.

Static exception handlers defined in your application will not be triggered if their associated exception occurs while GBJ's dynamic handlers are in effect.

In addition, if your static exception handler is for #rtErrSignalAbort (error 6009) and sigAbort handling is enabled using System>>enableSignaledAbortError, the triggering of this error while GBJ dynamic exception handlers are in effect can cause spurious errors when the flow of control during message processing is disrupted by the return from the dynamic exception handler. These errors include
"Out of Sequence" errors on the java client or references to a non-existent key in aGbjTransportBuffer in gem smalltalk code.

Workaround

The following code resolves this problem on GBJ 2.3 for sigAbort errors. Customers using earlier versions should check that the modified methods are consistent with their version.  If your problem involves a different error, replace "6009" with the appropriate error number.

! Fix for sigAbort variation of bug 41956
!
! Note: can be extended to cover other exceptions as needed..
!
! This code is based off of GBJ 2.3
!
! File-in as SystemUser and commit
!
category: 'Event Handling'
method: GsbFramework
handleEvent: anEvent

    Exception category: nil number: nil do:
        [ :ex :cat :num :args || response |

    "fix 41956: resignal sigAborts"
    (num == 6009)
     ifTrue: [
         ex resignal: cat number: num args: args ]
     ifFalse: [

         response := self eventErrorHandler
             value: ex
             value: cat
             value: num
             value: args.
         response == nil ifFalse:
             [^response]].
    ]. "fix 41956"

    (myConfiguration at: #verbose) ifTrue: [
      self log: #GsbEvent object: anEvent].
    self computeEventDateTime.
    anEvent handleEvent.
    self heartbeat
%
category: 'Startup'
method: GbjServer
startup3
    "Run the SMF until the Java client quits."

    | pm reporting |
    Exception category: nil number: nil do: [ :ex :cat :num :args |

    "fix 41956: resignal sigAborts"
    (num == 6009)
     ifTrue: [
         ex resignal: cat number: num args: args ]
     ifFalse: [

        (GbjError isEventError: cat number: num)
        ifTrue: [    "GemStone event error"
            self event: (GbjError category: cat number: num args: args)
]
        ifFalse: [
            self logError: (GbjError category: cat number: num args: args).
            self close.
            ^0 ].
        nil ].

     ]. "fix 41956"

    Exception category: GbjSignals number: nil do: [ :ex :cat :num :args
|
        ex remove.
        ((num = clientClosedConnection) _or: [num = clientTimedOut])
        ifTrue: [
            self log: (GbjError category: cat number: num args: args) messageText.
            self close.
            ^0 ].
        ex resignal: cat number: num args: args.
        nil ].
    self profileServer ifTrue: [
        self log: 'Server profile requested by client'.
        pm := ProfMonitor new.
        pm startMonitoring.
        ].
    self framework eventLoop.
    (pm ~~ nil) ifTrue: [
        reporting := true.
        pm stopMonitoring; gatherResults; removeFile.
        self log: (pm reportDownTo: 1).
        pm removeResults.
        ].
    self close.
    ^0
%


Last updated: 11/28/11