Problem/Motivation
If $info['mem_size'] is empty this error occurs:
DivisionByZeroError: Division by zero in Drupal\monitoring\Plugin\monitoring\SensorPlugin\ApcuSharedMemorySizeSensorPlugin->runSensor() (line 47 of /app/web/modules/contrib/monitoring/src/Plugin/monitoring/SensorPlugin/ApcuSharedMemorySizeSensorPlugin.php).
Steps to reproduce
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Issue fork monitoring-3540744
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
berdirReviewed.
Comment #4
dieterholvoet commentedComment #5
dieterholvoet commentedWe have been encountering the same bug on a bunch of sites since tonight. In our case the current MR doesn't seem to solve the issue. Our problem is that
ini_get('apc.shm_segments')returnsFALSE, making$shm_size === 0which still causes aDivisionByZeroError.Comment #6
berdirThanks for the feedback, so it's not mem_size that's the problem then. Doesn't make sense to me that this would return FALSE, but lets check for that, maybe default the value to 1 if not set or skip the whole thing?
Comment #7
dieterholvoet commentedWell I checked
phpinfo()and the directive is missing. Haven't figured out how yet, I'm checking with our hosting partner, but it couldn't hurt checking for this situation. It's interesting that we're not the only one encountering this issue in the span of a couple days.Comment #8
dieterholvoet commentedNot sure if the other check is actually necessary, I'll leave that to @primsi to determine.
Comment #10
berdirWhat's weird is that in our case (on platform.sh) the error went away after a redeploy and it only happened on one out of dozens of projects, so we can't reproduce it there anymore.
I've merged it for now.
With the Throwable change, even a DivisionByZeroError or another Error shouldn't break the monitoring page completely anymore, but it's useful to see a more specific reason than the error.
Comment #11
dieterholvoet commentedFound the culprit. The issue was triggered by security updates last night. There's an associated core issue: #3538854: APCu requirement for 32MB always displays since APCu 5.1.25.
Source
I suggest we add a fallback to 1 if the ini directive is missing.
Comment #12
berdirMakes sense, lets open an new MR then for then. I'm also fine if we just drop that segment logic completely. Worst case is we report a wrong total, I don't really care too much, never used that feature, not as long as I can remember. I think I copied this from core.
It also means that this will hit all sites eventually, maybe platform.sh rolled back the apcu version due to that and that's why redeploy fixed it.
Comment #13
primsi commented@dieterholvoet did you plan to work on this? Otherwise I can check this tomorrow.
Comment #15
dieterholvoet commentedAlready done!
Comment #18
berdirMerged again.