Skip to content

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

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

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

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

lyrixx opened this issue Jun 7, 2018 · 6 comments

Comments

@lyrixx
Copy link
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?

@nicolas-grekas
Copy link
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
Copy link
Member Author

lyrixx commented Sep 13, 2018

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

@fabpot
Copy link
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 as completed Oct 10, 2018
@ogizanagi
Copy link
Contributor

@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
Copy link
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
Copy link
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
Projects
None yet
Development

No branches or pull requests

5 participants