11

I'm getting occasionally crash with iOS 6 MapKit. Can't really reproduce it. What can cause this?

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

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   IMGSGX543GLDriver               0x38f231b4 sgxTextureGetImageRowBytes(GLDTextureRec*, unsigned int, unsigned int) + 8
1   IMGSGX543GLDriver               0x38f23160 CalculateChunkPlaneSizes(GLDTextureRec*, int, unsigned int*, unsigned int*, unsigned int*, unsigned int*) + 104
2   IMGSGX543GLDriver               0x38f25906 sgxConfigureTexturePrivate(GLDTextureRec*) + 82
3   IMGSGX543GLDriver               0x38f24584 glrUpdateTexture + 616
4   libGPUSupportMercury.dylib      0x342c76b6 gldLoadFramebuffer + 102
5   GLEngine                        0x31b50e52 gleUpdateDrawFramebufferState + 178
6   GLEngine                        0x31b52556 gleDoDrawDispatchCoreES2 + 126
7   GLEngine                        0x31aedbc0 gleDrawArraysOrElements_Entries_Body + 140
8   GLEngine                        0x31aea5ec glDrawArrays_ES2Exec + 160
9   VectorKit                       0x3780dcd6 -[VKSkyModel drawScene:withContext:] + 326
10  VectorKit                       0x377e76d6 -[VKModelObject recursiveDrawScene:whenReadyWithContext:] + 118
11  VectorKit                       0x377621ea -[VKMapModel recursiveDrawScene:withContext:] + 278
12  VectorKit                       0x37762096 -[VKModelObject recursiveDrawScene:withContext:] + 186
13  VectorKit                       0x3775d4da -[VKScreenCanvas onTimerFired:] + 1014
14  VectorKit                       0x3775b548 -[VKMapCanvas onTimerFired:] + 500
15  VectorKit                       0x3775a3d2 -[VKMainLoop displayTimerFired:] + 610
16  QuartzCore                      0x3095b06c CA::Display::DisplayLink::dispatch(unsigned long long, unsigned long long) + 156
17  QuartzCore                      0x3095afc4 CA::Display::IOMFBDisplayLink::callback(__IOMobileFramebuffer*, unsigned long long, unsigned long long, unsigned long long, void*) + 60
18  IOMobileFramebuffer             0x331e4fd4 IOMobileFramebufferVsyncNotifyFunc + 152
19  IOKit                           0x36fc4446 IODispatchCalloutFromCFMessage + 190
20  CoreFoundation                  0x382a95d8 __CFMachPortPerform + 116
21  CoreFoundation                  0x382b4170 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 32
22  CoreFoundation                  0x382b4112 __CFRunLoopDoSource1 + 134
23  CoreFoundation                  0x382b2f94 __CFRunLoopRun + 1380
24  CoreFoundation                  0x38225eb8 CFRunLoopRunSpecific + 352
25  CoreFoundation                  0x38225d44 CFRunLoopRunInMode + 100
26  GraphicsServices                0x3415f2e6 GSEventRunModal + 70
27  UIKit                           0x351b72fc UIApplicationMain + 1116
28  MyApp                           0x0005d78a main (main.m:14)
29  MyApp                           0x0005d744 start + 36
Olga Dalton
  • 829
  • 3
  • 15
  • 25
  • Are you talking about the app or using the map embedded in your app? – Ben Clayton Nov 22 '12 at 15:30
  • Map embedded in my app. MKMapView. – Olga Dalton Nov 22 '12 at 15:42
  • looks like a bug in apple's drawing code, not your fault – Felix Nov 22 '12 at 18:05
  • I'm getting the same problem as you. I believe it is a memory issue. If you have map 'pins'/'annotations' I think your map may be trying to release the pins before they are on screen. If I find a fix I will let you know. I take it your ARC is off? -Lewis – Lewis Smallwood Dec 24 '12 at 09:39
  • @OlgaDalton have you find the solutions of it? I am facing similar issue. – NSCry Feb 05 '13 at 11:09
  • @OlgaDalton Could you please post the code causing the issue? – tapi May 09 '13 at 16:37
  • I looked into this a bit more and found two things. First I think [this](http://stackoverflow.com/questions/12713781/occasionally-ios-6-mkmapview-crashes-in-initwithframe?rq=1) is the solution your looking for, comparing my crash reports to yours it looks like the same issue, and my data shows we were in fact in the background. Second if you are calculating the frame make sure you validate the result, it looks like `MKMapView`'s `initWithFrame:` will crash if it receives negative sizes. – tapi May 10 '13 at 14:30
  • I'm getting a crash in the same spot, but not in the background. Adding a view controller to a nav stack, and that view controller has a map. It repeatedly crashes on the 4th time the map view appears with a black background (no visible map pieces or grid). – Matt Connolly Jul 15 '13 at 06:10
  • I have same problem . how @OlgaDalton you solve this problem ? – Erhan Demirci Oct 11 '13 at 17:23

4 Answers4

2

I found this. It may help you fix your problem.

"Issue: An OpenGL ES-based application displays “flashing” or “stale” frames after a call to presentRenderBuffer. This symptom can occur when an OpenGL ES application calls the EAGL presentRenderbuffer method without first drawing anything. What is seen on screen may contain uninitialized pixels or previously rendered frames. To correct this issue, you should always draw something to your framebuffer before calling presentRenderbuffer. Also note that unless you set the RetainedBackbuffer property on your CAEAGLLayer to enable retained backbuffer mode, the contents of your renderbuffer are not guaranteed to remain valid after a call to presentRenderbuffer".

-Lewis

Lewis Smallwood
  • 84
  • 1
  • 11
  • How is this done for a standard MKMapView? I found if I make the MKMapView smaller it dosen't crash and this is only happening on ipad 4 devices. – Tim Walsh Mar 26 '13 at 21:20
  • 8
    Not quite sure how this answers the question. It doesn't sound like the poster is writing an OpenGL ES-based app, but simply trying to use an MKMapView. I have an almost identical crash report and at this point, according to Crashlytics, it's my most frequent crasher. Any advice on how to configure/use MKMapView to avoid this crash? – djibouti33 Apr 01 '13 at 05:17
  • nice quote but.. don't see how this helps -- sure. the MKMapView IS opengl but ... I can't force it to draw stuff – Daij-Djan Apr 26 '13 at 13:46
  • I am seeing the same issue in all versions of iOS 6 and like @djibouti33 my reports from Crashlytics say it is in the `initWithFrame:` method. I am doing no direct OpenGL stuff. I've seen other people having a simmilar problem when it is called on something other than the main thread and dispatching to the main thread fixes it. Unfortunately thats not what I'm seeing and from the crash report neither is @Olga. – tapi May 09 '13 at 16:29
2

I actually found the issue with the iOS version. The user was running on iPad 4, iOS 6.1.2, as soon as I upgraded to 6.1.3 the problem went away. Hope this helps someone.

Thanks, Tim

Tim Walsh
  • 1,089
  • 11
  • 27
0

I had this exact issue and it turned out to be a memory pressure related crash. It was consistently crashing for me when the map appeared with a black background instead of any tiles or grid backgrounds like normal on the fourth or fifth time the map was shown. This occurred on iOS 6.0 and 6.1 and beta of 7.0.

My view controller with the map view wasn't being deallocated after it was removed from the Navigation stack and it had a strong reference to the map view which kept it in memory.

After fixing my leak, the problem disappeared.

Matt Connolly
  • 9,757
  • 2
  • 65
  • 61
0

I just experienced this testing an App on my iPad. It's always run with no problems in simulator and also on the device but just now it crashed at the same point with the same error.

Here's my method - very simple map showing user location and no annotations:

- (void)mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated {
    MKCoordinateSpan span = self.mapView.region.span;
    zoomLevel = span.latitudeDelta;
       shouldAdjustZoom = NO;
}

Here's the crash log

Incident Identifier: 01AE9C88-1F56-44D4-92A1-C6B5938DEBD4
CrashReporter Key:   f372f86613043286b74e70a8d1f9d7b1b5313cf5
Hardware Model:      iPad3,4
Process:         MyApp [1247]
Path:            /var/mobile/Applications/C39AEC49-8DB1-45DE-B175-A6AEC19D533F/MyApp.app/MyApp
Identifier:      MyApp
Version:         ??? (???)
Code Type:       ARM (Native)
Parent Process:  launchd [1]

Date/Time:       2013-07-15 08:25:16.390 +0200
OS Version:      iOS 6.1.3 (10B329)
Report Version:  104

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

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   IMGSGX554GLDriver               0x32ea6be0 0x32e99000 + 56288
1   IMGSGX554GLDriver               0x32ea6b8e 0x32e99000 + 56206
2   IMGSGX554GLDriver               0x32ea92f2 0x32e99000 + 66290
3   IMGSGX554GLDriver               0x32ea7f44 0x32e99000 + 61252

I ended a whole bunch of apps (mostly kids games) running in the background on the device and relaunched it and it then ran fine. Maybe helps someone pinpoint the exact problem and whether any changes in our Apps can prevent the crash.

Nigel
  • 141
  • 1
  • 9