go-gitea / gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD
https://gitea.com
MIT License
44.94k stars 5.48k forks source link

Doubled feed in the dashboard and activity #2455

Closed Albert221 closed 7 years ago

Albert221 commented 7 years ago

Description

I've got doubled the feed both in the dashboard and in the public activity. Almost everything is twice.

Screenshots

chrome_2017-09-03_15-04-23


screenshot-192 168 1 28-2017-09-03-15-07-45

lafriks commented 7 years ago

I think this is already fixed and fix will be in rc2

Albert221 commented 7 years ago

I can confirm it's fixed :)

jeppech commented 7 years ago

This still seems to be an issue. I am encountering it on v1.2.1. I cannot replicated on try.gitea.io though. It does not happen for new repositories created, after I've updated to 1.2.1, but actions on repos created prior to the upgrade, seems to be affected.

jeppech commented 7 years ago

Some entries in the feed, are added 3 times, some 4 times. I cannot figure out why this is happening.

I'm unsure if this has anything to do with it. But I updated my Gitea instance from v1.1.3 to v1.2.1.

lunny commented 7 years ago

Maybe because duplicated hook scripts, you can rewrite hooks on admin panels if you have not customized them.

jeppech commented 7 years ago

@lunny do you mean this Resync pre-receive, update and post-receive hooks of all repositories.?

lunny commented 7 years ago

Yes.

jeppech commented 7 years ago

That didn't help, unfortunately.

jeppech commented 7 years ago

Here's a snippet from the log, that also shows, the action being inserted 3 times

2017/10/20 15:05:09 [I] [SQL] INSERT INTO `action` (`user_id`,`op_type`,`act_user_id`,`repo_id`,`comment_id`,`is_deleted`,`ref_name`,`is_private`,`content`,`created_unix`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) []interface {}{1, 12, 1, 15, 1985, false, "", true, "189|", 1508504709}
2017/10/20 15:05:09 [I] [SQL] INSERT INTO `action` (`user_id`,`op_type`,`act_user_id`,`repo_id`,`comment_id`,`is_deleted`,`ref_name`,`is_private`,`content`,`created_unix`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) []interface {}{5, 12, 1, 15, 1985, false, "", true, "189|", 1508504709}
2017/10/20 15:05:09 [I] [SQL] INSERT INTO `action` (`user_id`,`op_type`,`act_user_id`,`repo_id`,`comment_id`,`is_deleted`,`ref_name`,`is_private`,`content`,`created_unix`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) []interface {}{3, 12, 1, 15, 1985, false, "", true, "189|", 1508504709}
lafriks commented 7 years ago

@jeppech check in repository settings that you don't have gitea git hook also in custom git-hook

jeppech commented 7 years ago

I've deleted the custom hook, that I've been using for automating builds with Jenkins. The hook folders,pre-receive, update and post-receive, only contain one hook file, which is the default Gitea hook that looks like the following:

$ cat update.d/gitea
#!/usr/bin/env bash
"/home/git/gitea/gitea" hook --config='/home/git/gitea/custom/conf/app.ini' update $1 $2 $3
jeppech commented 7 years ago

Newly created repositories, on my Gitea instance, has the same default hooks (no duplicates or anything), as repositories created prior to v1.2.1.

@lafriks These are the available hooks, under Settings -> Git Hooks. No custom hooks have been added either.

lunny commented 7 years ago

@jeppech could you ls update.d/ to see if there are other hook files there.

jeppech commented 7 years ago

@lunny here you go

Repository prior to v1.2.1

$ ls update.d
gitea

$ cat update.d/*
#!/usr/bin/env bash
"/home/git/gitea/gitea" hook --config='/home/git/gitea/custom/conf/app.ini' update $1 $2 $3

Repository created on v1.2.1

$ ls update.d
gitea

$ cat update.d/*
#!/usr/bin/env bash
"/home/git/gitea/gitea" hook --config='/home/git/gitea/custom/conf/app.ini' update $1 $2 $3
jeppech commented 7 years ago

Does any of you, got other suggestions, for fixing this?

lunny commented 7 years ago

@jeppech I can't reproduce that.

jeppech commented 7 years ago

Can you point me in any other direction? Is it only the hooks, that can cause this to happen? Is there some settings, I could try and reset?

jeppech commented 6 years ago

@lunny Could you tell me which piece of code, is responsible for inserting the activity in the database, and which part is triggering it. Then I'll try and tinker with it, my self.

jeppech commented 6 years ago

Something that catches my eye, when scrubbing through the xorm logs, is the user_id's being inserted.

2017/11/21 13:42:20 [I] [SQL] INSERT INTO `action` (`user_id`,`op_type`,`act_user_id`,`repo_id`,`comment_id`,`is_deleted`,`ref_name`,`is_private`,`content`,`created_unix`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) []interface {}{1, 12, 1, 15, 2256, false, "", true, "194|", 1511268140}
2017/11/21 13:42:20 [I] [SQL] INSERT INTO `action` (`user_id`,`op_type`,`act_user_id`,`repo_id`,`comment_id`,`is_deleted`,`ref_name`,`is_private`,`content`,`created_unix`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) []interface {}{5, 12, 1, 15, 2256, false, "", true, "194|", 1511268140}
2017/11/21 13:42:20 [I] [SQL] INSERT INTO `action` (`user_id`,`op_type`,`act_user_id`,`repo_id`,`comment_id`,`is_deleted`,`ref_name`,`is_private`,`content`,`created_unix`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) []interface {}{3, 12, 1, 15, 2256, false, "", true, "194|", 1511268140}

The user triggering the action, is me (id=1). But somehow the users with id 3 and 5.

Here's another snippet, triggered by another user, this time it has 4 entries. User with id 5, triggered the action, but 3,13,14 are also shown.

2017/11/21 15:14:50 [I] [SQL] INSERT INTO `action` (`user_id`,`op_type`,`act_user_id`,`repo_id`,`comment_id`,`is_deleted`,`ref_name`,`is_private`,`content`,`created_unix`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) []interface {}{5, 10, 5, 27, 2264, false, "", true, "41|New icons on nextcloud.", 1511273690}
2017/11/21 15:14:50 [I] [SQL] INSERT INTO `action` (`user_id`,`op_type`,`act_user_id`,`repo_id`,`comment_id`,`is_deleted`,`ref_name`,`is_private`,`content`,`created_unix`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) []interface {}{13, 10, 5, 27, 2264, false, "", true, "41|New icons on nextcloud.", 1511273690}
2017/11/21 15:14:50 [I] [SQL] INSERT INTO `action` (`user_id`,`op_type`,`act_user_id`,`repo_id`,`comment_id`,`is_deleted`,`ref_name`,`is_private`,`content`,`created_unix`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) []interface {}{14, 10, 5, 27, 2264, false, "", true, "41|New icons on nextcloud.", 1511273690}
2017/11/21 15:14:50 [I] [SQL] INSERT INTO `action` (`user_id`,`op_type`,`act_user_id`,`repo_id`,`comment_id`,`is_deleted`,`ref_name`,`is_private`,`content`,`created_unix`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) []interface {}{3, 10, 5, 27, 2264, false, "", true, "41|New icons on nextcloud.", 1511273690}
lunny commented 6 years ago

@jeppech everyone who watch the project will receive a message.

jeppech commented 6 years ago

@lunny It's just, that the numbers of insert statements, matches the number of duplicated items, in the activity feed. So I thought, that it might had something to do with, each other.

jeppech commented 6 years ago

Now, I just tried commenting on a repository, with 2 watchers, but i still see 3 entries being inserted into the actions, again, which corresponds to the number of duplicate items, in my feed.

Have there been any changes, to watchers, prior to v1.2.1, that could course the number of duplicate items in the feed to equal with the number of watchers?

lafriks commented 6 years ago

Actions seems to be inserted with different user IDs

jeppech commented 6 years ago

According to lunny, that is expected. As an entry is added, for each user watching the repo. What about the statement, that retrieves the feed?

2017/11/28 09:29:25 [I] [SQL] 
SELECT `id`, `user_id`, `op_type`, `act_user_id`, `repo_id`, `comment_id`, `is_deleted`, `ref_name`, `is_private`, `content`, `created_unix`
FROM `action`
WHERE (
    user_id=? OR repo_id IN (
        SELECT repo_id 
        FROM `access`
        WHERE access.user_id = ?
    )
)
AND is_deleted=?
ORDER BY `id`
DESC LIMIT 20
[]interface {}{1, 1, false}

Could this be getting different results, for repos created prior or after v1.2.1?

jeppech commented 6 years ago

I'm happy to say, that my issues are gone, as of v1.3.0! Thank you! :)

lunny commented 6 years ago

@jeppech how did you resolve that?

jeppech commented 6 years ago

To be honest, I have no idea. Just upgraded my Gitea instance 5 minutes ago, and all the doubled feeds are gone.

So I'm suspecting that either a query has changed, or some filtering in the templates. Haven't looked into it, so cannot say for sure.

lunny commented 6 years ago

And maybe you should upgrade to v1.3.1 since it fixed some bugs on v1.3.0.

jeppech commented 6 years ago

I already did that too, thanks! :)

davidlai-webstandard commented 4 years ago

I am seeing the same problem - but with the latest Gitea (1.11.5).