Spark datagrid crash on sort column only in release (updated with temporary fix)

1

Having some trouble for some time with this, wondering if some more eyes on the problem will help.

This is a standalone Air application for Windows/Mac

UPDATE: I can get the release version to actually sort and not crash! If I add the compiler flag (-optimize=false) it works as intended. Now this is a temporary fix as I'd like the compiler to optimize and reduce the size of the final binary. Does this new bit of information perhaps give anyone some ideas?

I have a spark datagrid displaying about 250 entries that is updated every 30 seconds from a PHP script that returns XML. It works as intended in debug mode and when simply running it from Flash Builder, but it instantly crashes when attempting to sort by any column in the exported release version (it displays the list correctly, the only change is the crash on sort).

On Windows it doesn't show any error message and it looks like it simply shuts down immediately to the user when attempting to sort a column. On Mac OS X it shows a lengthy error message, but here's probably the important part:

Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x000000000be2c001

Seems to be attempting to access bad memory from what I can tell. I can't get this error to happen in Flash Builder, and I've looked for a way to run an optimized/release version within Flash Builder with no luck.

I'd really appreciate any pointers or ideas as to why this may be happening!

Flex version: 4.6.0

Air version (as set in Application.xml): 3.1

Update: the application still crashes if attempting to sort an empty datagrid

In case it helps, here is the code snippet that defines the datagrid

    <s:DataGrid id="watchsheetDataGrid" width="100%" height="100%" fontFamily="Verdana" fontSize="14" textAlign="center" dataProvider="{watchlistData}">
        <s:columns>
            <s:ArrayList>
                <s:GridColumn dataField="symbol" headerText="Symbol" width="70"></s:GridColumn>
                <s:GridColumn dataField="underlyingPrice" headerText="Underlying Price" width="130"></s:GridColumn>
                <s:GridColumn dataField="strikePrice" headerText="Strike" width="70"></s:GridColumn>
                <s:GridColumn dataField="optionBid" headerText="Option Bid" width="100"></s:GridColumn>
                <s:GridColumn dataField="type" headerText="Type" width="70"></s:GridColumn>
                <s:GridColumn dataField="quantity" headerText="Count" width="70"></s:GridColumn>
                <s:GridColumn dataField="expiry" headerText="Expiry" width="120" labelFunction="dateLabelFunction"></s:GridColumn>
                <s:GridColumn dataField="negativeTime" headerText="Negative Time" labelFunction="negativeTimeLabelFunction"></s:GridColumn>
                <s:GridColumn dataField="inTheMoney" headerText="In The Money" labelFunction="ITMLabelFunction"></s:GridColumn>
                <s:GridColumn dataField="daysLeft" headerText="Days Left"></s:GridColumn>
                <s:GridColumn dataField="burnRate" headerText="Burn Rate" labelFunction="BurnRateLabelFunction"></s:GridColumn>
                <s:GridColumn dataField="percentOOM" headerText="% Out of $"></s:GridColumn>
                <s:GridColumn dataField="roreScore" headerText="RORE" labelFunction="RORELabelFunction"></s:GridColumn>
                <s:GridColumn dataField="adjustedRoreScore" headerText="Adj. RORE" labelFunction="AdjRORELabelFunction"></s:GridColumn>
            </s:ArrayList>
        </s:columns>
    </s:DataGrid>

And here's where I create the watchlist data (data shown in the datagrid) (RefreshData method is a method that updates values that are mathematically based on other values):

        private function CreateWatchlistData():void
        {
            watchlistData.removeAll();

            latestUpdateTime = new Date();
            for(var i:int = 0; i < watchlistRequest.lastResult.positions.position.length; i++)
            {
                var newItem:WatchlistRowItem = new WatchlistRowItem();
                newItem.expiry = watchlistRequest.lastResult.positions.position[i].expiry;
                newItem.percentMV = watchlistRequest.lastResult.positions.position[i].percentMV;
                newItem.price = watchlistRequest.lastResult.positions.position[i].price;
                newItem.quantity = watchlistRequest.lastResult.positions.position[i].quantity;
                newItem.strikePrice = watchlistRequest.lastResult.positions.position[i].strikePrice;
                newItem.symbol = watchlistRequest.lastResult.positions.position[i].symbol;
                newItem.type = watchlistRequest.lastResult.positions.position[i].type;
                newItem.value = watchlistRequest.lastResult.positions.position[i].value;
                newItem.underlyingPrice = watchlistRequest.lastResult.positions.position[i].underlyingPrice;
                newItem.optionBid = Number(watchlistRequest.lastResult.positions.position[i].optionBid);
                newItem.RefreshData();
                watchlistData.addItem(newItem);
            }       
        }

Here's some more of the error:

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 com.adobe.AIR
0x03344ab7 0x3000000 + 3426999
1 com.adobe.AIR
0x03344b78 0x3000000 + 3427192
2 com.adobe.AIR
0x03348c41 0x3000000 + 3443777
3 com.adobe.AIR
0x0334a670 0x3000000 + 3450480
4 com.adobe.AIR
0x0311c50d 0x3000000 + 1164557
5 com.adobe.AIR
0x03122749 0x3000000 + 1189705
6 com.adobe.AIR
0x03108974 0x3000000 + 1083764
7 com.apple.Foundation
0x91185d92 __57-[NSNotificationCenter
addObserver:selector:name:object:]_block_invoke_0 + 49
8 com.apple.CoreFoundation
0x98087481
___CFXNotificationPost_block_invoke_0 + 257
9 com.apple.CoreFoundation
0x97fd2b5a _CFXNotificationPost + 2794
10 com.apple.Foundation
0x9116e8c8 -[NSNotificationCenter
postNotificationName:object:userInfo:] + 92
11 com.apple.Foundation
0x9117e667 -[NSNotificationCenter
postNotificationName:object:] + 55
12 com.apple.AppKit
0x93d52b69 -[NSApplication terminate:] + 2420
13 com.apple.Foundation
0x9119b10f __NSFireDelayedPerform + 413
14 com.apple.CoreFoundation
0x97fdd0d6
__CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 22
15 com.apple.CoreFoundation
0x97fdca75 __CFRunLoopDoTimer + 709
16 com.apple.CoreFoundation
0x97fc1892 __CFRunLoopRun + 1730
17 com.apple.CoreFoundation
0x97fc0d6a CFRunLoopRunSpecific + 378
18 com.apple.CoreFoundation
0x97fc0bdb CFRunLoopRunInMode + 123
19 com.apple.HIToolbox
0x962e28aa RunCurrentEventLoopInMode + 242
20 com.apple.HIToolbox
0x962e2619 ReceiveNextEventCommon + 374
21 com.apple.HIToolbox
0x962e2494
BlockUntilNextEventMatchingListInMode + 88
22 com.apple.AppKit
0x93b29a5a _DPSNextEvent + 724
23 com.apple.AppKit
0x93b2928c -[NSApplication
nextEventMatchingMask:untilDate:inMode:dequeue:] + 119
24 com.apple.AppKit
0x93b1f6dc -[NSApplication run] + 855
25 com.adobe.AIR
0x03008fca 0x3000000 + 36810
26 com.adobe.AIR
0x03009310 0x3000000 + 37648
27 libobjc.A.dylib
0x993ab5d3 -[NSObject performSelector:withObject:] +
70
28 com.thewinningpoints.optionsSoftware
0x00002f97 start + 2567
29 com.thewinningpoints.optionsSoftware
0x000025c5 start + 53
Thread 1:: Dispatch queue: com.apple.libdispatch-manager
0 libsystem_kernel.dylib
0x9933a9ae kevent + 10
1 libdispatch.dylib
0x95d9ecc5 _dispatch_mgr_invoke + 993
2 libdispatch.dylib
0x95d9e7fd _dispatch_mgr_thread + 53
Thread 2:: com.apple.NSURLConnectionLoader
0 libsystem_kernel.dylib
0x993377d2 mach_msg_trap + 10
1 libsystem_kernel.dylib
0x99336cb0 mach_msg + 68
2 com.apple.CoreFoundation
0x97fbbcc9 __CFRunLoopServiceMachPort + 185
3 com.apple.CoreFoundation
0x97fc16af __CFRunLoopRun + 1247
4 com.apple.CoreFoundation
0x97fc0d6a CFRunLoopRunSpecific + 378
5 com.apple.CoreFoundation
0x97fc0bdb CFRunLoopRunInMode + 123
6 com.apple.Foundation
0x9115c29a +[NSURLConnection(Loader)
_resourceLoadLoop:] + 395
7 com.apple.Foundation
0x911c0318 -[NSThread main] + 45
8 com.apple.Foundation
0x911c029b __NSThread__main__ + 1396
9 libsystem_c.dylib
0x99581557 _pthread_start + 344
10 libsystem_c.dylib
0x9956bcee thread_start + 34
Thread 3:: com.apple.CFSocket.private
0 libsystem_kernel.dylib
0x99339be6 __select + 10
1 com.apple.CoreFoundation
0x98005320 __CFSocketManager + 1632
2 libsystem_c.dylib
0x99581557 _pthread_start + 344
3 libsystem_c.dylib
0x9956bcee thread_start + 34
Thread 4:
0 libsystem_kernel.dylib
1 libsystem_c.dylib
2 libsystem_c.dylib
3 libsystem_c.dylib
Thread 5:
0 libsystem_kernel.dylib
1 libsystem_c.dylib
2 libsystem_c.dylib
3 libsystem_c.dylib
Thread 6:
0 libsystem_kernel.dylib
1 libsystem_c.dylib
2 libsystem_c.dylib
3 libsystem_c.dylib
Thread 0 crashed with X86 Thread State (32-bit):
eax: 0x00000ec0 ebx: 0x03344a41 ecx: 0x0000cec0 edx: 0x0be2c000
edi: 0x0bc21f90 esi: 0x0be2cec0 ebp: 0xbfffdd98 esp: 0xbfffdd50
ss: 0x00000023 efl: 0x00010206 eip: 0x03344ab7 cs: 0x0000001b
ds: 0x00000023 es: 0x00000023 fs: 0x00000000 gs: 0x0000000f
cr2: 0x0be2c001
Logical CPU: 0
0x9933a0ee __workq_kernreturn + 10
0x9958404c _pthread_workq_return + 45
0x99583e19 _pthread_wqthread + 448
0x9956bcca start_wqthread + 30
0x9933a0ee __workq_kernreturn + 10
0x9958404c _pthread_workq_return + 45
0x99583e19 _pthread_wqthread + 448
0x9956bcca start_wqthread + 30
0x9933a0ee __workq_kernreturn + 10
0x9958404c _pthread_workq_return + 45
0x99583e19 _pthread_wqthread + 448
0x9956bcca start_wqthread + 30
actionscript-3
apache-flex
datagrid
air
flex-spark
asked on Stack Overflow Sep 5, 2012 by Preston Stoll • edited Sep 30, 2015 by zero323

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0