Unable to delete all unactivated accounts #13201

Closed
opened 2025-11-02 10:34:43 -06:00 by GiteaMirror · 7 comments
Owner

Originally created by @ggodlewski on GitHub (Jun 24, 2024).

Description

I'm trying to get rid of spam users (over 800 of them)
I changed them to inactive following instructions from https://blog.roberthallam.org/2022/11/mass-delete-remove-purge-users-in-gitea/
Because I'm using sqlite3 it was: UPDATE user SET is_active = 'f' WHERE email != 'my@email';
In the UI all the users except mine are marked inactive.

Then I run Delete all unactivated accounts
It says Started Task: Delete all unactivated accounts using greenish text.

Nothing happens. I still have over 800 accounts.

Gitea Version

1.22.0

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

https://gist.github.com/ggodlewski/c17fb25618c3fac0539ae6891da66b6f

Screenshots

image
image

Git Version

2.45.1

Operating System

docker @ ubuntu

How are you running Gitea?

docker container: gitea/gitea:latest

Database

SQLite

Originally created by @ggodlewski on GitHub (Jun 24, 2024). ### Description I'm trying to get rid of spam users (over 800 of them) I changed them to inactive following instructions from https://blog.roberthallam.org/2022/11/mass-delete-remove-purge-users-in-gitea/ Because I'm using sqlite3 it was: `UPDATE user SET is_active = 'f' WHERE email != 'my@email';` In the UI all the users except mine are marked inactive. Then I run `Delete all unactivated accounts` It says `Started Task: Delete all unactivated accounts` using greenish text. Nothing happens. I still have over 800 accounts. ### Gitea Version 1.22.0 ### Can you reproduce the bug on the Gitea demo site? No ### Log Gist https://gist.github.com/ggodlewski/c17fb25618c3fac0539ae6891da66b6f ### Screenshots ![image](https://github.com/go-gitea/gitea/assets/818238/66886cc8-d986-44bc-a4fb-f387af9989f4) ![image](https://github.com/go-gitea/gitea/assets/818238/f6690bcf-89b8-4fb6-bd34-f8b12658684c) ### Git Version 2.45.1 ### Operating System docker @ ubuntu ### How are you running Gitea? docker container: gitea/gitea:latest ### Database SQLite
GiteaMirror added the type/bug label 2025-11-02 10:34:43 -06:00
Author
Owner

@kemzeb commented on GitHub (Jun 24, 2024):

Are these accounts new?

If this is the case, what I believe is happening currently is that when you run this task, we would only delete accounts that are older than some amount of time. Looking at this particular task in the code, we would only delete inactive users that are older than 3 hours by default (this would be different if you explicity set ACTIVE_CODE_LIVE_MINUTES in your config).

@kemzeb commented on GitHub (Jun 24, 2024): Are these accounts new? If this is the case, what I believe is happening currently is that when you run this task, we would only delete accounts that are older than some amount of time. Looking at this particular task in the [code](https://github.com/go-gitea/gitea/blob/053e5829a388ce32dce4ff0ab97158b7b2a2fcc4/services/cron/tasks_extended.go#L30), we would only delete inactive users that are older than 3 hours by default (this would be different if you explicity set [ACTIVE_CODE_LIVE_MINUTES](https://docs.gitea.com/next/administration/config-cheat-sheet#service-service) in your config).
Author
Owner

@wxiaoguang commented on GitHub (Jun 25, 2024):

Not all inactive accounts could be deleted automatically, there are more checks in DeleteInactiveUsers

@wxiaoguang commented on GitHub (Jun 25, 2024): Not all inactive accounts could be deleted automatically, there are more checks in DeleteInactiveUsers
Author
Owner

@ggodlewski commented on GitHub (Jun 25, 2024):

I set ACTIVE_CODE_LIVE_MINUTES to 180 (was empty). Still nothing.

Inactive account from Dec 13, 2023 not deleted.
User doesn't have repos/orgs/packages
https://github.com/go-gitea/gitea/blob/main/services/user/user.go#L291C1-L291C6

The only thing I can think of is that I'm getting this green confirmation but the tasks is not executed.
How are those tasks executed?

@ggodlewski commented on GitHub (Jun 25, 2024): I set ACTIVE_CODE_LIVE_MINUTES to 180 (was empty). Still nothing. Inactive account from Dec 13, 2023 not deleted. User doesn't have repos/orgs/packages https://github.com/go-gitea/gitea/blob/main/services/user/user.go#L291C1-L291C6 The only thing I can think of is that I'm getting this green confirmation but the tasks is not executed. How are those tasks executed?
Author
Owner

@Clortox commented on GitHub (Oct 16, 2024):

I'm experiencing this problem as well with gitea 1.22.3. The newest account was made 7 days ago. Did you have any luck finding a workaround?

@Clortox commented on GitHub (Oct 16, 2024): I'm experiencing this problem as well with gitea 1.22.3. The newest account was made 7 days ago. Did you have any luck finding a workaround?
Author
Owner

@ggodlewski commented on GitHub (Oct 17, 2024):

I don't remember it. Since I didn't close this issue I think I've removed them manually from database using the condition from the code.

@ggodlewski commented on GitHub (Oct 17, 2024): I don't remember it. Since I didn't close this issue I think I've removed them manually from database using the condition from the code.
Author
Owner

@lunny commented on GitHub (Oct 22, 2024):

I created #32318 to log the error reason.

@lunny commented on GitHub (Oct 22, 2024): I created #32318 to log the error reason.
Author
Owner

@JcDenis commented on GitHub (Nov 16, 2024):

Same problem here.
Task failed because it was trying to delete organization.
Response from log here is:
Task: Delete all unactivated accounts canceled: xyz is an organization not a user

[edit]
After moving organizations repositories to a user and deleted organizations, task deletes more users but not all. and no error nor log.

@JcDenis commented on GitHub (Nov 16, 2024): Same problem here. Task failed because it was trying to delete organization. Response from log here is: `Task: Delete all unactivated accounts canceled: xyz is an organization not a user` [edit] After moving organizations repositories to a user and deleted organizations, task deletes more users but not all. and no error nor log.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#13201