Skip to content

Commit

Permalink
fix: properly close context on worker script timeouts and crashes (#1184
Browse files Browse the repository at this point in the history
)

* Properly closes context on script timeouts and crashes.

* trigger pipeline

---------

Co-authored-by: Alliballibaba <[email protected]>
  • Loading branch information
AlliBalliBaba and Alliballibaba2 authored Nov 23, 2024
1 parent 6d123c7 commit ccf2af7
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions frankenphp.go
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,13 @@ func go_handle_request(threadIndex C.uintptr_t) bool {
panic(ScriptExecutionError)
}

// if the script has errored or timed out, make sure any pending worker requests are closed
if fc.exitStatus > 0 && thread.workerRequest != nil {
fc := thread.workerRequest.Context().Value(contextKey).(*FrankenPHPContext)
maybeCloseContext(fc)
thread.workerRequest = nil
}

return true
}
}
Expand Down

0 comments on commit ccf2af7

Please sign in to comment.