Hang in Simulator #68

Closed
jonsterling opened this Issue Dec 14, 2011 · 11 comments

Projects

None yet

4 participants

@jonsterling
Collaborator

I'm having some pretty hardcore hangs and crashes in the Simulator. Can anyone reproduce this? It's possible that my dev environment is just broken, I wouldn't be surprised.

If nobody can reproduce this, feel free to close this issue.

Owner

I'll check when I get home from school - I was aware in the sim that there was a first-scroll lock.

GridViewDemo(5987,0x3ea81ce8) malloc: *** error for object 0x1947b4: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug

The line in question in -[KKGridView _commonReload] is:

        _footerViews = [[NSMutableArray alloc] initWithCapacity:_numberOfSections];

_numberOfSections is 40.

#0  0x3690b32c in __pthread_kill ()
#1  0x32a74f5a in pthread_kill ()
#2  0x32a6dfea in abort ()
#3  0x32a80c4c in free_list_checksum_botch ()
#4  0x32a80c68 in free_list_checksum_botch ()
#5  0x32a2b87e in tiny_malloc_from_free_list ()
#6  0x32a2aa1a in szone_malloc_should_clear ()
#7  0x32a2cffe in szone_calloc ()
#8  0x32a2cfa6 in malloc_zone_calloc ()
#9  0x32a2cf46 in calloc ()
#10 0x352aaf6c in class_createInstance ()
#11 0x33e9839a in __CFAllocateObject2 ()
#12 0x33deae1c in +[__NSArrayM __new::::] ()
#13 0x33dee03a in -[__NSPlaceholderArray initWithCapacity:] ()
#14 0x0000b86e in -[KKGridView _commonReload] at /Users/hamish/Projects/Others/KKGridView/KKGridView/KKGridView.m:975
#15 0x0000bb5a in -[KKGridView reloadData] at /Users/hamish/Projects/Others/KKGridView/KKGridView/KKGridView.m:994
#16 0x000054d2 in -[KKGridView setViewForFooterInSectionBlock:] ()
#17 0x000037a6 in -[GridViewDemoViewController _setupGridView] ()
#18 0x0000332c in -[GridViewDemoViewController loadView] ()
#19 0x323bd78a in -[UIViewController view] ()
#20 0x323e1f50 in -[UIViewController nextResponder] ()
#21 0x323a66a4 in -[UIResponder _containsResponder:] ()
#22 0x324690e4 in -[UINavigationController defaultFirstResponder] ()
#23 0x323aee50 in -[UIResponder(Internal) _deepestDefaultFirstResponder] ()
#24 0x323aee6c in -[UIResponder(Internal) _deepestDefaultFirstResponder] ()
#25 0x323aecfe in -[UIResponder(Internal) _promoteDeepestDefaultFirstResponder] ()
#26 0x323aecda in -[UIWindow makeKeyWindow] ()
#27 0x00002b92 in -[GridViewDemoAppDelegate application:didFinishLaunchingWithOptions:] ()
#28 0x323bc7ea in -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] ()
#29 0x323b63bc in -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] ()
#30 0x32384920 in -[UIApplication handleEvent:withNewEvent:] ()
#31 0x323843be in -[UIApplication sendEvent:] ()
#32 0x32383d2c in _UIApplicationHandleEvent ()
#33 0x306d6df2 in PurpleEventCallback ()
#34 0x33e68552 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ ()
#35 0x33e684f4 in __CFRunLoopDoSource1 ()
#36 0x33e67342 in __CFRunLoopRun ()
#37 0x33dea4dc in CFRunLoopRunSpecific ()
#38 0x33dea3a4 in CFRunLoopRunInMode ()
#39 0x323b5456 in -[UIApplication _run] ()
#40 0x323b2742 in UIApplicationMain ()
#41 0x00002a94 in main ()
Collaborator

OK. Glad someone else can reproduce this (though I can't reproduce it on my phone). Fresh eyes might be nice to check over my addition of that metrics array; I was rather in a rush when I did it, and wouldn't be surprised if I made a really dumb mistake.

Sent from my iPhone

On Dec 14, 2011, at 8:22 AM, Hamish Allanreply@reply.github.com wrote:

GridViewDemo(5987,0x3ea81ce8) malloc: *** error for object 0x1947b4: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug

The line in question in -[KKGridView _commonReload] is:

       _footerViews = [[NSMutableArray alloc] initWithCapacity:_numberOfSections];

_numberOfSections is 40.

#0 0x3690b32c in pthread_kill ()
#1 0x32a74f5a in pthread_kill ()
#2 0x32a6dfea in abort ()
#3 0x32a80c4c in free_list_checksum_botch ()
#4 0x32a80c68 in free_list_checksum_botch ()
#5 0x32a2b87e in tiny_malloc_from_free_list ()
#6 0x32a2aa1a in szone_malloc_should_clear ()
#7 0x32a2cffe in szone_calloc ()
#8 0x32a2cfa6 in malloc_zone_calloc ()
#9 0x32a2cf46 in calloc ()
#10 0x352aaf6c in class_createInstance ()
#11 0x33e9839a in __CFAllocateObject2 ()
#12 0x33deae1c in +__NSArrayM __new::::
#13 0x33dee03a in -__NSPlaceholderArray initWithCapacity:
#14 0x0000b86e in -[KKGridView _commonReload] at /Users/hamish/Projects/Others/KKGridView/KKGridView/KKGridView.m:975
#15 0x0000bb5a in -[KKGridView reloadData] at /Users/hamish/Projects/Others/KKGridView/KKGridView/KKGridView.m:994
#16 0x000054d2 in -KKGridView setViewForFooterInSectionBlock:
#17 0x000037a6 in -GridViewDemoViewController _setupGridView
#18 0x0000332c in -GridViewDemoViewController loadView
#19 0x323bd78a in -UIViewController view
#20 0x323e1f50 in -UIViewController nextResponder
#21 0x323a66a4 in -UIResponder _containsResponder:
#22 0x324690e4 in -UINavigationController defaultFirstResponder
#23 0x323aee50 in -UIResponder(Internal) _deepestDefaultFirstResponder
#24 0x323aee6c in -UIResponder(Internal) _deepestDefaultFirstResponder
#25 0x323aecfe in -UIResponder(Internal) _promoteDeepestDefaultFirstResponder
#26 0x323aecda in -UIWindow makeKeyWindow
#27 0x00002b92 in -GridViewDemoAppDelegate application:didFinishLaunchingWithOptions:
#28 0x323bc7ea in -UIApplication _callInitializationDelegatesForURL:payload:suspended:
#29 0x323b63bc in -UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:
#30 0x32384920 in -UIApplication handleEvent:withNewEvent:
#31 0x323843be in -UIApplication sendEvent:
#32 0x32383d2c in _UIApplicationHandleEvent ()
#33 0x306d6df2 in PurpleEventCallback ()
#34 0x33e68552 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION
()
#35 0x33e684f4 in __CFRunLoopDoSource1 ()
#36 0x33e67342 in __CFRunLoopRun ()
#37 0x33dea4dc in CFRunLoopRunSpecific ()
#38 0x33dea3a4 in CFRunLoopRunInMode ()
#39 0x323b5456 in -UIApplication _run
#40 0x323b2742 in UIApplicationMain ()
#41 0x00002a94 in main ()


Reply to this email directly or view it on GitHub:
#68 (comment)

Contributor

I'm getting a hang on the iPhone sim, and a crash on the iPad sim. The root of the hang seems to be an infinite loop somewhere, CPU is at 100%. When I pause, it shows the main thread on GridViewDemoViewController.m:124

    [self.gridView setViewForFooterInSectionBlock:^(KKGridView *gridView, NSUInteger section) {
        return [selfRef.footerViews objectAtIndex:section]; 
    }];

the iPad crash is an EXC_BAD_ACCESS on KKGridView.m:994:

[self _commonReload];
GridViewDemo(8119,0xac0df2c0) malloc: *** error for object 0xc82a6d4: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug
Collaborator

Glad everybody can reproduce this. I think this is a problem with the blocks stuff, since when I tried pulling that out, the crash went away. Of course, that's unsatisfactory, as I'd like to figure out why the crash happened in the first place.

Contributor

Although fixing the blocks issue would be good, I'd also be happy to see a delegate-protocol data interface as well...

Collaborator

This is my end goal, if I can convince @kolinkrewinkel.

Contributor

Would adding a dual blocks/delegate interface be a feasibility?

Collaborator

If we do that, then it should be done as an optional module. What I mean is that the interface to KKGridView should use protocols, and then we can provide another class with the block properties, and that class can conform to <KKGridViewDataSource>, etc.

Collaborator

I think I found the real problem, and it probably wasn't the blocks. Stay tuned.

@jonsterling jonsterling was assigned Dec 16, 2011
Collaborator

By the way, @keichan34, you may be interested to see my latest pull request, #70.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment