Hard crash during BinaryStream.Read

Got a nice reproducable crash report from a customer (see below). He was trying to read an mbox file with 275.000 mails. Does anyone have a clue why the BinaryStream.Read crashes and what Msgbox and IPC socket do here?

Xojo 2014r2, Mac OS 10.01.

Thread 8 Crashed:
0 com.xojo.XojoFramework 0x016b877f IPCSocketBytesLeftToSend + 18319
1 com.xojo.XojoFramework 0x016c3975 VB_RuntimeMsgBox + 1957
2 com.xojo.XojoFramework 0x017472e8 BinaryStreamRead + 120
3 com.mothsoftware.mailarchiverx 0x000b1714 BinaryStream.Read%s%oi4o + 96
4 com.mothsoftware.mailarchiverx 0x00cd7388 mboxIterator.nextObject%s%o + 658
5 com.mothsoftware.mailarchiverx 0x00cc7d60 MailParser.parse%i4%o + 7960
6 com.mothsoftware.mailarchiverx 0x00c65e36 ArchiveThread.DoWork%%o + 3673
7 com.mothsoftware.mailarchiverx 0x00c64f7d ArchiveThread.Event_Run%%o + 56
8 com.xojo.XojoFramework 0x017848ba threadRun + 746
9 libsystem_pthread.dylib 0x99bd6ecf _pthread_body + 138
10 libsystem_pthread.dylib 0x99bd6e45 _pthread_start + 162
11 libsystem_pthread.dylib 0x99bd4f0e thread_start + 34

Since the mbox files can be so large I read them piece by piece. I figure out where mails start and put this into an array. Then I read the file again with these start values:

[code]Function nextObject() As String

'return the text of a mail

currentMail = currentMail + 1
if inputBinary = nil then Return “”
if Globals.StopArchiving then return “” 'parsing cancelled by user
if currentMail > UBound(StartValues) then Return “”

dim SingleMail as String
SingleMail = inputBinary.Read(StartValues(currentMail) - StartValues(currentMail - 1)) ’ <— crash here
SingleMail = myReplaceLineEndings(SingleMail, EndOfLine.Macintosh)
if Left(singleMail, 1) = EndOfLine.Macintosh then
singleMail = Mid(singleMail, 2, Len(singleMail) - 1)
end if

return singleMail

End Function[/code]

But mails are getting larger and larger…

[quote=156209:@Beatrix Willius]Got a nice reproducable crash report from a customer (see below). He was trying to read an mbox file with 275.000 mails. Does anyone have a clue why the BinaryStream.Read crashes and what Msgbox and IPC socket do here?
[/quote]
They are quite literally “best guesses” by the OS method that crawls the stack looking for a symbol to report
You notice the symbol name (IPCSocketBytesLeftToSend) has a huge offset (+ 18319)
Thats the nearest valid symbol the stack crawler could find
But submit a full crash log with a bug report & there may be something we can figure out

You should however try this in a version built with 2014r3.1 as this may be a bug that was fixed between 2014r2 and now

Whats the chances that the # of bytes to read is < 0 or > 2Gb ?

Thanks for the info. Okay, will try with the latest version.

When I do a new build I will add the StartValues array to the session log so that I can check <0 and >2GB. This shouldn’t happen. The largest mail size so far I have seen is 300mb.