Skip to content

AsyncRead/AsyncWrite Poisoning Behaviour #87

@tustvold

Description

@tustvold

Is your feature request related to a problem or challenge? Please describe what you are trying to do.

Currently where ObjectStore exposes APIs in terms of tokio's AsyncWrite and AsyncRead, any error poisons the entire operation. Subsequent attempts to read/write will likely result in a panic. This is not well documented, and may not be ideal.

Describe the solution you'd like

At the very least we should document the current behaviour, but it is unclear, at least to me, what the "correct" behaviour here even is:

AsyncWrite::poll_write returns when the bytes have been "written" to the writer, including potentially to an in-flight buffer, see here. In the case of WriteMultiPart this means AsyncWrite::poll_write returns Ok before any network to actually write the data to object storage.

Any errors will therefore be surfaced in AsyncWrite::poll_flush or AsyncWrite::poll_shutdown, which presents a few problems:

  • The PutPart implementation retries intermittent errors based on the RetryConfig, and so we must surface any errors to the user
  • It is unclear how the caller can determine from the error what byte range needs to be retried, as part uploads are chunked and parallel
  • It is unclear how the caller could retry this byte range even if it could be ascertained

This all makes me think that the current behaviour is probably the best we can do, short of not using the tokio IO traits, but I wonder if others have any thoughts on this

Describe alternatives you've considered

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions