Pagination Issues: Duplicated Maven Packages in GET API Responses #12919

Open
opened 2025-11-02 10:25:02 -06:00 by GiteaMirror · 1 comment
Owner

Originally created by @dianaStr7 on GitHub (Apr 26, 2024).

Description

When querying Maven packages from the Gitea using the endpoint {base_url}/packages/{owner}?page={page}&limit={PAGE_SIZE}&type=maven, duplicate entries appear across different pages, especially when the total number of packages is very large (like 20,000). Sometimes, if you request the same page again, the duplicate packages won't appear, showing that the way pages are filled with packages can be unpredictable. Additionally, if you make the same request multiple times, you might get different packages each time.

Gitea Version: a36636357
Deployment: The Gitea instance is running within a Kubernetes pod managed by Rancher.
Database Used: PostgreSQL 12.17-bullseye
Additional Context: This issue might be related to how pagination is implemented in the backend storage or indexing system used by Gitea for package management.

Steps to Reproduce

  1. Send a GET request to {base_url}/packages/{owner}?page=1&limit=20&type=maven with a high total package count ( in our case more then 20000)
  2. Note the packages returned and repeat the request for the same page.
  3. Compare the results from both requests and note any duplicates.
  4. Optionally, continue to the next page and check for overlap with previous pages.

Expected Behavior

Each page requested should return a unique set of packages without overlap, regardless of the number of times the same page is queried.

Actual Behavior

Some package entries are duplicated across multiple page results, and the same page request can yield different packages on subsequent queries.

Gitea Version

a36636357

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

Linux

How are you running Gitea?

The Gitea instance is running within a Kubernetes pod managed by Rancher.

Database

PostgreSQL

Originally created by @dianaStr7 on GitHub (Apr 26, 2024). ### Description When querying Maven packages from the Gitea using the endpoint `{base_url}/packages/{owner}?page={page}&limit={PAGE_SIZE}&type=maven`, duplicate entries appear across different pages, especially when the total number of packages is very large (like 20,000). Sometimes, if you request the same page again, the duplicate packages won't appear, showing that the way pages are filled with packages can be unpredictable. Additionally, if you make the same request multiple times, you might get different packages each time. **Gitea Version**: a36636357 **Deployment**: The Gitea instance is running within a Kubernetes pod managed by Rancher. **Database Used**: PostgreSQL 12.17-bullseye **Additional Context**: This issue might be related to how pagination is implemented in the backend storage or indexing system used by Gitea for package management. **Steps to Reproduce** 1. Send a GET request to `{base_url}/packages/{owner}?page=1&limit=20&type=maven` with a high total package count ( in our case more then 20000) 2. Note the packages returned and repeat the request for the same page. 3. Compare the results from both requests and note any duplicates. 4. Optionally, continue to the next page and check for overlap with previous pages. **Expected Behavior** Each page requested should return a unique set of packages without overlap, regardless of the number of times the same page is queried. **Actual Behavior** Some package entries are duplicated across multiple page results, and the same page request can yield different packages on subsequent queries. ### Gitea Version a36636357 ### Can you reproduce the bug on the Gitea demo site? No ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version _No response_ ### Operating System Linux ### How are you running Gitea? The Gitea instance is running within a Kubernetes pod managed by Rancher. ### Database PostgreSQL
GiteaMirror added the topic/packagestype/bug labels 2025-11-02 10:25:02 -06:00
Author
Owner

@KN4CK3R commented on GitHub (Apr 28, 2024):

Do you know it that's a new problem? Then #30520 could be the reason.

@KN4CK3R commented on GitHub (Apr 28, 2024): Do you know it that's a new problem? Then #30520 could be the reason.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#12919