Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[HttpKernel] fixed handling of X-Debug-Token stopwatch section in combination with HttpCache #6230

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
wants to merge 1 commit into from

Conversation

lsmith77
Copy link
Contributor

@lsmith77 lsmith77 commented Dec 7, 2012

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: #6227
License of the code: MIT

i wonder if openSection() shouldnt rather return a boolean if it was successful or not rather than throw an exception. but i guess its not worth it doing a BC break for this.

@lsmith77
Copy link
Contributor Author

seems like 5.4 is segfaulting for the 2.1 branch https://travis-ci.org/symfony/symfony/builds/3606701

@lsmith77
Copy link
Contributor Author

@fabpot the fix is not very elegant, but i am following the approach already used. would be nice to have this merged so that HttpCache can be used in the dev env.

@fabpot
Copy link
Member

fabpot commented Dec 11, 2012

@lsmith77 I don't know why Travis is segfaulting as tests pass on my machine with PHP 5.4. That's a more general issue with Travis: it fails so often (segfaults, timeouts, Github issues, ...) that it becomes almost useless (too many false positives).

@lsmith77
Copy link
Contributor Author

yeah i agree. i will poke the travis guys about this.

@vicb
Copy link
Contributor

vicb commented Dec 12, 2012

@lsmith77 your header should look like:

Bug fix: no
Bug mask: yes

Joke: i wonder if openSection() shouldnt rather return a boolean if it was successful or not rather than throw an exception. but i guess its not worth it doing a BC break for this.

If you can send me a failing tc (ie a patch) I'll fix it.

@lsmith77
Copy link
Contributor Author

well i have spend 6 hours trying to create a test case and failed. unfortunately i dont have any more time to work on this. the patch fixes things but i dont know what is causing the issue .. :-/

@vicb
Copy link
Contributor

vicb commented Dec 12, 2012

the patch fixes things

I doesn't fix anything, just hide a bug. The bug is probably related to a nested terminate event.

@vicb
Copy link
Contributor

vicb commented Dec 12, 2012

I don't have much time either. If someone can come with a failing ex, I'll work on a fix (hint: I think it is related to how AppCache can generate nested requests).

fabpot added a commit that referenced this pull request Feb 25, 2013
This PR was submitted for the master branch but it was merged into the 2.2 branch instead (closes #7180).

Commits
-------

6a33bc2 [HttpKernel] Fixes AppCache + ESI + Stopwatch problem

Discussion
----------

[HttpKernel] Fixes AppCache + ESI + Stopwatch problem

There is a very special case when using builtin AppCache class as kernel wrapper, in the case of an ESI request leading to a `stale` response [B]  inside a `fresh` cached response [A]. In this case, `$token` contains the [B] debug token, but the  open `stopwatch` section ID is equal to the [A] debug token. Trying to reopen section with the [B] token throws an exception which must be caught.

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| Bug mask?     | no, does @vicb agree?
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #6227, #6230

I tried to find a better solution than just wrapping thrown exceptions with `try/catch`, but IMHO the #6230 solution from @lsmith77 was in fine the best one. I just added some comments in the code to avoid the WTF reactions while reading it.

---------------------------------------------------------------------------

by vicb at 2013-02-25T16:51:51Z

@vicb never agrees :)

I don't have time to check this deeply now but I would like to see a UT.

Could your use case be expressed as "on nested terminate events" ?

---------------------------------------------------------------------------

by jfsimon at 2013-02-25T16:58:49Z

@vicb If I had an idea on how to write a conclusive test for that, I swear, it would be provided in this PR.
@fabpot fabpot closed this Feb 25, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants