#2435 hastag test leaks cursors
Closed: Fixed 3 years ago by tkopecek. Opened 3 years ago by tkopecek.

Using hastag with force/tagBuildBypass can lead to leaking cursors which can skip random builds in clone-tag and probably in some other operations.

#2010 should make these errors visible, but it needs to be fixed on cursor-handling level too.


We were seeing duplicate cursor errors which is surprising because our cursor names seem pretty unique.

"qp_cursor_%s_%i_%i" % (id(self), os.getpid(), self.cursors)

This incorporates the id of the QueryProcessor instance, the pid, and an incrementing counter from the instance.

What I think was happening was that the QueryProcessor instance was getting garbage collected before the generator was exhausted, then a new QueryProcessor instance was created with the same address (hence same id).

My suggested fix in #2436 solves this by putting the cursor close statement in a finally: section so that it gets executed when the instance is garbage collected.

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

3 years ago

I was able to replicate this with the following test code:

test = HasTagTest('hastag *')
pdata = {'build': build}
for i in range(1000):
    res = test.run(pdata)

I set up a build that had a large number of tags and used that for the test. The problem replicated readily. With #2436, the problem stopped.

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

3 years ago

Metadata Update from @mfilip:
- Issue tagged with: testing-done

3 years ago

Login to comment on this ticket.

Metadata
Related Pull Requests
  • #2436 Merged 3 years ago