superfell/SoqlX

Crash on Anonymous Apex Execution

Closed this issue · 8 comments

I tried to execute anonymous apex and after a few seconds the app crashes.

The SOQL is specific to our instance so I'm not sure it's helpful to provide, but it's calling a method and simply outputting some of the result using System.debug(). I don't believe it's an error with the Apex itself as I went through several attempts where it reported errors (which were displayed as expected) and fixed all. I tried it several times (in case the previous errors caused some sort of bad state). I'm also able to execute the same Apex in a sandbox (trying to run this against a production org though).

Mac OS 10.15 (x64)
SoqlXplorer Version 3.4

Crash Details

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Application Specific Information:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSDictionaryM setObject:forKey:]: object cannot be nil (key: 18446744073709551615)'
terminating with uncaught exception of type NSException
abort() called

0   CoreFoundation                      0x00007fff2fc5eb57 __exceptionPreprocess + 250
1   libobjc.A.dylib                     0x00007fff68b215bf objc_exception_throw + 48
2   CoreFoundation                      0x00007fff2fd0d59e -[__NSCFString characterAtIndex:].cold.1 + 0
3   CoreFoundation                      0x00007fff2fd1810c -[__NSDictionaryM setObject:forKey:].cold.3 + 0
4   CoreFoundation                      0x00007fff2fb9c299 -[__NSDictionaryM setObject:forKey:] + 976
5   Fragaria                            0x000000010f2ea6fe -[MGSSyntaxErrorController errorDecorations] + 356
6   Fragaria                            0x000000010f2e9886 -[MGSSyntaxErrorController updateSyntaxErrorsDisplay] + 92
7   Fragaria                            0x000000010f2e9441 -[MGSSyntaxErrorController setSyntaxErrors:] + 144
8   Fragaria                            0x000000010f2ed336 -[MGSFragariaView setSyntaxErrors:] + 79
9   SoqlXplorer                         0x000000010f0aeda8 SoqlXplorer + 155048
10  SoqlXplorer                         0x000000010f0b0d00 SoqlXplorer + 163072
11  libdispatch.dylib                   0x00007fff69c6f6c4 _dispatch_call_block_and_release + 12
12  libdispatch.dylib                   0x00007fff69c70658 _dispatch_client_callout + 8
13  libdispatch.dylib                   0x00007fff69c7bcab _dispatch_main_queue_callback_4CF + 936
14  CoreFoundation                      0x00007fff2fc21e81 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
15  CoreFoundation                      0x00007fff2fbe1c87 __CFRunLoopRun + 2028
16  CoreFoundation                      0x00007fff2fbe0e3e CFRunLoopRunSpecific + 462
17  HIToolbox                           0x00007fff2e80dabd RunCurrentEventLoopInMode + 292
18  HIToolbox                           0x00007fff2e80d7d5 ReceiveNextEventCommon + 584
19  HIToolbox                           0x00007fff2e80d579 _BlockUntilNextEventMatchingListInModeWithFilter + 64
20  AppKit                              0x00007fff2ce53039 _DPSNextEvent + 883
21  AppKit                              0x00007fff2ce51880 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1352
22  AppKit                              0x00007fff2ce4358e -[NSApplication run] + 658
23  AppKit                              0x00007fff2ce15396 NSApplicationMain + 777
24  libdyld.dylib                       0x00007fff69cc9cc9 start + 1

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib        	0x00007fff69e1133a __pthread_kill + 10
1   libsystem_pthread.dylib       	0x00007fff69ecde60 pthread_kill + 430
2   libsystem_c.dylib             	0x00007fff69d98808 abort + 120
3   libc++abi.dylib               	0x00007fff66ff7458 abort_message + 231
4   libc++abi.dylib               	0x00007fff66fe88bf demangling_terminate_handler() + 262
5   libobjc.A.dylib               	0x00007fff68b235a9 _objc_terminate() + 96
6   libc++abi.dylib               	0x00007fff66ff6887 std::__terminate(void (*)()) + 8
7   libc++abi.dylib               	0x00007fff66ff6829 std::terminate() + 41
8   libdispatch.dylib             	0x00007fff69c7066c _dispatch_client_callout + 28
9   libdispatch.dylib             	0x00007fff69c7bcab _dispatch_main_queue_callback_4CF + 936
10  com.apple.CoreFoundation      	0x00007fff2fc21e81 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
11  com.apple.CoreFoundation      	0x00007fff2fbe1c87 __CFRunLoopRun + 2028
12  com.apple.CoreFoundation      	0x00007fff2fbe0e3e CFRunLoopRunSpecific + 462
13  com.apple.HIToolbox           	0x00007fff2e80dabd RunCurrentEventLoopInMode + 292
14  com.apple.HIToolbox           	0x00007fff2e80d7d5 ReceiveNextEventCommon + 584
15  com.apple.HIToolbox           	0x00007fff2e80d579 _BlockUntilNextEventMatchingListInModeWithFilter + 64
16  com.apple.AppKit              	0x00007fff2ce53039 _DPSNextEvent + 883
17  com.apple.AppKit              	0x00007fff2ce51880 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1352
18  com.apple.AppKit              	0x00007fff2ce4358e -[NSApplication run] + 658
19  com.apple.AppKit              	0x00007fff2ce15396 NSApplicationMain + 777
20  libdyld.dylib                 	0x00007fff69cc9cc9 start + 1

Full crash report in case it has anything helpful.

soqlxplorer-full-crash-report.txt

Thanks for the report, from the stack trace it looks like the issue is in the syntax highlighter library. If you could add the actual apex that causes the crash, that'd be very useful.

It contains some proprietary info, would an anonymized version help?

Long id = Long.valueOf('123');
ApiClass.ResponseResult result = ApiClass2.ApiMethod(id, '', '');

System.debug(result.randomStringParameter);

I need something that produces the crash. I don't need to be able to run it. You can also email it to me if you don't want to post it publicly. fellforce at gmail.com

I don't know if you'll be able to reproduce without being connected to the org as it already passes validation. I'll email it, although it's the same thing just with different identifier names.

I wasn't able to reproduce it with your apex (thanks for emailing it). However looking through the code and some testing it looks like the Salesforce API is returning an error with the line number set to -1. I'll add something to protect against that, and log the details. Seems like its a Salesforce API bug.

@jordyboom the 3.5 release i just did includes a work around for the issue I think you're hitting. Can you try it out and let me know how you get on.