Skip to main content
Example was requested
Source Link
Netch
  • 2.7k
  • 19
  • 17

Fixed by explicit closing of stdin channel in paramiko after sending the archive bytes.

channels = client.exec_command(...)
stdin = channels[0]
with open(archive_path, "rb") as pca:
    while True:
        block = pca.read(BLOCKSIZE)
        if not block:
            break
        stdin.write(block)
stdin.close() ## <-- added this

It seems tar is postponing finalization of some details to end of the whole input processing, and the channel object was hanging in Python memory.

Fixed by explicit closing of stdin channel in paramiko after sending the archive bytes.

It seems tar is postponing finalization of some details to end of the whole input processing, and the channel object was hanging in Python memory.

Fixed by explicit closing of stdin channel in paramiko after sending the archive bytes.

channels = client.exec_command(...)
stdin = channels[0]
with open(archive_path, "rb") as pca:
    while True:
        block = pca.read(BLOCKSIZE)
        if not block:
            break
        stdin.write(block)
stdin.close() ## <-- added this

It seems tar is postponing finalization of some details to end of the whole input processing, and the channel object was hanging in Python memory.

Source Link
Netch
  • 2.7k
  • 19
  • 17

Fixed by explicit closing of stdin channel in paramiko after sending the archive bytes.

It seems tar is postponing finalization of some details to end of the whole input processing, and the channel object was hanging in Python memory.