Skip to content
This repository has been archived by the owner on Oct 22, 2019. It is now read-only.

Detect if APC is enabled when trying to use APC storage. #76

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

alex-vlasov
Copy link

When we use APC storage there's a chance to get infinite loop if APC was disabled by mistake.
In particular this is happening when you try to update histogram - https://github.com/Jimdo/prometheus_client_php/blob/master/src/Prometheus/Storage/APC.php#L36:

        $done = false;
        while (!$done) {
            $old = apcu_fetch($sumKey);
            $done = apcu_cas($sumKey, $old, $this->toInteger($this->fromInteger($old) + $data['value']));
        }

To prevent this we can introduce additional check for APC storage.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant