Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FlushAsync problem if there are too many decimals the driver says we need to use FlushAsync #5

Open
dlebee opened this issue Apr 12, 2024 · 1 comment
Assignees

Comments

@dlebee
Copy link
Contributor

dlebee commented Apr 12, 2024

Might be related to npgsql/npgsql#5362

How to reproduce change demo to use 101 iterations instead of 72

we don't need that many decimals right now, but i'll try to see the caps and if the bytes buffer is too larger I could
Write -> FlushAsync then Write -> FlushAsync that may solve the problem.

 ---> System.NotSupportedException: Cannot call Flush on a non-blocking PgWriter, call FlushAsync instead.
   at Npgsql.Internal.PgWriter.Flush(Boolean allowWhenNonBlocking, TimeSpan timeout)
   at Npgsql.Internal.PgWriter.WriteBytes(Boolean allowMixedIO, ReadOnlySpan`1 buffer)
   at Npgsql.Internal.PgWriter.WriteBytes(ReadOnlySpan`1 buffer)
   at Nethereum.Npgsql.BigDecimalConverter.WriteCore(PgWriter writer, BigDecimal value) in /Users/gluwadl/Dev/Experimentations/Nethereum.Npgsql/Nethereum.Npgsql/BigDecimalConverter.cs:line 83
   at Npgsql.Internal.PgBufferedConverter`1.Write(PgWriter writer, T value)
   at Npgsql.Internal.PgBufferedConverter`1.WriteAsObject(Boolean async, PgWriter writer, Object value, CancellationToken cancellationToken)
   at Npgsql.Internal.PgConverter.WriteAsObjectAsync(PgWriter writer, Object value, CancellationToken cancellationToken)
   at Npgsql.NpgsqlParameter.WriteValue(Boolean async, PgWriter writer, CancellationToken cancellationToken)
   at Npgsql.NpgsqlParameter.Write(Boolean async, PgWriter writer, CancellationToken cancellationToken)
   at Npgsql.Internal.NpgsqlConnector.WriteBind(List`1 parameters, String portal, Byte[] asciiName, Boolean allResultTypesAreUnknown, Boolean[] unknownResultTypeList, Boolean async, CancellationToken cancellationToken)
   at Npgsql.NpgsqlCommand.<Write>g__WriteExecute|100_0(NpgsqlConnector connector, Boolean async, Boolean flush, CancellationToken cancellationToken)
   at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken)
   at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken)
   at Npgsql.NpgsqlCommand.ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(IList`1 entriesToSave, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(StateManager stateManager, Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
   at Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.NpgsqlExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func`4 operation, Func`4 verifySucceeded, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
   at Program.<Main>$(String[] args) in /Users/gluwadl/Dev/Experimentations/Nethereum.Npgsql/Demo/Program.cs:line 59
   at Program.<Main>(String[] args)```
@dlebee dlebee self-assigned this Apr 12, 2024
@dlebee
Copy link
Contributor Author

dlebee commented Apr 12, 2024

to be more specific it breaks exactly at i == 92, which means

92 whole numbers and 92 decimal numbers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant