Hi, keithh.
We noticed it’s very slow to publish some very large event. After debugging into the code, we found the thread entered into infinite loop during event serialization, can you help check whether it’s a bug:
private void AppendBytes(byte[] src, int offset, int length)
{
if ((position + length) > buffer.Length)
{
int newLength = buffer.Length;
while( newLength < (position + length) ) //Compare the value
{
if ((int.MaxValue / 2) > buffer.Length)
{
newLength = buffer.Length * 2; // Give a bigger value?
}
Seem if newLength is not bigger than position + length after buffer.Length * 2 is given as the new value, the while loop never has the chance to reach to the end. Can you suggest how to make a prefect fix on this? For now, we change the code as below; however, we are not sure about this change, please help。
{
if ((position + length) > buffer.Length)
{
int newLength = buffer.Length;
while( newLength < (position + length) )
{
if ((int.MaxValue / 2) > newLength)
{
newLength = newLength * 2;
}
Thanks
|