Review main Merged

61878[BUGFIX] Reset belog search constraints on memory exhaustion

Christian Eßl CR +2 V +2 Easy +19 −0 updated 10/08/19, 07:34

Commit message

If a backend user uses the search in belog with no boundaries or sets a
custom date limit with boundaries that are too wide, the script
execution will experience a "Allowed memory of ... exhausted ..."
fatal error in PHP.

Because the search constraints are saved in the backend users uC
nonetheless, any further effort to access the belog module would result
in a fatal error, thus making it unusable.

This patch makes the belog module detect, if the script execution fails
because of an exhausted memory and reset the search constraints to its
initial values.

Review

  • Code review CR +2 Done
    • Tobi Kretschmann +2
    • Daniel Goerz +1
    • Oli Bartsch +1
    • Sascha Rademacher +1
    • Julian Geils +1
    • Jörg Bösche +1
    • Felix P. +1
    • Steffen Frese +1
  • Verified V +2 Done
    • Tobi Kretschmann +2
    • Sascha Rademacher +1
    • Julian Geils +1
    • Jörg Bösche +1
    • Felix P. +1
    • Steffen Frese +1
    • TYPO3com +1 CI

Issues 1

Files 1

Review log 1821

  1. Christian Eßl uploaded patch set 1 10/03/19, 15:03

  2. TYPO3com voted on patch set 1 V -1 10/03/19, 15:04 Completed build in 11s on Thu, 3 Oct, 03:04 PM Test Summary: No tests found Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-37027

  3. Christian Eßl uploaded patch set 2 10/03/19, 15:07

  4. TYPO3com voted on patch set 2 V +1 10/03/19, 15:16 Completed build in 09m 08s on Thu, 3 Oct, 03:16 PM Test Summary: 47759 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-37028

  5. Andreas Kienast commented on patch set 2 10/03/19, 15:55

    BackendLogController.php:183

    Where does this number come from?
  6. Christian Eßl commented on patch set 2 10/03/19, 16:19

    BackendLogController.php:183 Reply

    Slightly more than 3MB to be on the safe side and avoid running out of memory, when resetting the constraints. I think 3MB would be around ~ 188000.
  7. Mathias Brodala commented on patch set 2 10/04/19, 06:46

    BackendLogController.php:113

    How about restructuring this action a bit instead?: 1. Do not persist constraint at the top 2. Explicitly call $this->view->render() before explicitly returning its result 3. If the view could be rendered, persist the constraint
  8. Oli Bartsch commented on patch set 2 10/04/19, 07:32

    BackendLogController.php:188

    I think the error message always start with "Allowed ..." but you could use `strpos($error['message'], 'Allowed memory size of') !== false` to be safe.
  9. Christian Eßl commented on patch set 2 10/04/19, 12:31

    BackendLogController.php:113 Reply

    Nice idea. The only problem I see with this: If the backend user sets all the constraints to "any", tnis can work to day. If the same backend users comes back a few weeks later, and the log has gotten much larger, the Log module would now crash with the saved settings and cannot be reset. (unless you go to the admin tool and completely reset the uC for all backend users).

    BackendLogController.php:183 Reply

    Done

    BackendLogController.php:188 Reply

    Done
  10. Christian Eßl uploaded patch set 3 10/04/19, 12:32

  11. Mathias Brodala commented on patch set 3 10/04/19, 12:36

    BackendLogController.php:113 Reply

    That's true and can't be fixed with my suggestion.
  12. TYPO3com voted on patch set 3 V +1 10/04/19, 12:42 Completed build in 10m 24s on Fri, 4 Oct, 12:42 PM Test Summary: 47759 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-37045

  13. Daniel Goerz voted on patch set 3 CR +1 10/06/19, 20:13

  14. Oli Bartsch voted on patch set 3 CR +1 10/06/19, 21:47

  15. Jörg Bösche commented on patch set 3 V +1 CR +1 10/07/19, 13:52

    tested with more than 200.000 entries in sys_log table. After selecting "max -> any" a php error with memory exhaustion occurs. Re-Open the "log" module, the settings are reseted and it is possible to use the log output again. verified with dev-master and v9.5.9.
  16. Steffen Frese voted on patch set 3 V +1 CR +1 10/07/19, 13:56

  17. Sascha Rademacher voted on patch set 3 V +1 CR +1 10/08/19, 06:43

  18. Tobi Kretschmann voted on patch set 3 V +2 CR +2 10/08/19, 06:49

  19. Julian Geils voted on patch set 3 V +1 CR +1 10/08/19, 07:26

  20. Felix P. voted on patch set 3 V +1 CR +1 10/08/19, 07:34

  21. Tobi Kretschmann merged patch set 4 10/08/19, 07:34