Navigation Menu

Skip to content
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

Reduce risk of segmentation fault in visit log #15471

Merged
merged 3 commits into from Feb 6, 2020
Merged

Reduce risk of segmentation fault in visit log #15471

merged 3 commits into from Feb 6, 2020

Conversation

tsteur
Copy link
Member

@tsteur tsteur commented Jan 27, 2020

fixes #15307

This way I can view the visitor log. I can only view up to 25 visitors currently and it crashes when viewing 50. Once I change Custom Reports and Marketing Campaigns reporting I can view 500 visits without a crash.

@tsteur tsteur added the Needs Review PRs that need a code review label Jan 27, 2020
@tsteur tsteur added this to the 4.0.0 milestone Jan 27, 2020
@@ -274,18 +283,20 @@ public function render()
// can fail, for example at installation (no plugin loaded yet)
}

ProxyHttp::overrideCacheControlHeaders('no-store');
if ($this->sendHeadersWhenRendering) {
Copy link
Member

Choose a reason for hiding this comment

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

Wouldn't it make sense to refactor that some more and move sending headers away from the view render?
Imho it's a bit misplaced here and should be part of the global dispatch 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah it just be a bit of a big refactoring potentially. I did have a different patch as well where it was detecting it more automatically but it's actually not that easy.

Eg I had a patch where

  • view->render is called
  • lock overwriting headers
  • actually render the template
  • no headers are sent while other views are being rendered as part of a postEvent in twig
  • rendering template finished
  • Remove the lock for overwriting headers
  • Send headers
  • view-> render is finished

It didn't quite work though because some views might still be rendered separately that aren't part of a postEvent.

We could generally do a global refactoring to get it out of view->render but sounds quite complex and not sure it's worth the effort also considering I haven't heard anyone else experiencing a seg fault in this direction.

I suppose we could put it into Controller::renderTemplate method but everyone not using that method would then suddenly need to remember to take care of sending the correct headers themselves? It may work though when doing it inside setBasicVariablesView/setGeneralVariablesView as most views would call this manually. It be a slightly better solution but also not perfect.

Not sure what you had in mind?

Copy link
Member

Choose a reason for hiding this comment

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

yes, actually it would be nice to have a more clean response handling, but that would be a quite bigger refactoring. Guess for now your solution should be fine, as it solves the issue...

tsteur added a commit to matomo-org/plugin-MarketingCampaignsReporting that referenced this pull request Feb 6, 2020
@tsteur tsteur merged commit 40d169f into 4.x-dev Feb 6, 2020
@tsteur tsteur deleted the 15307 branch February 6, 2020 22:19
@mattab mattab added the not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. label Sep 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review PRs that need a code review not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Visits log fails without any error
3 participants