-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
user_status/api results in a massive rise of 404 requests #23440
Comments
INSERT
INTO
oc_user_status (user_id, status, status_timestamp, is_user_defined)
SELECT
uid AS user_id,
'Offline' AS status,
configvalue AS status_timestamp,
0 AS is_user_defined
FROM
oc_users
INNER JOIN oc_preferences ON
(uid = userid)
WHERE
uid NOT IN (
SELECT
user_id
FROM
oc_user_status)
AND configkey = 'lastLogin';
This query needs to be executed...and is maybe missed. |
Interested in potential resolution |
DIY resolution is as mentioned above. Insert I guess we won't see any upstream fix, because this will happen only when you update from nextcloud < 20 to nextcloud >= 20 and from time to time (the more users logged in) the rise of 404 error will shrink. I can think of two options for a permanent fix. The table design not ideal here. The user status should be part of the Another permanent fix can be a view, which returns |
Is this Issue still valid in NC21.0.2? If not, please close this issue. Thanks! :) |
This issue has been automatically marked as stale because it has not had recent activity and seems to be missing some essential information. It will be closed if no further activity occurs. Thank you for your contributions. |
I still have this issue, is there any solution? Where can i set the needed endpoint (currently the error occurs from |
As mentioned above. Insert |
I had to make a couple of changes to the commande to make it work. The variable for the status_timestamp wasn't linked to any data, so it was considering it as a string, so I just manually put the Unix time of one of my user. And the 0 for is_user_defined was considered an integer instead of a boolean so I changed it to "false". Also, for any newb like me reading this, accessing the database with the psql command wasn't working until I specified the host as 127.0.0.1, localhost wasn't working for me because it was set to the "PEER" method. You can check this in your Postgres config in /etc/postgresql/{version}/main/pg_hba.conf Here's the code I used to make it work: INSERT
INTO
oc_user_status (user_id, status, status_timestamp, is_user_defined)
SELECT
uid AS user_id,
'Offline' AS status,
1686843638 AS status_timestamp,
false AS is_user_defined
FROM
oc_users
INNER JOIN oc_preferences ON
(uid = userid)
WHERE
uid NOT IN (
SELECT
user_id
FROM
oc_user_status)
AND configkey = 'lastLogin'; |
Good to mention. My SQL statement above was executed on a mariadb. |
Steps to reproduce
E.g. we see here in 3 hours > 1000 404 requests.
Once you're logged in, a status is set.
Maybe the server should not response 404, but 200 with a user_status of "undefined" or something like that.
Otherwise when you're monitoring your 4xx requests, you need to preprocess it before throwing alerts.
The text was updated successfully, but these errors were encountered: