Skip to content

"ConnectionResetError: Connection lost" occurs when disk space is 100% used. #182

@tvvister

Description

@tvvister

In case when space is not enough on the server side the stream.write operation fails with ConnectionResetError.
msg is like that 'Connection lost', and that's it, nothing is useful at all:

from aioftp import Client


async def main():
    client = Client()
    await client.connect(
        '0.0.0.0',
        port=21,
    )
    await client.login(
        user='',
        password='*',
    )
    try:
        stream = await client.upload_stream('test.txt', offset=0)
        await stream.write(b'data' * 1000)
    except ConnectionResetError:
        prepare_next_try()

Is there way to recognize that the problem is related to the shortage of volume rather than network issue?
If there is, then it would be helpful to make a stop of uploading instead of keep trying to reconnect endlessly.

Here is an example which shows something similar i suppose to have:

    try:
        stream = await client.upload_stream('test.txt', offset=0)
        await stream.write(b'data' * 1000)
    except ConnectionResetError:
        prepare_next_try()
    except NoSpaceError:
        stop_uploading()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions