Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Asynchronous tasks ID sequence can exhaust

Open
#277 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
django, postgresql, python
Domain
backend, databases

Research direction

Start by locating the Task model and checking its primary-key references and migrations; the issue does not name specific files or tests. Verify what depends on numeric task IDs before changing the key. Done means Task.uuid is the UUID4 primary key, the sequence is removed, and no logic depends on numeric task IDs.

Written by the indexing model from the issue text.

Description

In some Flagsmith installs with a lot of dashboard activity and analytics turned on, the Task.id field can yield a sequence exhaustion error in Postgres:

django.db.utils.DataError: nextval: reached maximum value of sequence "task_processor_task_id_seq" (2147483647)

Although https://github.com/Flagsmith/flagsmith/pull/5358 has alleviated the accumulation of items by preventing /api/v1/flags/ from enqueuing new tasks for analytics tracking, we're bound to hit that limit eventually.

Seemingly, this only affects instances with analytics enabled. As such, a temporary fix includes:

  1. Upgrading Flagsmith to a version equal or newer than v2.173.1. This alone should postpone the exhaustion by many years in most installs.
  2. Shifting the sequence axis so it consumes negative numbers, i.e.:
ALTER SEQUENCE task_processor_task_id_seq MINVALUE -2147483648 RESTART WITH -2147483648;

Acceptance criteria

  • Promote Task.uuid to a primary key defaulting to UUID4(), dismissing a sequence entirely. Must ensure no logic depends on numeric task IDs.
Dominant language
Python
Stars
2
Forks
4
Avg merge
1h 7m
Merged PRs (30d)
4

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Flagsmith/flagsmith-common

All issues in Flagsmith/flagsmith-common

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.