efcore.pg: Huge Bulk Insert Connection Problem

I have a DataSeeder console app and I am using Bogus tool for dummy data;

var dummyData = new Faker<SampleDecision>("tr")
    .RuleFor(s => s.DecisionCaption, i => i.Lorem.Paragraph(1))
    .RuleFor(s => s.DecisionText, i => i.Lorem.Paragraphs(66)) <<----------
    .RuleFor(s => s.EssenceNumber, i => i.Lorem.Paragraphs(1))
    .RuleFor(s => s.DecisionDate, i => i.Date.PastDateOnly())
    .RuleFor(s => s.DecisionExplanation, i => i.Lorem.Paragraphs(15))
    .Generate(99);
await context.SampleDecisions.AddRangeAsync(dummyData);
await context.SaveChangesAsync();

I am using this method for x7 times for different tables and I am calling SaveChangesAsync for once. When I change the .RuleFor(s => s.DecisionText, i => i.Lorem.Paragraphs(66)) 66 to 67, it crashs (text with about 15k character). So If I have huge data the connection is losts. Similarly if I change the .Generate(99) count to 1500 and also i.Lorem.Paragraphs(66) count to 25, I am facing with same problem. By the way when I try to set DecisionText manually to 180k character for single record, it works.

i.Lorem.Paragraphs(66) => generates about 15k character text.

.NET 7 Npgsql.EntityFrameworkCore.PostgreSQL => 7.0.3 Microsoft.EntityFrameworkCore => 7.0.3

Exceptions

 InnerException    {"Exception while reading from stream"}    System.Exception {Npgsql.NpgsqlException}
 Timeout during reading attempt
 'An exception has been raised that is likely due to a transient failure.'

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Comments: 17 (9 by maintainers)

Most upvoted comments

@abdulkadirkg it sometimes takes a few days for us to be able to look at issues in-depth.