-
Notifications
You must be signed in to change notification settings - Fork 93
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
"engine: cache-max-memory-size exceeded" when using WriteApiAsync #164
Comments
Hi @digital-spinner, thanks for using our client. Did you try to reuse the Regards |
Thank you for your concern and answer! I have tried to use one client and one writeApiAsync per task as in the example I have attached which results in the exception I have posted. When I tried to get the new WriteApiAsync before each WritePointsAsync(...) method, then there is no exception but the RAM is eaten up to the point the Windows can't run anymore. The RAM usage of example console app stays at stable level the whole time it is running. In my example you can set the parallelTask variable to only 1 and the result will be actually the same as when using multiple tasks. |
The problem could caused by inefficient uses of I've used a version with creating the LineProtocol: private static Task WriteSomethingRecord(WriteApiAsync writeApiAsync, Random randomGenerator)
{
var lineProtocol = new StringBuilder();
lineProtocol.Append("measurement,tagName=tagValue ");
int i = 1;
for (; i <= 100; i++)
{
lineProtocol.Append($"something_{i:D4}={randomGenerator.Next()}i,");
}
for (; i <= 200; i++)
{
lineProtocol.Append($"something_{i:D4}={randomGenerator.NextDouble()},");
}
for (; i <= 300; i++)
{
lineProtocol.Append($"something_{i:D4}=");
lineProtocol.Append('"');
foreach (var c in GenerateRandomString(randomGenerator, 64 * 1024))
{
switch (c)
{
case '\\':
case '\"':
lineProtocol.Append("\\");
break;
}
lineProtocol.Append(c);
}
lineProtocol.Append('"');
lineProtocol.Append(',');
}
// remove last ','
lineProtocol.Remove(lineProtocol.Length - 1, 1);
lineProtocol.Append(' ');
var epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
lineProtocol.Append((BigInteger) (DateTime.UtcNow - epoch).TotalMilliseconds);
return writeApiAsync.WriteRecordAsync(bucket, org, WritePrecision.Ms, lineProtocol.ToString());
} and then the RAM usage is consistent. Today I don't have access to Win machine, so I did the test on MacOS. Could you test it with LineProtocol? |
Thank you. I have tested line protocol implementation as above. The issue persist. Please take a look onto attached screenshot. After shutting down the test application and Visual Studio system needs to be restarted because RAM usage is not going to it's previous level. |
I have been testing the same examples also on Linux (Ubuntu 20.04) client OS inside vmware VM and found that the RAM usage there is not a problem, but the same exception occurs randomly. But I had to wait for it - it appeared after transferring about 30GB of data through the network interface. |
The exception is thrown by InfluxDB. Does your hardware fit the sizing guideline? https://docs.influxdata.com/influxdb/v1.8/guides/hardware_sizing/ |
Thank you for your answer. Now I understand that my bug report contains two issues actually. About the exception - now I understand what is going on and maybe how to handle it properly - will need to do more tests and research though. About the RAM usage / leak? on Windows - can you confirm the issue is real as I described? |
Hi @digital-spinner, Today, I had enough time investing your issue on Win platform and I got same results - too high RAM usage. The RAM usage is in correlation with size of LineProtocol - If we reduce amount of string fields than the usage is lower. ResultsTesting codeRegards |
Thank you! But did you noticed that this will never recover to the base state (before running the testing code)? I mean it will not release the used RAM. In my case only the reboot of Windows machine solves the issue. |
It looks that problem is caused by High Usage of Non-Paged Pool: but the process Could you check it? |
Yes this is the behavior I'm experiencing. And the RAM can be released only by rebooting the Windows. Moreover there is one strange thing.. When I run this code from Rider IDE as a first thing after the system reboot than I couldn't observe RAM usage problem.. but when I run it even from the console like 'dotnet run --configuration Release' than the issue reappears. Of course the same happen when running from Visual Studio. So now I'm scratching my head even more. |
@digital-spinner interesting news... Did you try to disable Windows Defender Network Inspection Service? |
@bednar yes, disabling Windows Defender helps. Options to disable on the left side of screen. Firewall is still enabled as default. |
Currently, I don't how we can bypass this protection and scanning. Maybe you could create a custom rule for your Windows Defender. |
OK, thank you for your answer. I may report the bug to the Windows dev team then - IMO Windows Defender should not be working like this. Thank you for your support! |
Thanks for your cooperation 👍 |
Steps to reproduce:
InfluxSimpleLoadTest.zip
Expected behavior:
RAM should not be eaten indefinitely and after app shutdown it should be released.
Actual behavior:
Windows OS uses RAM indefinitely before app crashes.
When the writeApiAsync is got before each point write (see commented piece of code) than the RAM is eaten indefinitely but the app won't crash and everything runs until Windows OS hangs due to RAM usage issue.
Specifications:
The text was updated successfully, but these errors were encountered: