New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception in kernel.terminal are not easy to debug #27544

Closed
lyrixx opened this Issue Jun 7, 2018 · 6 comments

Comments

Projects
None yet
5 participants
@lyrixx
Member

lyrixx commented Jun 7, 2018

Description
If an exception occurs in the "kernel.terminate" listerner:

  1. The response is broken (see screenshot bellow)
  2. It's hard to understand what's happening. Even for me, it took me a moment to get what's happening. Actually in my project, I got 2 exceptions (one on kernel.request, and another one on kernel.terminate) ; That made it even harder to debug.
screenshot

image

I created a small reproducer on SF4.1: lyrixx/test@29ddcf5
(yeah, the code is YOLO :) )

Example
I don't know how we could fix that. May be we can add a special workflow for error happening on kernel.terminate because they do are specials.

WDYT?

@lyrixx lyrixx added the HttpKernel label Jun 7, 2018

@nicolas-grekas

This comment has been minimized.

Member

nicolas-grekas commented Sep 7, 2018

Not sure what we can do here. Is the error logged? If you use FPM, you'd even not be able to see the error, because of fastcgi_finish_request. What is displayed in stderr in php -S mode? Is there a profiler page with the exception reported?
Honestly, there are some cases where either Symfony or PHP is shutting down, and we cannot do better...

@lyrixx

This comment has been minimized.

Member

lyrixx commented Sep 13, 2018

Maybe we can catch the error, and display an alternative message instead with a link to the profiler?

@fabpot

This comment has been minimized.

Member

fabpot commented Oct 10, 2018

Let's close. Using kernel.terminate is very dangerous and should be avoided at all costs. Here, the Messenger component helps a lot as we now have a core built-in way of doing things out of band.

@fabpot fabpot closed this Oct 10, 2018

@ogizanagi

This comment has been minimized.

Member

ogizanagi commented Oct 10, 2018

@fabpot : Out of curiosity, why do you think it is very dangerous and what would you think about #28646? Should we avoid doing it? That's cheap, but can be valuable on some projects.

@fabpot

This comment has been minimized.

Member

fabpot commented Oct 10, 2018

For #28646, I'm the one who suggested it, so I'm fine with it as a poor man solution :)

@stof

This comment has been minimized.

Member

stof commented Oct 10, 2018

@ogizanagi kernel.terminate is meant to run the logic after the Response was sent. This means that we cannot provide any feedback about what is happening at that time (that's too late for sending feedback about failure)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment