-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Postpone instantiation of session config by using a proxy #15929
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
Postpone instantiation of session config by using a proxy #15929
Conversation
Nice one @fmarangi ! Unfortunately applying your fix appears to break loading certain assets.
Which makes sense, since the call to the parent constructor of the class Magento\MediaStorage\Model\File\Storage\Response doesn't have a sixth argument which it passes along. Can you take a further look at this? Thanks! |
I tested a bit more, looks like if I only apply your changes to the I tested with the 3 scenario's:
Feel free to update your PR, unless you have a particular reason why you want to change that other class? |
@hostep hi, thanks a lot for testing my changes! I updated my PR with a possible fix for the Media Storage, would you mind having a look at it? |
Thanks, I won't have time to test this today, maybe tomorrow. Just out of curiosity, what's the reason for changing the constructor of the Thanks! |
It is not really needed, but I find it quite it quite ugly to use the ObjectManager in a constructor when you can define everything via DI and have more control, I thought I'd tidy that up too. It's definitely going to be refactored at some stage, since it's a bit against M2 principles. The reason why it was done like that is probably because of the error you found, instead of changing the subclass the OM was used directly as a workaround / quick win. |
Ah ok, I suppose it was done for backwards compatible reasons, see this document: https://devdocs.magento.com/guides/v2.2/contributor-guide/backward-compatible-development/, the section 'Adding a constructor parameter'. So I think it would be best to only keep the changes to the |
Ok, I see, I'll reset my changes then, thanks for looking into that, learned something new. |
Hi @ihor-sviziev, thank you for the review. |
@magento-engcom-team, @ihor-sviziev: I see you've added this to the 2.2.6 milestone, but I think it would be better to add this fix to 2.2.5 if it gets accepted. Reason being: 2.2.5 is a security release, so you want as much people possible upgrading to that version. If big major bugs were introduced in 2.2.4 (like the one which is fixed by this PR), a fix for such major bugs should get included in 2.2.5, otherwise there will be people not wanting to upgrade to 2.2.5, which is not what you want since it's a security release. I would also like to propose a new way for releasing new versions (using high version examples, just because):
Would something like this make more sense? Because bringing out security releases on top of a version with major bugs, is not the right way to go I think. Just my 2 cents :) |
Hi @fmarangi, thanks for collaboration. The PR introduces about 15% performance degradation. Unfortunately, we can't accept this PR. The result of performance tests in the attachment. |
@VladimirZaets: please tell me Magento is working on a proper solution for fixing #15205, #15245 & #15873 then. This is really a big priority which needs to be fixed before 2.2.5 is released. Thanks! |
@VladimirZaets I really cannot imagine how this fix (using a Proxy for the session config) would cause the figures you posted. My guess is that the bug introduced in c18e36b had the side effect of causing a considerable performance improvement since store-specific and website-specific configurations were never loaded, thus saving some time and memory. Anyway it is a serious issue in my opinion, since language configs, payment configs, themes etc are not loaded correctly in a multiple storeview environment. Could you please tell me how the performance tests are executed? Did repeated tests have the same results? I'd like to look into that and help provide a solution. |
Hi @fmarangi Performance tests are executed using jMeter and multiple variations of performance scenarios, you can see one in By default, we use Magento installation with a generated "small profile" of data, which contains around 800 products and small amounts of other entities. You may find more info on generation here: https://devdocs.magento.com/guides/v2.2/config-guide/cli/config-cli-subcommands-perf-data.html The Pull Request in question was measured by performance CICD job not 1 or 2 times, but multiple, all with the same result, to eliminate possible errors or deviations. From our experience, degradations of 10-15% are not caused by deviations but real issues. @hostep I am now checking internal backlog to figure out status on the issue. I'll get back with the details, if I find any. |
I'll investigate performance numbers history for |
Hi @fmarangi. Thank you for your contribution. Please, consider to port this solution to 2.3 release line. |
@magento-engcom-team or @ishakhsuvarov : no chance you can include this fix in Magento 2.2.5? The Release Notes for Magento 2.2.4 already include that it's not recommended to upgrade to that version because of the bugs this PR fixes:
So if 2.2.5 is a security release, you want people upgrading to it and not repeat that same message that it's not recommended to upgrade to that version I think, that would look very weird. |
Hi @hostep , fix will be available in 2.2.5 release. The comment above was autogenerated due to delivery to 2.2-develop branch, this changes were delivered to 2.2.5 release line in the separate internal pull request. |
[EngCom] Postpone instantiation of session config by using a proxy #15929
A similar issue occurs in 2.2.5 when you switch "Add Store Code to Urls" to "Yes" after browsing first with the option set to "No". A cookie "store" was set which should be completely ignored when "Add Store Code to Urls" is Yes |
Hi @stkams, Could you create new issue with steps to reproduce and maybe some additional details? |
Description
The session config is initialized too early, on initialisation of the HTTP response object. The init of this config object triggers the load of store-specific configuration, which then caches the resolved config path. This happens before the pathinfo is processed, which defines the current store in multi-storeview environment. By using a proxy the instantiation is postponed.
This problem was introduced in c18e36b.
Fixed Issues (if relevant)
Manual testing scenarios
en
foren_US
andde
forde_DE
)web/url/use_store
set to1
/de
Contribution checklist