Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App crash in iOS when app load first time #691

Closed
kartavyaparekh96 opened this issue Dec 19, 2018 · 5 comments
Closed

App crash in iOS when app load first time #691

kartavyaparekh96 opened this issue Dec 19, 2018 · 5 comments

Comments

@kartavyaparekh96
Copy link

Details:
The stack trace indicates that heap corruption may have caused your app to crash. Memory corruption can occur pretty easily from freeing a dangling pointer, a thread race, or bad pointer arithmetic. The important thing to keep in mind is that the resulting crash may happen long after the initial corruption. As a result, the stack trace for this crash might not provide any clues to the location of the bug in your code. However, you can still fix memory issues with tools from Apple. For speedy resolution of memory corruption issues, we recommend regularly auditing your app with Xcode’s memory debugging facilities: Visual Memory Debugger, Zombies Instrument, Address Sanitizer, Thread Sanitizer and malloc diagnostics.
External resources:
1.iOS Debugging Magic
2.macOS Debugging Magic
3.Apple Memory Usage Performance Guidelines
4.Zombies Instrument Guide
5.WWDC 2015: Advanced Debugging and the Address Sanitizer
6.WWDC 2016: Thread Sanitizer and Static Analysis
7.Apple Secure Coding Guide: Avoiding Buffer Overflows and Underflows

Android works Perfectly but in iOS when first time app open then crash and in fabric gives above instruction

Thank you

@Nightsd01
Copy link
Contributor

Hi @kartavyaparekh96 can you post the stacktrace please?

@kartavyaparekh96
Copy link
Author

kartavyaparekh96 commented Dec 20, 2018

#0. Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x1a5746e4 objc_release + 3
1 CoreFoundation 0x1b2c51bb common_removeAllObjects + 154
2 CoreFoundation 0x1b1e8c85 -[__NSArrayM dealloc] + 14
3 libobjc.A.dylib 0x1a575259 objc_object::sidetable_release(bool) + 238
4 libobjc.A.dylib 0x1a5757a1 (anonymous namespace)::AutoreleasePoolPage::pop(void*) + 612
5 CoreFoundation 0x1b1e0f49 _CFAutoreleasePoolPop + 16
6 CoreFoundation 0x1b28de23 __CFRunLoopRun + 858
7 CoreFoundation 0x1b1e11af CFRunLoopRunSpecific + 470
8 CoreFoundation 0x1b1e0fd1 CFRunLoopRunInMode + 104
9 GraphicsServices 0x1c98bb41 GSEventRunModal + 80
10 UIKit 0x20569a53 UIApplicationMain + 150
11 DosaCorner 0x3374b main (main.m:14)
12 libdyld.dylib 0x1a9ce4eb start + 2

--

#0. Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x1a5746e4 objc_release + 3
1 CoreFoundation 0x1b2c51bb common_removeAllObjects + 154
2 CoreFoundation 0x1b1e8c85 -[__NSArrayM dealloc] + 14
3 libobjc.A.dylib 0x1a575259 objc_object::sidetable_release(bool) + 238
4 libobjc.A.dylib 0x1a5757a1 (anonymous namespace)::AutoreleasePoolPage::pop(void*) + 612
5 CoreFoundation 0x1b1e0f49 _CFAutoreleasePoolPop + 16
6 CoreFoundation 0x1b28de23 __CFRunLoopRun + 858
7 CoreFoundation 0x1b1e11af CFRunLoopRunSpecific + 470
8 CoreFoundation 0x1b1e0fd1 CFRunLoopRunInMode + 104
9 GraphicsServices 0x1c98bb41 GSEventRunModal + 80
10 UIKit 0x20569a53 UIApplicationMain + 150
11 DosaCorner 0x3374b main (main.m:14)
12 libdyld.dylib 0x1a9ce4eb start + 2

#1. com.apple.uikit.eventfetch-thread
0 libsystem_kernel.dylib 0x1aa8c900 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x1aa8c6e1 mach_msg + 44
2 CoreFoundation 0x1b28fbe3 __CFRunLoopServiceMachPort + 144
3 CoreFoundation 0x1b28e065 __CFRunLoopRun + 1436
4 CoreFoundation 0x1b1e11af CFRunLoopRunSpecific + 470
5 CoreFoundation 0x1b1e0fd1 CFRunLoopRunInMode + 104
6 Foundation 0x1bb35af5 + 258
7 Foundation 0x1bb5276d + 86
8 UIKit 0x20e6aad9 -[UIEventFetcher threadMain] + 128
9 Foundation 0x1bc198eb + 1122
10 libsystem_pthread.dylib 0x1ab5893b _pthread_body + 216
11 libsystem_pthread.dylib 0x1ab5885d _pthread_start + 234
12 libsystem_pthread.dylib 0x1ab56468 thread_start + 8

#2. com.apple.NSURLConnectionLoader
0 libsystem_kernel.dylib 0x1aa8c900 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x1aa8c6e1 mach_msg + 44
2 CoreFoundation 0x1b28fbe3 __CFRunLoopServiceMachPort + 144
3 CoreFoundation 0x1b28e065 __CFRunLoopRun + 1436
4 CoreFoundation 0x1b1e11af CFRunLoopRunSpecific + 470
5 CoreFoundation 0x1b1e0fd1 CFRunLoopRunInMode + 104
6 CFNetwork 0x1b8be393 +[NSURLConnection(Loader) _resourceLoadLoop:] + 402
7 Foundation 0x1bc198eb + 1122
8 libsystem_pthread.dylib 0x1ab5893b _pthread_body + 216
9 libsystem_pthread.dylib 0x1ab5885d _pthread_start + 234
10 libsystem_pthread.dylib 0x1ab56468 thread_start + 8

#3. com.squareup.SocketRocket.NetworkThread
0 libsystem_kernel.dylib 0x1aa8c900 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x1aa8c6e1 mach_msg + 44
2 CoreFoundation 0x1b28fbe3 __CFRunLoopServiceMachPort + 144
3 CoreFoundation 0x1b28e065 __CFRunLoopRun + 1436
4 CoreFoundation 0x1b1e11af CFRunLoopRunSpecific + 470
5 CoreFoundation 0x1b1e0fd1 CFRunLoopRunInMode + 104
6 Foundation 0x1bb35af5 + 258
7 DosaCorner 0x296b0f -[_RCTSRRunLoopThread main] (RCTSRWebSocket.m:1592)
8 Foundation 0x1bc198eb + 1122
9 libsystem_pthread.dylib 0x1ab5893b _pthread_body + 216
10 libsystem_pthread.dylib 0x1ab5885d _pthread_start + 234
11 libsystem_pthread.dylib 0x1ab56468 thread_start + 8

#4. Thread
0 libsystem_kernel.dylib 0x1aaa1e7c __semwait_signal + 24
1 libsystem_c.dylib 0x1a9f60e9 nanosleep + 168
2 libc++.1.dylib 0x1a53392b std::__1::this_thread::sleep_for(std::__1::chrono::duration<long long, std::__1::ratio<1ll, 1000000000ll> > const&) + 102
3 JavaScriptCore 0x1f14d3c5 + 148
4 JavaScriptCore 0x1f14d207 + 36
5 JavaScriptCore 0x1f14d121 + 118
6 JavaScriptCore 0x1f14e197 + 76
7 JavaScriptCore 0x1f14e0ed + 18
8 JavaScriptCore 0x1f14e32f + 66
9 libsystem_pthread.dylib 0x1ab5893b _pthread_body + 216
10 libsystem_pthread.dylib 0x1ab5885d _pthread_start + 234
11 libsystem_pthread.dylib 0x1ab56468 thread_start + 8

#5. com.twitter.crashlytics.ios.MachExceptionServer
0 DosaCorner 0x48401 CLSProcessRecordAllThreads + 152
1 DosaCorner 0x48401 CLSProcessRecordAllThreads + 152
2 DosaCorner 0x48691 CLSProcessRecordAllThreads + 808
3 DosaCorner 0x3b949 CLSHandler + 30
4 DosaCorner 0x375c3 CLSMachExceptionServer + 1158
5 libsystem_pthread.dylib 0x1ab5893b _pthread_body + 216
6 libsystem_pthread.dylib 0x1ab5885d _pthread_start + 234
7 libsystem_pthread.dylib 0x1ab56468 thread_start + 8

#6. com.apple.CFStream.LegacyThread
0 libsystem_kernel.dylib 0x1aa8c900 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x1aa8c6e1 mach_msg + 44
2 CoreFoundation 0x1b28fbe3 __CFRunLoopServiceMachPort + 144
3 CoreFoundation 0x1b28e065 __CFRunLoopRun + 1436
4 CoreFoundation 0x1b1e11af CFRunLoopRunSpecific + 470
5 CoreFoundation 0x1b1e0fd1 CFRunLoopRunInMode + 104
6 CoreFoundation 0x1b29a9fd _legacyStreamRunLoop_workThread + 252
7 libsystem_pthread.dylib 0x1ab5893b _pthread_body + 216
8 libsystem_pthread.dylib 0x1ab5885d _pthread_start + 234
9 libsystem_pthread.dylib 0x1ab56468 thread_start + 8

#7. Thread
0 libsystem_kernel.dylib 0x1aaa273c __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x1ab568eb _pthread_wqthread + 1150
2 libsystem_pthread.dylib 0x1ab5645c start_wqthread + 8

#8. Thread
0 libsystem_kernel.dylib 0x1aaa273c __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x1ab56745 _pthread_wqthread + 728
2 libsystem_pthread.dylib 0x1ab5645c start_wqthread + 8

#9. Thread
0 libsystem_kernel.dylib 0x1aaa273c __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x1ab568eb _pthread_wqthread + 1150
2 libsystem_pthread.dylib 0x1ab5645c start_wqthread + 8

#10. Thread
0 libsystem_kernel.dylib 0x1aaa273c __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x1ab568eb _pthread_wqthread + 1150
2 libsystem_pthread.dylib 0x1ab5645c start_wqthread + 8

#11. Thread
0 libsystem_kernel.dylib 0x1aaa273c __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x1ab568eb _pthread_wqthread + 1150
2 libsystem_pthread.dylib 0x1ab5645c start_wqthread + 8

#12. Thread
0 libsystem_kernel.dylib 0x1aaa273c __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x1ab56745 _pthread_wqthread + 728
2 libsystem_pthread.dylib 0x1ab5645c start_wqthread + 8

#13. com.facebook.react.JavaScript
0 libsystem_kernel.dylib 0x1aa8c900 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x1aa8c6e1 mach_msg + 44
2 CoreFoundation 0x1b28fbe3 __CFRunLoopServiceMachPort + 144
3 CoreFoundation 0x1b28e065 __CFRunLoopRun + 1436
4 CoreFoundation 0x1b1e11af CFRunLoopRunSpecific + 470
5 CoreFoundation 0x1b1e0fd1 CFRunLoopRunInMode + 104
6 DosaCorner 0x8c5c3 +[RCTCxxBridge runRunLoop] (RCTCxxBridge.mm:246)
7 Foundation 0x1bc198eb + 1122
8 libsystem_pthread.dylib 0x1ab5893b _pthread_body + 216
9 libsystem_pthread.dylib 0x1ab5885d _pthread_start + 234
10 libsystem_pthread.dylib 0x1ab56468 thread_start + 8

#14. WTF::AutomaticThread
0 libsystem_kernel.dylib 0x1aaa1808 __psynch_cvwait + 24
1 libsystem_pthread.dylib 0x1ab57c43 _pthread_cond_wait + 560
2 libsystem_pthread.dylib 0x1ab59009 pthread_cond_timedwait + 42
3 JavaScriptCore 0x1ec4f453 WTF::ThreadCondition::timedWait(WTF::Mutex&, double) + 114
4 JavaScriptCore 0x1f13acd3 WTF::ParkingLot::parkConditionallyImpl(void const*, WTF::ScopedLambda<bool ()> const&, WTF::ScopedLambda<void ()> const&, WTF::TimeWithDynamicClockType const&) + 2058
5 JavaScriptCore 0x1eec5df3 + 114
6 JavaScriptCore 0x1f12d223 + 190
7 JavaScriptCore 0x1ec4b713 + 136
8 JavaScriptCore 0x1ec4b67b + 12
9 libsystem_pthread.dylib 0x1ab5893b _pthread_body + 216
10 libsystem_pthread.dylib 0x1ab5885d _pthread_start + 234
11 libsystem_pthread.dylib 0x1ab56468 thread_start + 8

#15. WTF::AutomaticThread
0 libsystem_kernel.dylib 0x1aaa1808 __psynch_cvwait + 24
1 libsystem_pthread.dylib 0x1ab57c43 _pthread_cond_wait + 560
2 libsystem_pthread.dylib 0x1ab59009 pthread_cond_timedwait + 42
3 JavaScriptCore 0x1ec4f453 WTF::ThreadCondition::timedWait(WTF::Mutex&, double) + 114
4 JavaScriptCore 0x1f13acd3 WTF::ParkingLot::parkConditionallyImpl(void const*, WTF::ScopedLambda<bool ()> const&, WTF::ScopedLambda<void ()> const&, WTF::TimeWithDynamicClockType const&) + 2058
5 JavaScriptCore 0x1eec5df3 + 114
6 JavaScriptCore 0x1f12d223 + 190
7 JavaScriptCore 0x1ec4b713 + 136
8 JavaScriptCore 0x1ec4b67b + 12
9 libsystem_pthread.dylib 0x1ab5893b _pthread_body + 216
10 libsystem_pthread.dylib 0x1ab5885d _pthread_start + 234
11 libsystem_pthread.dylib 0x1ab56468 thread_start + 8

@Nightsd01
Copy link
Contributor

@kartavyaparekh96 I’m not seeing our SDK in this stacktrace, what leads you to believe it’s caused by our SDK?

In my experience memory corruption bugs like this can be extremely tricky and it’s entirely possible it’s being caused by our SDK even though it doesn’t show up in the stacktrace. But that said I’d like to hear some more details. If it were our SDK I’d expect to be hearing more reports of this.

@FelipeGatti
Copy link

@kartavyaparekh96 Hello! Have you managed to fix this bug ?

I'm testing my app and it works great even in the iOS simulator but when i release to the testflight it crashes 1~2 times and then never more..

I can't even get a stack trace to check this..
By now all the tests i could make led me to know that when i simply remove all OneSignal settings from my root element it doesn't break.

@FelipeGatti
Copy link

FelipeGatti commented Jun 11, 2019

Actualy after some more tests, it seems to break when i set up the eventListeners,

Am i missing something ?

 componentWillMount() {
     this.onOpened = this.onOpened.bind(this);
     this.onReceived = this.onReceived.bind(this);
     OneSignal.init("6****");

  }

  async componentDidMount(){ 
    OneSignal.addEventListener('received', this.onReceived);
    OneSignal.addEventListener('opened', this.onOpened);
    OneSignal.addEventListener('ids', this.onIds);

  componentWillUnmount() {
    OneSignal.removeEventListener('received', this.onReceived);
    OneSignal.removeEventListener('opened', this.onOpened);
    OneSignal.removeEventListener('ids', this.onIds);
  }

  onReceived(notification) {
    console.log("Notification received: ", notification);
  }

  onOpened(openResult) {
    console.log(openResult);
    if (!openResult.notification.isAppInFocus ) {
      setTimeout(()=>{this.setState({screenProps: openResult.notification.payload.additionalData});},1500);
    }
  }

I've tried to put the "addEventListener()" inside the componentWillMount and inside componentDidMount .. neither works..

Edit:
tried also this on constructor:

    this.onOpened = this.onOpened.bind(this);
    this.onReceived = this.onReceived.bind(this);
    OneSignal.init("683dad16-e075-4228-9a4e-d00472936eee");
    OneSignal.addEventListener('received', this.onReceived);
    OneSignal.addEventListener('opened', this.onOpened);
    OneSignal.addEventListener('ids', this.onIds);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants