Skip to content

Ensure getmypid is only used when available otherwise disable SharedSiteIds #21216

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

Merged
merged 3 commits into from
Sep 25, 2023

Conversation

bx80
Copy link
Contributor

@bx80 bx80 commented Sep 4, 2023

Description:

Fixes #20537

Based on @sgiehl's changes in #20540 and also incorporating the feedback from @tsteur:

Another way would be something like below code to check if SharedSiteIds is supported and only then use it. Otherwise use the FixedSiteIds. This can make it worse though in cases where there are many sites and getmypid() is disabled. In this case Matomo would always start archiving with idsite 1 etc and never make it to the higher idsites. Meaning the created PR could work better overall even though it means the logic may not always run concurrently.

Disabling SharedSiteIds seems like the safer option if using random process ids. Since the current state is that archiving doesn't run at all and fails with an error on hosts without getmypid() I'd suggest a fix that may degrade performance on some edge cases (only if getmyid() is disabled) is preferable to no fix at all. We could perhaps document somewhere that hosting providers who disable getmypid() are not recommended for installations with many sites or high traffic.

I've tested this by disabling getmypid() locally, recreating the original issue and then successfully running archiving with the fix applied.

Review

@bx80 bx80 added the Bug For errors / faults / flaws / inconsistencies etc. label Sep 4, 2023
@bx80 bx80 self-assigned this Sep 4, 2023
@bx80 bx80 added not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. Needs Review PRs that need a code review Regression Indicates a feature used to work in a certain way but it no longer does even though it should. labels Sep 4, 2023
@bx80 bx80 requested a review from sgiehl September 4, 2023 03:17
@sgiehl
Copy link
Member

sgiehl commented Sep 4, 2023

I'm tempted to say we should also apply this change here:
https://github.com/matomo-org/matomo/pull/20540/files#diff-a1b3870254fbf6ecce77c9f76b05978f3c13b0ac87314247dc0e7782972932a8R362

I know it's not needed, as the climulti might not be used in this case anymore, but in terms of abstraction I think it could at some point be useful if we use Common::getProcessId() everywhere instead of getmypid() directly (Unless the direct usage is needed for feature detection for sure).

@github-actions
Copy link
Contributor

This issue is in "needs review" but there has been no activity for 7 days. ping @matomo-org/core-reviewers

@github-actions github-actions bot added the Stale The label used by the Close Stale Issues action label Sep 12, 2023
@bx80
Copy link
Contributor Author

bx80 commented Sep 15, 2023

@sgiehl I've added the extra Common::getProcessId() call as suggested, this should be ready for review now,

@github-actions github-actions bot removed the Stale The label used by the Close Stale Issues action label Sep 15, 2023
@sgiehl sgiehl removed the Needs Review PRs that need a code review label Sep 19, 2023
@bx80 bx80 added the Needs Review PRs that need a code review label Sep 19, 2023
@bx80 bx80 removed their assignment Sep 19, 2023
@bx80 bx80 requested a review from sgiehl September 20, 2023 21:01
@sgiehl sgiehl force-pushed the m20537-no-sharesiteids branch from d5fd88b to d847d4e Compare September 25, 2023 09:51
Copy link
Member

@sgiehl sgiehl left a comment

Choose a reason for hiding this comment

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

Did some local testing with and without getmypid function disabled. Archiving now works in both cases, so guess this should fix the related issues.

@sgiehl sgiehl added this to the 5.0.0 milestone Sep 25, 2023
@sgiehl sgiehl merged commit b90f53c into 5.x-dev Sep 25, 2023
@sgiehl sgiehl deleted the m20537-no-sharesiteids branch September 25, 2023 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc. 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. Regression Indicates a feature used to work in a certain way but it no longer does even though it should.
Development

Successfully merging this pull request may close these issues.

Archiving error when getmypid function is disabled
2 participants