Skip to content

Disable agent when opcache is in reset pending state (#988)#1000

Merged
intuibase merged 2 commits intoelastic:mainfrom
intuibase:988_disable_agent_when_opcache_reset_is_pending
Jun 21, 2023
Merged

Disable agent when opcache is in reset pending state (#988)#1000
intuibase merged 2 commits intoelastic:mainfrom
intuibase:988_disable_agent_when_opcache_reset_is_pending

Conversation

@intuibase
Copy link
Contributor

Fixes #988

@intuibase intuibase requested a review from SergeyKleyman June 20, 2023 15:04
@intuibase intuibase self-assigned this Jun 20, 2023
return false;
}

zval *restartPending = zend_hash_str_find(Z_ARRVAL(rv), ZEND_STRL("restart_pending"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's also restart_in_progress key - should we check for that as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

restart_pending has wider scope, it is more secure


int result = call_internal_function(NULL, "opcache_get_status", parameters, 1, &rv);
if (result == resultFailure) {
zval_ptr_dtor(&rv);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it's worth using goto finally approach to avoid duplicating cleaning code (zval_ptr_dtor(&rv);)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true, i'll update it when we will introduce c++

ELASTIC_APM_SET_RESULT_CODE_AND_GOTO_FAILURE();
}

if (detectOpcacheRestartPending()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about adding tracerPhpPartState_disabled to enum TracerPhpPartState and set state to it here?

@intuibase intuibase merged commit d41a80f into elastic:main Jun 21, 2023
@intuibase intuibase deleted the 988_disable_agent_when_opcache_reset_is_pending branch July 7, 2023 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

2 participants