Skip to content

Commit 173a048

Browse files
committed
Revert "record frankenphp worker loop iteration as background transaction"
This reverts commit 6518d01. It is not possible to call nr_php_txn_begin after frankenphp_handle_request returns - frankenphp_handle_request calls frankenphp's version of other SAPIs php_request_shutdown, which destroys output handlers stack and nr_php_txn_being's code adds new output handler to the stack.
1 parent 7bc6138 commit 173a048

2 files changed

Lines changed: 6 additions & 11 deletions

File tree

agent/php_frankenphp.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ void nr_php_frankenphp_handle_request(INTERNAL_FUNCTION_PARAMETERS) {
3737
zend_function* zf;
3838
nruserfn_t* wr = NULL;
3939

40+
// Always end current transaction started when worker was started
41+
nr_txn_set_path("frankenphp_handle_request", NRPRG(txn), "frankenphp/worker",
42+
NR_PATH_TYPE_CUSTOM, NR_OK_TO_OVERWRITE);
43+
nr_txn_set_as_background_job(NRPRG(txn), "frankenphp worker");
44+
nr_php_txn_end(0, 0);
45+
4046
zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "z",
4147
&function);
4248
zf = nr_php_zval_to_function(function);

agent/php_internal_instrument.c

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3123,21 +3123,10 @@ NR_INNER_WRAPPER(exception_common) {
31233123
NR_INNER_WRAPPER(frankenphp_handle_request) {
31243124
nrl_verbosedebug(NRL_INIT, "frankenphp_handle_request started");
31253125

3126-
// End the worker transaction
3127-
nr_txn_set_path("frankenphp_handle_request", NRPRG(txn), "frankenphp/worker/bootstrap",
3128-
NR_PATH_TYPE_CUSTOM, NR_NOT_OK_TO_OVERWRITE); // this will not overwrite the 'loop' path
3129-
nr_txn_set_as_background_job(NRPRG(txn), "frankenphp worker");
3130-
nr_php_txn_end(0, 0);
3131-
31323126
nr_php_frankenphp_handle_request(INTERNAL_FUNCTION_PARAM_PASSTHRU);
31333127

31343128
// Let frankenphp take over
31353129
nr_wrapper->oldhandler(INTERNAL_FUNCTION_PARAM_PASSTHRU);
3136-
3137-
// Start a new transaction for worker loop
3138-
nr_php_txn_begin(0, 0);
3139-
nr_txn_set_path("frankenphp_handle_request", NRPRG(txn), "frankenphp/worker/loop",
3140-
NR_PATH_TYPE_CUSTOM, NR_NOT_OK_TO_OVERWRITE);
31413130
nrl_verbosedebug(NRL_INIT, "frankenphp_handle_request done");
31423131
}
31433132
#endif

0 commit comments

Comments
 (0)