Strange crashes in 64-bit OS X apps

I am shipping my apps in 64-bit now, but I have some reports about strange crashes. Here is an example crash report:

[quote]
Process: Goldfish 4 [486]
Path: /Applications/Goldfish 4.app/Contents/MacOS/Goldfish 4
Identifier: com.fishbeam.goldfish4
Version: 4.1 (4.1.0)
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Goldfish 4 [486]
User ID: 501

(…)

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 com.apple.CoreFoundation 0x00007fff92d88cc4 CFRetain + 180
1 com.xojo.XojoFramework 0x0000000106da43d2 0x106d27000 + 512978
2 com.xojo.XojoFramework 0x0000000106da7391 0x106d27000 + 525201
3 com.xojo.XojoFramework 0x0000000106da91cf RuntimeStringCompare + 75
4 com.xojo.XojoFramework 0x0000000106f034cd VariantCompare + 169
5 com.fishbeam.goldfish4 0x0000000105d5a49d claMedia.DuplicateMedia%i8%ooi8 + 8525
6 com.fishbeam.goldfish4 0x0000000105e3537c claItemPicture.Event_Duplicate%o%oooo + 1260
7 com.fishbeam.goldfish4 0x0000000105afbe73 claPageItem.CallDuplicate%o%ooooi8 + 371
8 com.fishbeam.goldfish4 0x0000000105a4bfb4 claPageArea.PasteFromClipBoard%%o + 2532
9 com.fishbeam.goldfish4 0x00000001059c3728 claPageArea.Event_MenuEditPaste%b%o + 1336
10 com.fishbeam.goldfish4 0x0000000105bc371e claEditorPart.CallMenuEditPaste%b%o + 94
11 com.fishbeam.goldfish4 0x0000000105b9f7fa claEditor._EditPaste_Action%b%o + 202
…[/quote]

64-bit apps seam to crash if you do string comparisons with large strings and in my case that have no TextEncoding. The code that crashes is this:

//Check if media was added before For i=0 To ToMedia.Media.Count-1 If ToMedia.Media.Value(ToMedia.Media.Key(i))=Media.Value(Key) Then //Compare raw binary data of images, movie files etc. Found=True Exit End If Next

I could fix that with just comparing the hash of the strings instead of the strings themselves:

//Check if media was added before For i=0 To ToMedia.Media.Count-1 If Md5(ToMedia.Media.Value(ToMedia.Media.Key(i)).StringValue)=Md5(Media.Value(Key).StringValue) Then //No crash here Found=True Exit End If Next

But now I have a crash report from a Japanese customer where this code always crashes. In this case with short strings:

[code]//s is the binary data without TextEncoding of an image file

//Open SVG
If LeftB(s, 5)="<?xml" Then
(…) //Open SVG code

//Open GIF

ElseIf LeftB(s, 3)=“GIF” Then
p=GifStringToPictureMBS(s)
…[/code]

Again it crashes at the string comparison with binary data but this time the string is short and the bug not reproducible for me, because on my system this code works in 64-bit.

Has anyone discovered similar crashes with RuntimeStringCompare on 64-bit systems? And how did you fix that? Maybe I could try my hash-trick, but unfortunately I can not test that on my computer.

What is the error in the crash log (it is listed above the stack you posted)?

There are already beta bug reports about large strings split hanging 64 bits builds.

It would not hurt to file a new report anyway, since the others are not visible to general users.

Thank you. :slight_smile:

@Eli Ott Yes its from the crash log. Here is a part of another crash log:

[quote]Thread 12 Crashed:
0 com.apple.CoreFoundation 0x00007fff8ede1a77 CFRetain + 183
1 com.xojo.XojoFramework 0x000000010cf203d2 0x10cea3000 + 512978
2 com.xojo.XojoFramework 0x000000010cf23386 0x10cea3000 + 525190
3 com.xojo.XojoFramework 0x000000010cf251cf RuntimeStringCompare + 75
4 com.fishbeam.goldfish4 0x000000010be9d210 claGraphicsLibrary.BinToPicture%o%osi8i8b + 1040[/quote]

The important line is

It means that the internal function RuntimeStringCompare from the Xojo framework crashes.

@Michel Bujardet Thank you for your info. Unfortunately I don’t have access to beta versions. In my opinion Xojo was not very smart to limit the beta tests to only a small customer group because that does not increase the software quality… But that is another discussion.

Please do file a bug report via Feedback.

I would love to create a bug report but I tried the whole afternoon to set up an empty test project, load two binary files and do the string comparison and it never crashed on 64-bit. With the test project it is not reproducible. It seams that the bug occurs only after many comparisons. And I don’t want to include my whole source code and attached files of my app (around 1.3 GB).

Can I add a bug report without showing that it is reproducible. My guess is that it will be closed soon.

The important line is the one with the actual error further above…

What I meant is that you should post the actual error, which looks similar to this:

Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x2040b743 Crashed Thread: 0

[quote=263674:@Eli Ott]What I meant is that you should post the actual error, which looks similar to this:

Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x2040b743 Crashed Thread: 0[/quote]

Here is a report:

[quote]Process: Goldfish 4 Professional [984]
Path: /Applications/Goldfish 4 Professional.app/Contents/MacOS/Goldfish 4 Professional
Identifier: com.fishbeam.goldfish4
Version: 4.1 (550)
App Item ID: 1059461608
App External ID: 816703361
Code Type: X86-64 (Native)
Parent Process: launchd [165]
Responsible: Goldfish 4 Professional [984]
User ID: 501

Date/Time: 2016-04-08 20:50:29.268 +0800
OS Version: Mac OS X 10.9.5 (13F1507)
Report Version: 11
Anonymous UUID: DC2D1618-EA35-0744-E7F5-72750E5B62C2

Sleep/Wake UUID: 0348BD3B-A4A7-41C1-96F1-B90E09CB4CAD

Crashed Thread: 12

Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000002, 0x0000000000000000
[/quote]

The error is

Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000002, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY

the entire crash log would be required
attach it to a feedback report