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

Skip to content

[WebProfilerBundle] [HttpKernel] A static approach to version feedback #14351

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 3 commits into from

Conversation

derrabus
Copy link
Member

Q A
Bug fix? yes
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #14349, #13626
License MIT
Doc PR N/A

This is an alternative approach for the version feedback feature of PR #13626. The original PR performed a server-side HTTP request to symfony.com, which might be problematic in certain environments, see #14349.

This PR makes the following assumptions:

  • Symfony's release roadmap is rarely changed
  • After the first release of a branch, the Symfony development team is committed to the announced support dates.
  • The support period of a stable branch might be extended, but it's usually not reduced.

Given those assumptions, the EOM and EOL dates may be shipped with the Symfony release and may be updated with a later bugfix release. The information would be available offline without any need to query Symfony's servers.

If the user is running the latest bugfix release of a branch, the EOM/EOL dates should be accurate. If he's running an earlier version, he might get a false positive warning about reaching EOM or EOL if the support period has been extended in the meantime. But since he's running an outdated version anyway, would this really be a problem?

@@ -270,60 +270,20 @@ public function getName()
*
* @return string One of: unknown, dev, stable, eom, eol
*/
private function requestSymfonyState()
private function caculateSymfonyState()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: calculate

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@stloyd
Copy link
Contributor

stloyd commented Apr 14, 2015

Not sure it should be hardcoded date or just timestamp, but 👍

@Green-Cat
Copy link

👍

@linaori
Copy link
Contributor

linaori commented Apr 14, 2015

👎 This is easy to forget for the developers and more work to maintain. What's wrong with caching away the info from symfony.com?

@derrabus
Copy link
Member Author

@iltar Yes, when opening a new Symfony branch, two more constants have to be adjusted in addition to the other six constants in that file. In the current release model, this would happen twice a year. Since this very file has to be changed anyway, I don't think that adjusting the constants will be forgotten.

The problem is not the caching. It's the fact that this external call happens at all. In my case, the development happens in a network environment with restricted internet access, so this call would always run into timeouts. Apart from that, some companies are really concerned about data being sent to some cloud services. It is hard to explain to them that my application framework wants to call home every now and then.

@derrabus derrabus closed this Apr 14, 2015
@derrabus derrabus reopened this Apr 14, 2015
@derrabus
Copy link
Member Author

Please also read the comments @javiereguiluz made to #13626 and my bug report #14349 on why this call is problematic.

@linaori
Copy link
Contributor

linaori commented Apr 14, 2015

@derrabus I don't really see the trouble a file_get_contents() does. If they don't trust the framework you use, why bother using it? I also believe that if you really have a network that tight, you won't be working with 3rd party apis either. Considering this would called once in a while, having a 1 second timeout wouldn't be a problem. So what about an option to add a timeout/disable this all together?

I'm not going to be the one maintaining this, but I can imagine they want to prevent updating extra files every branch because someone couldn't open symfony.com

@fabpot
Copy link
Member

fabpot commented Apr 14, 2015

I think this change is legitimate. I don't care updating 2 more constants (and even if I forget, I'm pretty sure someone will notice pretty fast :)).

@mpajunen
Copy link
Contributor

👍

@derrabus
Copy link
Member Author

@iltar It's not even about maintaining extra files. The Kernel class that holds the two constants my patch introduces needs to be updated anyway when opening a new branch, since it holds other version information of the Symfony framework as well:

    const VERSION = '2.7.0-DEV';
    const VERSION_ID = '20700';
    const MAJOR_VERSION = '2';
    const MINOR_VERSION = '7';
    const RELEASE_VERSION = '0';
    const EXTRA_VERSION = 'DEV';

And it's not about just opening symfony.com. In this network, the whole web traffic is funneled through a proxy. If you're not using the proxy, you run into a timeout. They won't simply open symfony.com because they don't have a mechanism to do so. Either use the proxy or die trying to bypass it. Furthermore, I'd like to keep the ability to code where ever I am. Inside a train. Inside a plane. On the beach. And, I really love the possibility to wipe my cache, no matter if I have an internet connection or not.

Slowing down the application by 1 sec. on each request would also not be an option to me. But in the current implementation, the timeout is whatever your php.ini settings are set to, which is 60 sec. by default, afaik. Also, the current implementation does not cache failed requests, so I run into this timeout on every request.

And yes, the application I mentioned in my bug report is an intranet application. It only calls other services inside this intranet, no external APIs. That version check would be the only external service that is called. Ever.

My client does trust the Symfony framework a lot! They really do! But they also have very strict policies regarding network communication. And I won't get an exception to those policies for an occasional version check. :-/

@derrabus
Copy link
Member Author

Thanks, @fabpot. Don't you have a script for updating those constants, anyway? :-)

@ChadSikorra
Copy link
Contributor

@derrabus Sorry to add more noise here, but I think it's a lazy SysAdmin unwilling to add a proxy exception for a URL rather than the proxy not being able to ;) I work on a network that has a corporate proxy where all user traffic is funneled through (I manage the proxy as well...). An exception with good justification, such as in this case, is easily done. Though I would agree that the timeout value is a bit too high here.

@@ -270,60 +270,20 @@ public function getName()
*
* @return string One of: unknown, dev, stable, eom, eol
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One of: unknown, dev, stable, eom, eol

@fabpot
Copy link
Member

fabpot commented Apr 15, 2015

@derrabus Yes, I do have a script that updates these constants for me :)

@derrabus
Copy link
Member Author

@ChadSikorra You got me wrong. We are able to connect to symfony.com through the proxy. If the version check used the proxy, it would probably work. Instead the version check tries to connect directly to symfony.com and runs into a timeout.

@ChadSikorra
Copy link
Contributor

@derrabus Ah, good point! Sometimes I overlook the obvious...hah. Wherever I've seen proxies deployed we have also deployed a proxy "firewall" service on the client (if needed). Basically it's a Windows service that intercepts outbound traffic to forward it to the proxy. So even if a client is using an application that isn't proxy aware it will still go through the proxy. Though I suppose not all proxy setups will be configured like that.

@@ -270,60 +270,20 @@ public function getName()
*
* @return string One of: unknown, dev, stable, eom, eol
*/
private function requestSymfonyState()
private function calculateSymfonyState()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it doesn't really calculate. I think "determine" is a better word in this context? (not a native though...)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree. "calculate" reminds me of operations with some input. "Determine" is more suitable for time dependent operation.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feedback. I'll change the name.

@wouterj
Copy link
Member

wouterj commented Apr 19, 2015

👍 I do care a lot about this feature in Symfony, but I don't care much about the implementation of it.

In my PR, having such things in the code base was rejected as it wasn't flexible enough. Is this not a problem anymore? (I do see that releases are only extended, in which case a user would see the EOM message too early, which could lead to some confusion, but isn't a big problem).

@sstok
Copy link
Contributor

sstok commented Apr 19, 2015

👍

1 similar comment
@Tobion
Copy link
Contributor

Tobion commented Apr 19, 2015

👍

@xabbuh
Copy link
Member

xabbuh commented Apr 19, 2015

👍 (with the method name change suggested by @wouterj)

* Renamed calculateSymfonyState() once again to determineSymfonyState().
* Beta and RC versions should be reported as unstable.
* "unknown" ist not a possible state anymore.
@derrabus
Copy link
Member Author

Thank you for your feedback, @wouterj. I've applied the changes you suggested.

@Tobion
Copy link
Contributor

Tobion commented Apr 28, 2015

Thank you @derrabus.

@derrabus
Copy link
Member Author

Thanks a lot for merging. :-)

@derrabus derrabus deleted the 2.7-static-version-check branch June 24, 2015 07:22
fabpot added a commit that referenced this pull request Nov 6, 2016
…0NL)

This PR was squashed before being merged into the 3.2-dev branch (closes #20424).

Discussion
----------

[HttpKernel] Removed forgotten setCacheVersionInfo()

| Q             | A
| ------------- | ---
| Branch?       | "master"
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no-ish
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | comma-separated list of tickets fixed by the PR, if any
| License       | MIT
| Doc PR        | reference to the documentation PR, if any

Forgotten in #14351

Commits
-------

8e70193 [HttpKernel] Removed forgotten setCacheVersionInfo()
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.