googlevr / gvr-ios-sdk

Google VR SDK for iOS
http://developers.google.com/vr/ios/
Other
645 stars 191 forks source link

Several major crashes #253

Closed ChrisMcM closed 7 years ago

ChrisMcM commented 7 years ago

We are using this sdk to show a 360 video on our apps splash screen but it seems to be causing a lot of crashes that we aren't able to replicate. Any advice on how to fix any these would be hugely appreciated.

CRASH 1: Crashed: com.google.cardboard.RenderThread EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000018

Crashed: com.google.cardboard.RenderThread 0 AGXGLDriver 0x19a870524 (null) + 2824 1 libGPUSupportMercury.dylib 0x195cb6834 gldLoadFramebuffer + 208 2 GLEngine 0x19b06fd60 gleUpdateDrawFramebufferState + 212 3 GLEngine 0x19b0025e8 glClear_Exec + 204 4 AmericasCup 0x100873368 ion::gfx::Renderer::ResourceBinder::DrawNode(ion::gfx::Node const&, ion::gfx::GraphicsManager) + 49204 5 AmericasCup 0x100872b60 ion::gfx::Renderer::ResourceBinder::DrawScene(ion::base::SharedPtr const&, std::__1::bitset<35ul> const&, ion::gfx::ShaderProgram) + 47148 6 AmericasCup 0x10087297c ion::gfx::Renderer::DrawScene(ion::base::SharedPtr const&) + 46664 7 AmericasCup 0x1007be53c vr::WidgetRenderer::RenderFrame() + 265568 8 AmericasCup 0x100616540 -[GVRWidgetView nativeRenderFrame] + 4302103872 9 AmericasCup 0x100614aac -[GVRVideoView drawAtTime:] + 4302097068 10 AmericasCup 0x100617dc4 -[GVRWidgetView render:] + 4302110148 11 AmericasCup 0x10060e33c -[GVRWeakRenderTarget render:] + 4302070588 12 AmericasCup 0x10060f40c -[GVRRenderLoop updateWithDisplayLink:] + 4302074892 13 QuartzCore 0x188eb6600 CA::Display::DisplayLinkItem::dispatch(unsigned long long) + 44 14 QuartzCore 0x188eb64b0 CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) + 436 15 IOKit 0x185f13dd4 IODispatchCalloutFromCFMessage + 372 16 CoreFoundation 0x185c3d958 CFMachPortPerform + 180 17 CoreFoundation 0x185c55adc CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION + 56 18 CoreFoundation 0x185c5527c CFRunLoopDoSource1 + 436 19 CoreFoundation 0x185c52d90 CFRunLoopRun + 1752 20 CoreFoundation 0x185b82d94 CFRunLoopRunSpecific + 424 21 CoreFoundation 0x185bcf9a0 CFRunLoopRun + 112 22 Foundation 0x18679a2c8 NSThreadstart + 996 23 libsystem_pthread.dylib 0x184d6975c _pthread_body + 240 24 libsystem_pthread.dylib 0x184d6966c _pthread_body + 282 25 libsystem_pthread.dylib 0x184d66d84 thread_start + 4

CRASH 2: Crashed: com.google.cardboard.RenderThread EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000028

Crashed: com.google.cardboard.RenderThread 0 AppleMetalGLRenderer 0x19e7aef38 + 24 1 AppleMetalGLRenderer 0x19e7af2e4 + 828 2 AppleMetalGLRenderer 0x19e7b7878 + 652 3 GLEngine 0x197c9eacc + 400 4 AmericasCup 0x10085bcc0 ion::gfx::Renderer::ResourceBinder::DrawIndexedShape(ion::gfx::Shape const&, ion::gfx::IndexBuffer const&, ion::gfx::GraphicsManager) + 51596 5 AmericasCup 0x10085b484 ion::gfx::Renderer::ResourceBinder::DrawNode(ion::gfx::Node const&, ion::gfx::GraphicsManager) + 49488 6 AmericasCup 0x10085b4cc ion::gfx::Renderer::ResourceBinder::DrawNode(ion::gfx::Node const&, ion::gfx::GraphicsManager) + 49560 7 AmericasCup 0x10085b4cc ion::gfx::Renderer::ResourceBinder::DrawNode(ion::gfx::Node const&, ion::gfx::GraphicsManager) + 49560 8 AmericasCup 0x10085ab60 ion::gfx::Renderer::ResourceBinder::DrawScene(ion::base::SharedPtr const&, std::__1::bitset<35ul> const&, ion::gfx::ShaderProgram*) + 47148 9 AmericasCup 0x10085a97c ion::gfx::Renderer::DrawScene(ion::base::SharedPtr const&) + 46664 10 AmericasCup 0x1007a653c vr::WidgetRenderer::RenderFrame() + 265568 11 AmericasCup 0x1005fe540 -[GVRWidgetView nativeRenderFrame] + 4301382976 12 AmericasCup 0x1005fcaac -[GVRVideoView drawAtTime:] + 4301376172 13 AmericasCup 0x1005ffdc4 -[GVRWidgetView render:] + 4301389252 14 AmericasCup 0x1005f633c -[GVRWeakRenderTarget render:] + 4301349692 15 AmericasCup 0x1005f740c -[GVRRenderLoop updateWithDisplayLink:] + 4301353996 16 QuartzCore 0x185ba45dc + 44 17 QuartzCore 0x185ba448c + 436 18 IOKit 0x182bffb9c IODispatchCalloutFromCFMessage + 372 19 CoreFoundation 0x182929960 + 180 20 CoreFoundation 0x182941ae4 + 56 21 CoreFoundation 0x182941284 + 436 22 CoreFoundation 0x18293ed98 + 1752 23 CoreFoundation 0x18286eda4 CFRunLoopRunSpecific + 424 24 CoreFoundation 0x1828bb9c0 CFRunLoopRun + 112 25 Foundation 0x1834862d8 + 996 26 libsystem_pthread.dylib 0x181a5568c + 240 27 libsystem_pthread.dylib 0x181a5559c _pthread_start + 282 28 libsystem_pthread.dylib 0x181a52cb4 thread_start + 4

CRASH 3(less common): Crashed: com.google.cardboard.RenderThread EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000001

Crashed: com.google.cardboard.RenderThread 0 libGPUSupportMercury.dylib 0x194d57fac gpus_ReturnNotPermittedKillClient 1 AGXGLDriver 0x19992ff74 (null) 2 libGPUSupportMercury.dylib 0x194d58f88 gpusSubmitDataBuffers 3 AGXGLDriver 0x199931480 (null) 4 GLEngine 0x19a174084 gliPresentViewES_Exec 5 GLEngine 0x19a173f84 gliPresentViewES 6 OpenGLES 0x187371b60 -[EAGLContext presentRenderbuffer:] + 80 7 AmericasCup 0x10069fde8 -[GVRWidgetView render:] + 4301274600 8 AmericasCup 0x10069633c -[GVRWeakRenderTarget render:] + 4301235004 9 AmericasCup 0x10069740c -[GVRRenderLoop updateWithDisplayLink:] + 4301239308 10 QuartzCore 0x187f5a600 CA::Display::DisplayLinkItem::dispatch(unsigned long long) + 44 11 QuartzCore 0x187f5a4b0 CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) + 436 12 IOKit 0x184fb7dd4 IODispatchCalloutFromCFMessage + 372 13 CoreFoundation 0x184ce1958 CFMachPortPerform + 180 14 CoreFoundation 0x184cf9adc CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION + 56 15 CoreFoundation 0x184cf927c CFRunLoopDoSource1 + 436 16 CoreFoundation 0x184cf6d90 CFRunLoopRun + 1752 17 CoreFoundation 0x184c26d94 CFRunLoopRunSpecific + 424 18 CoreFoundation 0x184c739a0 CFRunLoopRun + 112 19 Foundation 0x18583e2c8 NSThreadstart + 996 20 libsystem_pthread.dylib 0x183e0d75c _pthread_body + 240 21 libsystem_pthread.dylib 0x183e0d66c _pthread_body + 282 22 libsystem_pthread.dylib 0x183e0ad84 thread_start + 4

sanjayc77 commented 7 years ago

Can't tell much from the stack trace. Can you distill it down to reproducible code?

ChrisMcM commented 7 years ago

The splash screen simply loads a video like so:

[self.vrVideoView setDelegate:self]; NSString *videoPath = [[NSBundle mainBundle] pathForResource:@"splash" ofType:@"mp4"]; [self.vrVideoView loadFromUrl:[[NSURL alloc] initFileURLWithPath:videoPath] ofType:kGVRVideoTypeMono]; [self.vrVideoView setVolume:0.0]; [self.vrVideoView setEnableInfoButton:NO];

and then loops using :

ChrisMcM commented 7 years ago

Any follow up to this? At this point the crashes are getting so bad that we are probably going to pull the GVR stuff out of our app . Really disappointing but there doesn't seem to be anything else we can do.

sanjayc77 commented 7 years ago

Looking into it. Is this in fullscreen embed mode (kGVRWidgetDisplayModeEmbedded)? Have you tried setting it to kGVRWidgetDisplayModeFullscreen?

ChrisMcM commented 7 years ago

Thanks for the quick reply. We are using it in kGVRWidgetDisplayModeEmbedded because we overlay some ui components so fullscreen mode isn't really an option.

sanjayc77 commented 7 years ago

Hmmm, GVRWidgetView embedded mode should really be used in non-fullscreen mode. We also don't support overlaying controls on top of it.

In any case, I modified VideoPlayerWidgetDemo example to display a fullscreen view controller containing GVRVideoView in a "splash" screen. (Remove "main" storyboard from info.plist). This works in the simulator and my 10.3.1 iOS device.

#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support. Compile with -fobjc-arc"
#endif

#import "VideoPlayerAppDelegate.h"

#import "VideoPlayerViewController.h"
#import "GVRVideoView.h"

@interface SplashViewController : UIViewController <GVRVideoViewDelegate>

@end

@implementation VideoPlayerAppDelegate

- (BOOL)application:(UIApplication *)application
    didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  UIViewController *viewController = [[SplashViewController alloc] init];

  self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
  self.window.rootViewController = viewController;
  [self.window makeKeyAndVisible];
  return YES;
}

@end

@implementation SplashViewController {
  BOOL _isPaused;
  GVRVideoView *_videoView;
}

- (void)viewDidLoad {
  [super viewDidLoad];

  _videoView = [[GVRVideoView alloc] initWithFrame:self.view.bounds];
  _videoView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
  _videoView.delegate = self;

  NSString *videoPath = [[NSBundle mainBundle] pathForResource:@"congo" ofType:@"mp4"];
  [_videoView loadFromUrl:[[NSURL alloc] initFileURLWithPath:videoPath]
                   ofType:kGVRVideoTypeStereoOverUnder];

  _isPaused = YES;

  [self.view addSubview:_videoView];
}

#pragma mark - GVRVideoViewDelegate

- (void)widgetViewDidTap:(GVRWidgetView *)widgetView {
  if (_isPaused) {
    [_videoView play];
  } else {
    [_videoView pause];
  }
  _isPaused = !_isPaused;
}

- (void)widgetView:(GVRWidgetView *)widgetView didLoadContent:(id)content {
  NSLog(@"Finished loading video");
  [_videoView play];
  _isPaused = NO;
}

- (void)widgetView:(GVRWidgetView *)widgetView didFailToLoadContent:(id)content
  withErrorMessage:(NSString *)errorMessage {
  NSLog(@"Failed to load video: %@", errorMessage);
}

- (void)videoView:(GVRVideoView*)videoView didUpdatePosition:(NSTimeInterval)position {
  // Loop the video when it reaches the end.
  if (position == videoView.duration) {
    [_videoView seekTo:0];
    [_videoView play];
  }
}

@end
sanjayc77 commented 7 years ago

Closing this since I was unable to reproduce the errors and hopefully you were able to resolve the issue with the sample code provide. Feel free to re-open if needed.

ChrisMcM commented 7 years ago

Thanks for your help but I was not able to fix this and we had to remove the Google vr sdk from our app as the crash rate was getting too high

grzegorzkrukowski commented 6 years ago

I think this issue should be reopened as it is easily 100% reproducible, but you need to try it on right device. From our tests all of those devices are crashing always when running GVRKit on them:

  1. iPod5_iOS9.3.5
  2. iPad2_iOS9.3.5
  3. iPad3_iOS9.3.5
  4. iPhone5c_iOS10.1.1

@ChrisMcM did you find any other library that supports correctly cardboard and 360 ? What library did you pick to replace it ?

We have to consider doing the same