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

Deleted users lead to 500 responses on various time-related API endpoints #22006

Closed
danieldietsch opened this issue Dec 2, 2022 · 4 comments · Fixed by #22021
Closed

Deleted users lead to 500 responses on various time-related API endpoints #22006

danieldietsch opened this issue Dec 2, 2022 · 4 comments · Fixed by #22021
Labels
Milestone

Comments

@danieldietsch
Copy link

Description

When a user deletes their account, they become a Ghost account.
Such a user may already have logged time on issues.
image

In such a case, the following web API endpoints return 500.

  • GET /repos/{owner}/{repo}/issues/{index}/times
  • GET /repos/{owner}/{repo}/times
    Other endpoints may also be affected, but our scripts did only ran into trouble here.

In particular not affected is GET /repos/{owner}/{repo}/times/{user} as long as user is not the id of a deleted user.

Gitea Version

1.17.2

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

We are running Gitea with docker from image: gitea/gitea:1.17.2. Gitea DB is mariadb:10.9.2. The web API is behind a traefik reverse proxy.

Database

MySQL

@lunny lunny added this to the 1.17.4 milestone Dec 2, 2022
@lunny
Copy link
Member

lunny commented Dec 2, 2022

Have you tried to upgrade to 1.17.3 ?

@danieldietsch
Copy link
Author

Yes, did it just now. Issue is still present.

@zeripath
Copy link
Contributor

zeripath commented Dec 3, 2022

It would be very helpful to see the logs for these.

@danieldietsch
Copy link
Author

I am sorry, we did not retain logs.
A easy workaround is removing the user in question manually from the DB (just delete all entries of the user from tracked_time).

But repro should be easy:

  • Create new user
  • Log time to some issue
  • Delete user
  • Query API for issue or repo in question with admin user

zeripath added a commit to zeripath/gitea that referenced this issue Dec 3, 2022
When getting tracked times out of the db and loading their attributes handle not exist errors
in a nicer way. (Also prevent an NPE.)

Fix go-gitea#22006

Signed-off-by: Andrew Thornton <art27@cantab.net>
zeripath added a commit that referenced this issue Dec 4, 2022
When getting tracked times out of the db and loading their attributes
handle not exist errors in a nicer way. (Also prevent an NPE.)

Fix #22006

Signed-off-by: Andrew Thornton <art27@cantab.net>
zeripath added a commit to zeripath/gitea that referenced this issue Dec 4, 2022
Backport go-gitea#22021

When getting tracked times out of the db and loading their attributes
handle not exist errors in a nicer way. (Also prevent an NPE.)

Fix go-gitea#22006

Signed-off-by: Andrew Thornton <art27@cantab.net>
lafriks pushed a commit that referenced this issue Dec 5, 2022
Backport #22021

When getting tracked times out of the db and loading their attributes
handle not exist errors in a nicer way. (Also prevent an NPE.)

Fix #22006

Signed-off-by: Andrew Thornton <art27@cantab.net>

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants