We are seeing our copy jobs failing randomly with the following exception. We are suspecting it might be the _connector.Break call in the catch block that might be throwing the exception, though we're not entirely sure. It's hard to reproduce the error since it's not happening all the time, but it's probable that an exception is being lost in the catch block and NullReferenceException is being thrown instead.
System.NullReferenceException: Object reference not set to an instance of an object.
at Npgsql.NpgsqlRawCopyStream.<WriteAsync>g__WriteAsyncInternal|31_0(ReadOnlyMemory`1 buffer, CancellationToken cancellationToken)
Further technical details
Npgsql version: 7.0.4
PostgreSQL version: 11
Operating system: Ubuntu 22.04