Skip to content

Commit

Permalink
if sigAbort listener thread is off, enable & handle notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Winger authored and Eric Winger committed Oct 21, 2021
1 parent 907b99a commit 85ca9b8
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 5 deletions.
4 changes: 4 additions & 0 deletions sources/GciSession.cls
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ debugToFilePath: aString
^library gciDbgEstablishToFile: aString
!

enableSignaledAbortError
self executeString: 'System enableSignaledAbortError'!

eventCount

^eventCount.
Expand Down Expand Up @@ -789,6 +792,7 @@ valueOfOop: anOopType
!GciSession categoriesFor: #commit!Jade convenience!public! !
!GciSession categoriesFor: #debugString:fromContext:environment:!long running!public! !
!GciSession categoriesFor: #debugToFilePath:!Jade convenience!public! !
!GciSession categoriesFor: #enableSignaledAbortError!public! !
!GciSession categoriesFor: #eventCount!public! !
!GciSession categoriesFor: #fetchBytes:!private! !
!GciSession categoriesFor: #forceLogout!Jade!public! !
Expand Down
33 changes: 28 additions & 5 deletions sources/Rowan UI Base.pax
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ package methodNames
add: #GciSession -> #postLoginAs:useSocket:;
add: #GciSession -> #preferencesFile;
add: #GciSession -> #serverPerform:withArguments:;
add: #GciSession -> #shouldHandleTransactionBacklogError:;
add: #GciSession -> #terminate:;
add: #GciSession -> #titleBarFor:;
add: #GciSession -> #verifyRowanLoaded;
Expand Down Expand Up @@ -213,6 +214,7 @@ package methodNames
add: #JadePresenter -> #displayNoMods:;
add: #JadePresenter -> #displayUncompilableSourceIn:;
add: #JadePresenter -> #editSaveMethod:in:category:;
add: #JadePresenter -> #enableSigAbortError;
add: #JadePresenter -> #executeSelectionOrLine:;
add: #JadePresenter -> #flipAutoCommit;
add: #JadePresenter -> #insertCompileErrorText:into:;
Expand Down Expand Up @@ -1097,8 +1099,13 @@ handleTransactionBacklogError: error
JadePresenter sigAbortsProcessEnabled
ifTrue: [JadePresenter abortTransactionInSession: self]
ifFalse:
[MessageBox
notify: 'Your session has been requested to abort, by a transaction backlog error (#3007) while executing a GCI command when not in transaction. You must abort your transaction and retry the operation.'].
[
[(MessageBox
confirm: 'Your session has been requested to abort, by a transaction backlog error (#3007 or #6009) while executing a GCI command when not in transaction.
You must abort your transaction before retrying the operation.
Would you like to abort now?')
ifTrue: [JadePresenter abortTransactionInSession: self]]
ensure: [self enableSignaledAbortError "must reenable each time a sig abort error is received"]].
error abort "Shutdown this process. An abort happened or needs to happen"!

hasServer
Expand Down Expand Up @@ -1225,6 +1232,10 @@ serverPerform: aSymbol withArguments: anArray
withAll: anArray.
^answer!

shouldHandleTransactionBacklogError: result
^(result isKindOf: GsError)
and: [result errorReport number = 3007 or: [result errorReport number = 6009]]!

terminate: anOopType
[self serverPerform: #terminate: with: anOopType] on: Error
do:
Expand Down Expand Up @@ -1270,10 +1281,14 @@ withExplanation: aString do: aBlock
[
[(Delay forMilliseconds: 10) wait.
self isCallInProgress] whileTrue: [].
[library gciPollForSignal] on: Error
do: [:ex | (self shouldHandleTransactionBacklogError: ex) ifTrue: [self handleTransactionBacklogError: ex]].
result := self withExplanation: aString doA: aBlock.
self incrementEventCount.
(result isKindOf: GsError)
ifTrue: [result errorReport number = 3007 ifTrue: [self handleTransactionBacklogError: result]]
ifTrue:
[(self shouldHandleTransactionBacklogError: result)
ifTrue: [self handleTransactionBacklogError: result]]
ifFalse: [^result].
error := result.
[result := error signal] ensure: [self releaseAllOops].
Expand Down Expand Up @@ -1318,6 +1333,7 @@ withExplanation: aString doA: aBlock
!GciSession categoriesFor: #postLoginAs:useSocket:!private! !
!GciSession categoriesFor: #preferencesFile!constants!private! !
!GciSession categoriesFor: #serverPerform:withArguments:!Jade convenience!public! !
!GciSession categoriesFor: #shouldHandleTransactionBacklogError:!long running!private!testing! !
!GciSession categoriesFor: #terminate:!public! !
!GciSession categoriesFor: #titleBarFor:!public!title bar! !
!GciSession categoriesFor: #verifyRowanLoaded!private! !
Expand Down Expand Up @@ -2299,6 +2315,9 @@ editSaveMethod: classService in: methodSourcePresenter category: category
self setCompileWarningColor.
self statusBarText: warning].!

enableSigAbortError
gciSession enableSignaledAbortError!

executeSelectionOrLine: contextObject
| answeringService answer oop |
oop := (contextObject isKindOf: ExternalInteger)
Expand Down Expand Up @@ -2329,7 +2348,10 @@ issueCommand: service
^self class issueCommand: service session: self gciSession!

listenForSigAborts: session
self sigAbortsProcessEnabled ifFalse: [^self].
self sigAbortsProcessEnabled
ifFalse:
[self transactionMode == #manualBegin ifTrue: [self enableSigAbortError].
^self].
self
sigAbortsProcess: (
[
Expand All @@ -2339,7 +2361,7 @@ listenForSigAborts: session
session isValidSession
ifTrue:
[gciSession gciAbort. "to guarantee an abort gets done and doesn't get interrupted by another gci error do this"
self abortTransaction ."Yes, the second abort is redundant but this will also do some more complicated browser updating."
self abortTransaction. "Yes, the second abort is redundant but this will also do some more complicated browser updating."
self class setInTransaction: RowanAnsweringService new session: session]].
(Delay forSeconds: self sigAbortProcessInterval) wait]
repeat]
Expand Down Expand Up @@ -2485,6 +2507,7 @@ updateServices: services
!JadePresenter categoriesFor: #displayNoMods:!compile support!displaying!public! !
!JadePresenter categoriesFor: #displayUncompilableSourceIn:!event handlers!public!text tabs!updating! !
!JadePresenter categoriesFor: #editSaveMethod:in:category:!compile support!public! !
!JadePresenter categoriesFor: #enableSigAbortError!accessing!public!transaction management! !
!JadePresenter categoriesFor: #executeSelectionOrLine:!menu handlers!private! !
!JadePresenter categoriesFor: #flipAutoCommit!menu handlers!public! !
!JadePresenter categoriesFor: #insertCompileErrorText:into:!compile support!public! !
Expand Down

0 comments on commit 85ca9b8

Please sign in to comment.