2

Recently I had a problem where because of invalid data in DB some PHP script ran into an infinite recursion on production. We have Sentry added in our system for error log management, but that did not help as there was no error thrown about - PHP just died, with no logs in Sentry or server file logs. It was pretty hard to pinpoint the root cause of the problem when it happened.

After doing some research the only thing I managed to find was that setting xdebug.max_nesting_level would throw an "Nesting too deep" error. How safe would it be to use this specific xdebug feature in production, if everything else is disabled? Or is there another alternative for catching recursion errors in production?

9
  • This sounds more like a case of trying to reproduce the error in a test environment. Is it something which you could copy the database and reproduce the same scenario or is this unknown what causes it. If you have logs of the requests being made, this may indicate what users were doing at the time. Commented Oct 20, 2023 at 6:52
  • Does this answer your question? How to catch the fatal error: Maximum execution time of 30 seconds exceeded in PHP Commented Oct 20, 2023 at 7:03
  • You should not have turned the error log on, otherwise you should be able to see a "Maximum execution time" or "Allowed memory size" log. Commented Oct 20, 2023 at 7:04
  • @shingo "maximum execution time" and "stack overflow" are different errors. Commented Oct 20, 2023 at 7:15
  • @Olivier php doesn't have a stackoverflow exception. it should be an "Allowed memory size ..." error, but the catch method is the same. Commented Oct 20, 2023 at 7:19

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.