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

OverflowException with large data #85

Closed
rh-51662 opened this issue Mar 29, 2023 · 3 comments
Closed

OverflowException with large data #85

rh-51662 opened this issue Mar 29, 2023 · 3 comments
Labels

Comments

@rh-51662
Copy link

rh-51662 commented Mar 29, 2023

OverflowException occurs when trying to add large data to DatabaseBuilder.
Add large data using the ImmutableBuilder's Diff method does not throw OverflowException .

Is it possible to avoid this Exception by changing some settings?

Here is the source code I ran

var builder = new DatabaseBuilder();
var list = new List<Person>();
for (int i = 0; i < 100000000; i++)
{
    list.Add(new Person { PersonId = i, Age = i, Gender = (Gender)(i % 2), Name = "AAAAAAAAAAA" });
}
builder.Append(list);

ImmutableBuilder's Diff method does not throw OverflowException

var builder = new DatabaseBuilder();
var list = new List<Person>();

for (int i = 0; i < 100000000; i++)
{
    list.Add(new Person { PersonId = i, Age = i, Gender = (Gender)(i % 2), Name = "AAAAAAAAAAA" });
}

var firstData = list.First();
builder.Append(new List<Person>() { firstData });
byte[] dataA = builder.Build();
var db = new MemoryDatabase(dataA);

var builder1 = db.ToImmutableBuilder();
builder1.Diff(list.Skip(1).ToArray());
db = builder1.Build();

builder.Append(list);
MessagePack.MessagePackSerializationException   HResult=0x80131500   Message=Failed to serialize MasterMemorytest3.Model.Person[] value.   Source=MessagePack   スタック トレース:    場所 MessagePack.MessagePackSerializer.Serialize[T](MessagePackWriter& writer, T value, MessagePackSerializerOptions options)    場所 MessagePack.MessagePackSerializer.Serialize[T](IBufferWriter`1 writer, T value, MessagePackSerializerOptions options, CancellationToken cancellationToken)    場所 MasterMemory.DatabaseBuilderBase.AppendCore[T,TKey](IEnumerable`1 datasource, Func`2 indexSelector, IComparer`1 comparer)    場所 MasterMemorytest3.DatabaseBuilder.Append(IEnumerable`1 dataSource) (F:\\src\\source\\repos\\MasterMemorytest\\MasterMemorytest3\\MasterMemory\\DatabaseBuilder.cs):行 29    場所 MasterMemorytest3.Program.Test1() (F:\\src\\source\\repos\\MasterMemorytest\\MasterMemorytest3\\Program.cs):行 39    場所 MasterMemorytest3.Program.Main(String[] args) (F:\\src\\source\\repos\\MasterMemorytest\\MasterMemorytest3\\Program.cs):行 21    この例外は、最初にこの呼び出し履歴      [外部コード] でスローされました  内部例外 1: OverflowException: Arithmetic operation resulted in an overflow.
@github-actions
Copy link
Contributor

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 30 days.

@github-actions github-actions bot added the stale label Sep 27, 2023
@neuecc neuecc removed the stale label Sep 27, 2023
@livwvil
Copy link

livwvil commented Nov 7, 2023

I faced the same problem

Copy link
Contributor

github-actions bot commented May 6, 2024

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 30 days.

@github-actions github-actions bot added the stale label May 6, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants