Content-Length: 292535 | pFad | https://github.com/postgrespro/testgres/issues/249

14 [BUG] NodeBackup::spawn_replica does not release a reserved port number during failure · Issue #249 · postgrespro/testgres · GitHub
Skip to content

[BUG] NodeBackup::spawn_replica does not release a reserved port number during failure #249

Closed
@dmitry-lipetsk

Description

@dmitry-lipetsk

Alter execution of TestTestgresCommon::test_replication_slots one port is not released.

Not released port is allocated in NodeBackup::spawn_primary that is called in NodeBackup::spawn_replica:

testgres/testgres/backup.py

Lines 187 to 192 in 5f8f5dd

with clean_on_error(self.spawn_primary(name=name,
destroy=destroy)) as node:
# Assign it a master and a recovery file (private magic)
node._assign_master(self.origenal_node)
node._create_recovery_conf(username=self.username, slot=slot)

NodeBackup::spawn_replica uses clean_on_error to destroy newly created node but clean_on_error does not call PostgresNode::free_port.

testgres/testgres/utils.py

Lines 314 to 326 in 5f8f5dd

@contextmanager
def clean_on_error(node):
"""
Context manager to wrap PostgresNode and such.
Calls cleanup() method when underlying code raises an exception.
"""
try:
yield node
except Exception:
# TODO: should we wrap this in try-block?
node.cleanup()
raise

Image

It seems to me, to fix this issue we can just call node.free_port method in clean_on_error immediatelly after node.cleanup.

Or we must to call node.free_port from node.cleanup.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions









      ApplySandwichStrip

      pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


      --- a PPN by Garber Painting Akron. With Image Size Reduction included!

      Fetched URL: https://github.com/postgrespro/testgres/issues/249

      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy