#2854 Kojira can generate SequenceErrors
Closed: Fixed by tkopecek. Opened by mikem.

For example

Traceback (most recent call last):
  File "/usr/sbin/kojira", line 1063, in main
    repomgr.updateRepos()
  File "/usr/sbin/kojira", line 753, in updateRepos
    self.readCurrentRepos()
  File "/usr/sbin/kojira", line 422, in readCurrentRepos
    if not getTag(self.session, repo.tag_id) and not repo.expired():
  File "/usr/sbin/kojira", line 54, in getTag
    info = session.getTag(tag, event=event)
  File "/usr/lib/python3.6/site-packages/koji/__init__.py", line 2360, in __call__
    return self.__func(self.__name, args, opts)
  File "/usr/lib/python3.6/site-packages/koji/__init__.py", line 2790, in _callMethod
    raise err
koji.SequenceError: 912005 > 912003 (session 11754010)

This is what I believe is happening:

The ManagedRepo class is given a session object in init. These objects are created in the main thread, but can be accessed in the others. In particular, the deleteRepos() function does this, runs in another thread, and makes hub calls that involve commits (and thus record a higher sequence id in the db).

In the ManagedRepo init, it does: self.session = manager.session. The manager session is a special threadlocal propertry, but we're storing just the single value at init time. Likely we just need to make ManagedRepo.session a property that looks up manager.session, therefore getting the correct session for the thread.

Metadata Update from @mikem:
- Custom field Size adjusted to None

PR #2855

Metadata Update from @tkopecek:
- Issue set to the milestone: 1.25

Commit f2c314d0 fixes this issue

Commit 562b325c fixes this issue

Metadata Update from @jcupova:
- Issue tagged with: testing-ready

Metadata Update from @tkopecek:
- Issue untagged with: testing-ready
- Issue tagged with: no_qe

This issue has been migrated to Fedora Forge:
https://forge.fedoraproject.org/koji/koji/issues/2854

Please continue any further discussion there.

Metadata
Related Pull Requests