Quantcast
Channel: ImapX 2
Viewing all articles
Browse latest Browse all 1952

Commented Unassigned: Out of Memory Exceptions in ReadQuotedString [2342]

$
0
0
I'm downloading about 10,000 emails in batches of 250 and on a few of the batches I'm getting out of memory exceptions. I'm not downloading attachments and I've got 16GB of RAM. Something is causing the RAM to explode on some of these messages. This has been a recurring issue with IMAPX and I think you tried to fix it in the past but it still isn't fixed. I'm using the latest code from source control, svn revision 39136. Please try and resolve this quickly. I will try and find the exact email if that is possible which is causing this.

Looking at the code, I'm fairly certain the problem is in the function ReadQuotedString and it just loops forever for some weirdly formatted emails.

while ((currentChar = (char)_reader.Read()) != '"' || prevChar == '\\')
{
prevChar = currentChar;
sb.Append(currentChar);
}


System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
at System.Text.StringBuilder.ExpandByABlock(Int32 minBlockCharCount)
at System.Text.StringBuilder.Append(Char value, Int32 repeatCount)
at System.Text.StringBuilder.Append(Char value)
at ImapX.Parsing.BodyStructureParser.ReadQuotedString(Boolean trimSpaces) in c:\git\AzureServices\ThirdParty\ImapX\ImapX\Parsing\BodyStructureParser.cs:line 327
at ImapX.Parsing.BodyStructureParser.ReadString(Boolean trimSpaces) in c:\git\AzureServices\ThirdParty\ImapX\ImapX\Parsing\BodyStructureParser.cs:line 275
at ImapX.Parsing.BodyStructureParser.ReadLanguage() in c:\git\AzureServices\ThirdParty\ImapX\ImapX\Parsing\BodyStructureParser.cs:line 265
at ImapX.Parsing.BodyStructureParser.ParsePart(String contentNumber) in c:\git\AzureServices\ThirdParty\ImapX\ImapX\Parsing\BodyStructureParser.cs:line 211
at ImapX.Parsing.BodyStructureParser.Parse(Int32 level, String contentNumber) in c:\git\AzureServices\ThirdParty\ImapX\ImapX\Parsing\BodyStructureParser.cs:line 50
at ImapX.Parsing.BodyStructureParser.Parse(Int32 level, String contentNumber) in c:\git\AzureServices\ThirdParty\ImapX\ImapX\Parsing\BodyStructureParser.cs:line 44
at ImapX.Message.TryProcessBodyStructure(String data) in c:\git\AzureServices\ThirdParty\ImapX\ImapX\Message.cs:line 451
at ImapX.Message.ProcessCommandResult(String data) in c:\git\AzureServices\ThirdParty\ImapX\ImapX\Message.cs:line 243
at ImapX.Message.NormalizeAndProcessFetchResult(IList`1 data) in c:\git\AzureServices\ThirdParty\ImapX\ImapX\Message.cs:line 586
at ImapX.Message.Download(MessageFetchMode mode, Boolean reloadHeaders) in c:\git\AzureServices\ThirdParty\ImapX\ImapX\Message.cs:line 554
at ImapX.Folder.Fetch(IEnumerable`1 uIds, MessageFetchMode mode) in c:\git\AzureServices\ThirdParty\ImapX\ImapX\Folder.cs:line 454
at ImapX.Folder.Search(String query, MessageFetchMode mode, Int32 count) in c:\git\AzureServices\ThirdParty\ImapX\ImapX\Folder.cs:line 499
at QueueHandlers.EmailMining.IMAPMiner.ExtractEmailsFromFolder(EmailMiningInputs emailMiningInputs, Folder folder, Guid emailAccountID, EmailAccount emailAccount, ImapClient client, IConfig config, CancellationToken cancellationToken) in c:\git\AzureServices\QueueHandlers\EmailMining\IMAPMiner.cs:line 167
Comments: ** Comment from web user: pavel_azanov **

Hi,

thank you! I will run some tests to improve the fix which was done before.


Viewing all articles
Browse latest Browse all 1952

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>