Bug 51665

GemStone/S 64 Bit

3.6.8, 3.6.7, 3.6.6, 3.6.5, 3.6.4, 3.6.3, 3.6.2, 3.6.1, 3.6

3.7

Not able to get stack traces in an external session using GEM_HALT_ON_ERROR

Setting GEM_HALT_ON_ERROR to a given error number causes a Gem to halt and write C and Smalltalk stack traces to the Gem log.

This process did not work correctly for errors in external sessions; initialization code for the remote session by default overrides GEM_HALT_ON_ERROR, so while the Gem log reported the GEM_HALT_ON_ERROR, it did not actually halt.

Workaround

File the following code as SystemUser and commit.

category: 'Public'
method: GsExternalSession
login
  | result lib sid |
  stoneSessionId ifNotNil: [
    ImproperOperation signal: 'Stone session ' , stoneSessionId printString ,
      ' already associated with this GsExternalSession!'.
  ].
  lib := self _gciLibrary .
  result := lib
    GciSetNetEx_: parameters gemStoneName
    _: parameters hostUsername
    _: parameters hostPassword
    _: parameters gemService
    _: parameters passwordIsEncryptedAsIntegerBoolean.  "1 or 0: GCI_LOGIN_PW_ENCRYPTED"
        result == 0 ifTrue:[ self error:'GciSetNetEx_ failed'].
  result := lib
    GciLoginEx_: parameters username
    _: parameters password
    _: parameters loginFlags
    _: -1. "haltOnErrNum from gem config file"
  sid := lib GciGetSessionId.
  sid > 0 ifTrue:[ gciSessionId := sid ].
  0 == result ifTrue: [
    self _signalIfError: lib arg: 'Using ', parameters printString .
    self error: 'Login failed for unknown reason!'.
  ].
  self _postLogin: lib  .
  ((self dynamicInstVarAt: #quiet) ifNil:[ 0 ]) < 2 ifTrue:[
    self log: 'GsExternalSession login: ' , self _describe.
  ].
%
category: 'Login'
method: GsTsExternalSession
login
 | c ptr args |
 self isLoggedIn ifTrue:[ ^ ImproperOperation signal:'already logged in'].
 c := self _calloutAt: 1 name: #'GciTsLogin' .
 gciErr := GciErrSType new .
 args := {    
   self _stringArg: parameters gemStoneName .
   self _stringArg: parameters hostUsername .
   self _stringArg: parameters hostPassword .
   parameters passwordIsEncryptedAsIntegerBoolean.  "BoolType  hostPwIsEncrypted"
   self _stringArg: parameters gemService .
   self _stringArg: parameters username .
   self _stringArg: parameters password .
   parameters loginFlags .  "unsigned int loginFlags per GCI_LOGIN* "
   -1 . "int haltOnErrNum from gem config file"
 }.
 c numFixedArgs == 11 ifTrue:[  "GciTs v3.5.x + "
   args add:( CByteArray gcMalloc: 4 "BoolType *executedSessionInit").
 ].
 args add: gciErr .
 ptr := c callWith: args .
 ptr memoryAddress == 0 ifTrue:[
   self _signalError:'GciTsLogin failed'.
 ].
 tsSession := ptr .
 (socket := GsSocket fromFileHandle: self _getSocketFd )
    setCloseOnGc: true "fix 50624" .
 gciErr number > 0 ifTrue:[
    self _signalError:'Warning from GciTsLogin'.
 ]
%

Last updated: 12/1/25