Skip to content

Webhooks triggered twice #7702

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
2 of 7 tasks
0x1793d1 opened this issue Aug 1, 2019 · 27 comments · Fixed by #7821
Closed
2 of 7 tasks

Webhooks triggered twice #7702

0x1793d1 opened this issue Aug 1, 2019 · 27 comments · Fixed by #7821
Labels
Milestone

Comments

@0x1793d1
Copy link

0x1793d1 commented Aug 1, 2019

  • Gitea version (or commit ref): 1.9.0
  • Git version: 2.22.0
  • Operating system: Debian Buster / Docker
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant

Description

Hi,

Since 1.9.0, webhooks are triggered twice when committing via the website.

@lunny
Copy link
Member

lunny commented Aug 1, 2019

It seems there is one PR fixed that.

@0x1793d1
Copy link
Author

0x1793d1 commented Aug 1, 2019

You mean #7684?, I saw this PR, but it doesn't seem to work for my case.

@lunny
Copy link
Member

lunny commented Aug 1, 2019

No, I mean #7516, but it seems it hasn't been fixed.

@lunny lunny added the type/bug label Aug 1, 2019
@lunny lunny added this to the 1.9.1 milestone Aug 1, 2019
@zeripath zeripath closed this as completed Aug 1, 2019
@zeripath zeripath reopened this Aug 1, 2019
@zeripath
Copy link
Contributor

zeripath commented Aug 1, 2019

So I think this is because we're now running commits through the git hooks - so the webhook actions in commit repo action might be no longer needed.

@0x1793d1 are you sure that the webhooks you receive are absolutely the same?

@0x1793d1
Copy link
Author

0x1793d1 commented Aug 2, 2019

@lunny
Copy link
Member

lunny commented Aug 5, 2019

It seems recent version fixed this. But I don't know which PR did that.

@lunny
Copy link
Member

lunny commented Aug 7, 2019

I can't reproduce this on one 1.9.0 gitea instance with drone 1.1.0.

@lunny
Copy link
Member

lunny commented Aug 7, 2019

@0x1793d1 could you check if you have two webhooks from the same ci server.

@0x1793d1
Copy link
Author

0x1793d1 commented Aug 7, 2019

@lunny I am using Drone as CI server, and it receive two hooks when I commit via the website. I can reproduce this bug with a dummy webhook on try.gitea.io:

image

@quantonganh
Copy link
Contributor

I can't reproduce this on one 1.9.0 gitea instance with drone 1.1.0.

I can reproduce this on Gitea 1.9.0 with Drone 1.2.1.

@lunny Please notice that #7726 is a bit different from this: it happened when we merge a PR. #7702 happened when we commit via web interface.

@quantonganh
Copy link
Contributor

So I think this is because we're now running commits through the git hooks - so the webhook actions in commit repo action might be no longer needed.

@zeripath You mean this? https://github.com/go-gitea/gitea/blob/master/modules/repofiles/action.go#L115

@zeripath
Copy link
Contributor

zeripath commented Aug 8, 2019

Yeah that's my worry but I'm a busy at the moment to double check this.

@lunny
Copy link
Member

lunny commented Aug 9, 2019

I found this will occupy randomly in v1.9.0.

@sapk
Copy link
Member

sapk commented Aug 11, 2019

Looking at some logs, I can confirm that it add a task during post-receive call and a other one later after the post-receive ended.

@sapk
Copy link
Member

sapk commented Aug 11, 2019

I think that call to PushUpdate should not be call anymore on web edit like in CreateOrUpdateRepoFile:

func CreateOrUpdateRepoFile(repo *models.Repository, doer *models.User, opts *UpdateRepoFileOptions) (*structs.FileResponse, error) {
since it is now call via post-receive:
if err := repofiles.PushUpdate(repo, branch, models.PushUpdateOptions{

@sapk
Copy link
Member

sapk commented Aug 11, 2019

Deleting branch since to be triggered in double also but I am not sure for the second call path. -> It create a push and a delete event. I don't exactly know if it is the expected way.

@metal3d
Copy link

metal3d commented Sep 11, 2019

Is the "latest" docker image updated with that fix ? I updated image last friday (6 sept) and I still see that issue with Drone.
Thanks

@lafriks
Copy link
Member

lafriks commented Sep 11, 2019

It should be, what kind of webhook was trigger for you twice?

@metaisfabien
Copy link

Is the "latest" docker image updated with that fix ? I updated image last friday (6 sept) and I still see that issue with Drone.
Thanks

For me gitea/gitea:last send twice gitea/gitea:1.10 send one time.

@adrianyorke
Copy link

I am seeing this behavior for 1.12.0+dev-161-gf6067a846/git version 2.20.1/Debian Buster/SQLite:
image
image

@zeripath
Copy link
Contributor

@adrianyorke that looks different, that's duplicate notifications and I suspect you may have two Gitea post-receive hooks in your repository.

But please open a different issue if you don't

@adrianyorke
Copy link

Thanks for replying @zeripath. Apologies, I was a little embarrassed when I realized I had added a comment to a Closed issue. I really wasn't expecting a reply, especially "same day" so thank you. I will experiment more and report back. So far this is a "default installation" but let's see.

@john-kheir
Copy link

I can see this issue on 1.11.1 which supposed to be the last official release

root@ff1a92d193e9:~# ./gitea --version
Gitea version 1.11.1 built with GNU Make 4.1, go1.13.8 : bindata, sqlite, sqlite_unlock_notify

two triggers

@lafriks
Copy link
Member

lafriks commented Feb 29, 2020

I think similar issue was fixed and will be in 1.11.2

@nagos
Copy link
Contributor

nagos commented Mar 17, 2020

Same stuff on 1.12.0+dev-20-gca181100c
gitea
Git push send duplicate triggers.
Gitea + drone.

And on 1.11.3
But 1.10.6 work fine, withoud duplicates.

@adrianyorke
Copy link

This is a closed thread but for anyone turning up here, my problem went away after the first day or so. I didn't need to fix anything myself or change any config, the duplicate triggers just stopped happening. Gitea has been stable since.

@nagos
Copy link
Contributor

nagos commented Mar 17, 2020

This is a closed thread but for anyone turning up here, my problem went away after the first day or so. I didn't need to fix anything myself or change any config, the duplicate triggers just stopped happening. Gitea has been stable since.

You are right! Issue went away after i restarted gitea.
So my guess, when they add trigger during configuration, it got added twice. But after restart, it loads from configuration file correctly.

@go-gitea go-gitea locked and limited conversation to collaborators Mar 17, 2020
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.