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

after upgrade to 0.56.0-rc.2 production build is crashing #19827

Closed
3 tasks done
eshikerya opened this issue Jun 20, 2018 · 93 comments
Closed
3 tasks done

after upgrade to 0.56.0-rc.2 production build is crashing #19827

eshikerya opened this issue Jun 20, 2018 · 93 comments
Labels
Resolution: Locked This issue was locked by the bot. Tech: Bundler 📦 This issue is related to the bundler (Metro, Haul, etc) used.

Comments

@eshikerya
Copy link

eshikerya commented Jun 20, 2018

Environment

React Native Environment Info:
    System:
      OS: macOS High Sierra 10.13.6
      CPU: x64 Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz
      Memory: 881.80 MB / 16.00 GB
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 9.11.1 - ~/.nvm/versions/node/v9.11.1/bin/node
      Yarn: 1.7.0 - ~/.yarn/bin/yarn
      npm: 5.6.0 - ~/.nvm/versions/node/v9.11.1/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 11.4, macOS 10.13, tvOS 11.4, watchOS 4.3
      Android SDK:
        Build Tools: 23.0.1, 25.0.2, 25.0.3, 26.0.1, 27.0.1, 27.0.3
        API Levels: 23, 24, 25, 26, 27
    IDEs:
      Android Studio: 3.1 AI-173.4720617
      Xcode: 9.4.1/9F2000 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.3.2 => 16.3.2 
      react-native: 0.56.0-rc.2 => 0.56.0-rc.2 

Description

the project normally functioning on 0.55.4 after react-native-git-upgrade 0.56.0-rc.2working in simulator, but crashing on start on real device with production build. I removed everything, but none is helping, app name is CasualPM, here is crash report:

Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 Exception Note: EXC_CORPSE_NOTIFY Triggered by Thread: 0

Application Specific Information:
abort() called

Filtered syslog:
None found

Last Exception Backtrace:
0 CoreFoundation 0x1e4baf960 __exceptionPreprocess + 152
1 libobjc.A.dylib 0x1e3e6052c objc_exception_throw + 55
2 CasualPM 0x104926e88 hidden#1135 + 192136 (_hidden#2451:132)
3 CasualPM 0x104912d28 hidden#1136 + 109864 (_hidden#1437:854)
4 libdispatch.dylib 0x1e459a8a8 _dispatch_call_block_and_release + 23
5 libdispatch.dylib 0x1e459a85c _dispatch_client_callout + 15
6 libdispatch.dylib 0x1e45a8c28 _dispatch_main_queue_callback_4CF$VARIANT$mp + 1063
7 CoreFoundation 0x1e4b61748 CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 11
8 CoreFoundation 0x1e4b5f3e0 __CFRunLoopRun + 1975
9 CoreFoundation 0x1e4a98430 CFRunLoopRunSpecific + 435
10 Foundation 0x1e5519e84 -[NSRunLoop+ 32388 (NSRunLoop) runMode:beforeDate:] + 299
11 Foundation 0x1e5519cf4 -[NSRunLoop+ 31988 (NSRunLoop) runUntilDate:] + 87
12 CasualPM 0x104a203f4 hidden#14662 + 1213428 (_hidden#14672:30)
13 CasualPM 0x1048fc9a8 hidden#2 + 18856 (_hidden#18:51)
14 UIKitCore 0x2108cc350 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 407
15 UIKitCore 0x2108cda8c -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 3339
16 UIKitCore 0x2108d33c8 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1775
17 UIKitCore 0x2110f200c __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 783
18 UIKitCore 0x2110eec9c +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 159
19 UIKitCore 0x2110f1c88 -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 239
20 UIKitCore 0x2110f24c8 -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 723
21 UIKitCore 0x2110b3084 __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 295
22 UIKitCore 0x2110b2f0c -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 431
23 UIKitCore 0x2110f3f8c __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 219
24 UIKitCore 0x2110f4a7c _performActionsWithDelayForTransitionContext + 111
25 UIKitCore 0x2110f3e44 -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 247
26 UIKitCore 0x2110ee348 -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 367
27 UIKitCore 0x2108d1854 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 539
28 UIKitCore 0x210903704 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 363
29 FrontBoardServices 0x1e75fafa0 -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 443
30 FrontBoardServices 0x1e7605d6c __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 259
31 FrontBoardServices 0x1e7605460 __40-[FBSWorkspace _performDelegateCallOut:]_block_invoke + 63
32 libdispatch.dylib 0x1e459a85c _dispatch_client_callout + 15
33 libdispatch.dylib 0x1e459fe90 _dispatch_block_invoke_direct$VARIANT$mp + 223
34 FrontBoardServices 0x1e7639a14 FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK + 39
35 FrontBoardServices 0x1e76396a0 -[FBSSerialQueue _performNext] + 415
36 FrontBoardServices 0x1e7639cbc -[FBSSerialQueue _performNextFromRunLoopSource] + 55
37 CoreFoundation 0x1e4b61b4c CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 23
38 CoreFoundation 0x1e4b61acc __CFRunLoopDoSource0 + 87
39 CoreFoundation 0x1e4b613a4 __CFRunLoopDoSources0 + 175
40 CoreFoundation 0x1e4b5f044 __CFRunLoopRun + 1051
41 CoreFoundation 0x1e4a98430 CFRunLoopRunSpecific + 435
42 GraphicsServices 0x1e6dc7548 GSEventRunModal + 99
43 UIKitCore 0x2108d51e0 UIApplicationMain + 211
44 CasualPM 0x1048fca68 main + 19048 (_hidden#21:14)
45 libdyld.dylib 0x1e460cfa8 start + 3

Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x00000001e475867c __pthread_kill + 8
1 libsystem_pthread.dylib 0x00000001e47d7520 pthread_kill$VARIANT$mp + 384
2 libsystem_c.dylib 0x00000001e46bab80 abort + 140
3 libc++abi.dylib 0x00000001e3e43ea8 abort_message + 132
4 libc++abi.dylib 0x00000001e3e4406c default_terminate_handler+ 8300 () + 316
5 libobjc.A.dylib 0x00000001e3e60940 _objc_terminate+ 35136 () + 124
6 CasualPM 0x0000000104a06fd8 hidden#13772 + 1109976 (_hidden#13780:179)
7 libc++abi.dylib 0x00000001e3e50ff0 std::__terminate(void (*)+ 61424 ()) + 16
8 libc++abi.dylib 0x00000001e3e51088 std::terminate+ 61576 () + 88
9 libdispatch.dylib 0x00000001e459a870 _dispatch_client_callout + 36
10 libdispatch.dylib 0x00000001e45a8c28 _dispatch_main_queue_callback_4CF$VARIANT$mp + 1064
11 CoreFoundation 0x00000001e4b61748 CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 12
12 CoreFoundation 0x00000001e4b5f3e0 __CFRunLoopRun + 1976
13 CoreFoundation 0x00000001e4a98430 CFRunLoopRunSpecific + 436
14 Foundation 0x00000001e5519e84 -[NSRunLoop+ 32388 (NSRunLoop) runMode:beforeDate:] + 300
15 Foundation 0x00000001e5519cf4 -[NSRunLoop+ 31988 (NSRunLoop) runUntilDate:] + 88
16 CasualPM 0x0000000104a203f4 hidden#14662 + 1213428 (_hidden#14672:30)
17 CasualPM 0x00000001048fc9a8 hidden#2 + 18856 (_hidden#18:55)
18 UIKitCore 0x00000002108cc350 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 408
19 UIKitCore 0x00000002108cda8c -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 3340
20 UIKitCore 0x00000002108d33c8 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1776
21 UIKitCore 0x00000002110f200c __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 784
22 UIKitCore 0x00000002110eec9c +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 160
23 UIKitCore 0x00000002110f1c88 -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 240
24 UIKitCore 0x00000002110f24c8 -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 724
25 UIKitCore 0x00000002110b3084 __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 296
26 UIKitCore 0x00000002110b2f0c -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 432
27 UIKitCore 0x00000002110f3f8c __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 220
28 UIKitCore 0x00000002110f4a7c _performActionsWithDelayForTransitionContext + 112
29 UIKitCore 0x00000002110f3e44 -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 248
30 UIKitCore 0x00000002110ee348 -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 368
31 UIKitCore 0x00000002108d1854 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 540
32 UIKitCore 0x0000000210903704 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 364
33 FrontBoardServices 0x00000001e75fafa0 -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 444
34 FrontBoardServices 0x00000001e7605d6c __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 260
35 FrontBoardServices 0x00000001e7605460 __40-[FBSWorkspace _performDelegateCallOut:]_block_invoke + 64
36 libdispatch.dylib 0x00000001e459a85c _dispatch_client_callout + 16
37 libdispatch.dylib 0x00000001e459fe90 _dispatch_block_invoke_direct$VARIANT$mp + 224
38 FrontBoardServices 0x00000001e7639a14 FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK + 40
39 FrontBoardServices 0x00000001e76396a0 -[FBSSerialQueue _performNext] + 416
40 FrontBoardServices 0x00000001e7639cbc -[FBSSerialQueue _performNextFromRunLoopSource] + 56
41 CoreFoundation 0x00000001e4b61b4c CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 24
42 CoreFoundation 0x00000001e4b61acc __CFRunLoopDoSource0 + 88
43 CoreFoundation 0x00000001e4b613a4 __CFRunLoopDoSources0 + 176
44 CoreFoundation 0x00000001e4b5f044 __CFRunLoopRun + 1052
45 CoreFoundation 0x00000001e4a98430 CFRunLoopRunSpecific + 436
46 GraphicsServices 0x00000001e6dc7548 GSEventRunModal + 100
47 UIKitCore 0x00000002108d51e0 UIApplicationMain + 212
48 CasualPM 0x00000001048fca68 main + 19048 (_hidden#21:14)
49 libdyld.dylib 0x00000001e460cfa8 start + 4

Thread 1:
0 libsystem_pthread.dylib 0x00000001e47d5368 start_wqthread + 0

Thread 2:
0 libsystem_pthread.dylib 0x00000001e47d5368 start_wqthread + 0

Thread 3 name: Dispatch queue: Error API queue (QOS: UTILITY)
Thread 3:
0 libsystem_kernel.dylib 0x00000001e47589a0 __semwait_signal + 8
1 libsystem_c.dylib 0x00000001e4664c4c nanosleep + 212
2 Foundation 0x00000001e562a380 +[NSThread sleepForTimeInterval:] + 136
3 Foundation 0x00000001e5547468 -[__NSOperationInternal _start:] + 844
4 Foundation 0x00000001e5608fb4 __NSOQSchedule_f + 272
5 libdispatch.dylib 0x00000001e459a8a8 _dispatch_call_block_and_release + 24
6 libdispatch.dylib 0x00000001e459a85c _dispatch_client_callout + 16
7 libdispatch.dylib 0x00000001e459f8a0 _dispatch_continuation_pop$VARIANT$mp + 412
8 libdispatch.dylib 0x00000001e459ef54 _dispatch_async_redirect_invoke + 600
9 libdispatch.dylib 0x00000001e45abcd4 _dispatch_root_queue_drain + 372
10 libdispatch.dylib 0x00000001e45ac590 _dispatch_worker_thread2 + 128
11 libsystem_pthread.dylib 0x00000001e47d55c0 _pthread_wqthread + 480
12 libsystem_pthread.dylib 0x00000001e47d536c start_wqthread + 4

Thread 4:
0 libsystem_pthread.dylib 0x00000001e47d5368 start_wqthread + 0

Thread 5:
0 libsystem_pthread.dylib 0x00000001e47d5368 start_wqthread + 0

Thread 6 name: com.apple.uikit.eventfetch-thread
Thread 6:
0 libsystem_kernel.dylib 0x00000001e4736328 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x00000001e47361a0 mach_msg + 72
2 CoreFoundation 0x00000001e4b61538 __CFRunLoopServiceMachPort + 236
3 CoreFoundation 0x00000001e4b5f1a8 __CFRunLoopRun + 1408
4 CoreFoundation 0x00000001e4a98430 CFRunLoopRunSpecific + 436
5 Foundation 0x00000001e5519e84 -[NSRunLoop+ 32388 (NSRunLoop) runMode:beforeDate:] + 300
6 Foundation 0x00000001e5519cf4 -[NSRunLoop+ 31988 (NSRunLoop) runUntilDate:] + 88
7 UIKitCore 0x000000021083274c -[UIEventFetcher threadMain] + 136
8 Foundation 0x00000001e562b064 NSThread__start + 1040
9 libsystem_pthread.dylib 0x00000001e47d65a4 _pthread_body + 132
10 libsystem_pthread.dylib 0x00000001e47d64f8 _pthread_start + 48
11 libsystem_pthread.dylib 0x00000001e47d5374 thread_start + 4

Thread 7 name: JavaScriptCore bmalloc scavenger
Thread 7:
0 libsystem_kernel.dylib 0x00000001e4758484 __psynch_cvwait + 8
1 libsystem_pthread.dylib 0x00000001e47d909c _pthread_cond_wait$VARIANT$mp + 636
2 libc++.1.dylib 0x00000001e3deef10 std::__1::condition_variable::__do_timed_wait+ 32528 (std::__1::unique_lockstd::__1::mutex&, std::__1::chrono::time_point<std::__1::chrono::system_clock, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l> > >) + 96
3 JavaScriptCore 0x00000001ec84e28c std::__1::cv_status std::__1::condition_variable::wait_until<std::__1::chrono::steady_clock, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l> > >+ 1565324 (std::__1::unique_lockstd::__1::mutex&, std::__1::chrono::time_point<std::__1::chrono::steady_clock, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l> > > const&) + 124
4 JavaScriptCore 0x00000001ec84e130 std::__1::cv_status std::__1::condition_variable_any::wait_until<std::__1::unique_lockbmalloc::Mutex, std::__1::chrono::steady_clock, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l> > >+ 1564976 (std::__1::unique_lockbmalloc::Mutex&, std::__1::chrono::time_point<std::__1::chrono::steady_clock, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l> > > const&) + 112
5 JavaScriptCore 0x00000001ec84cda0 bmalloc::Scavenger::threadRunLoop+ 1559968 () + 296
6 JavaScriptCore 0x00000001ec84c458 bmalloc::Scavenger::threadEntryPoint+ 1557592 (bmalloc::Scavenger*) + 12
7 JavaScriptCore 0x00000001ec84df0c void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_deletestd::__1::__thread_struct >, void ()(bmalloc::Scavenger), bmalloc::Scavenger*> >+ 1564428 (void*) + 44
8 libsystem_pthread.dylib 0x00000001e47d65a4 _pthread_body + 132
9 libsystem_pthread.dylib 0x00000001e47d64f8 _pthread_start + 48
10 libsystem_pthread.dylib 0x00000001e47d5374 thread_start + 4

Thread 8 name: WebThread
Thread 8:
0 libsystem_kernel.dylib 0x00000001e4736328 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x00000001e47361a0 mach_msg + 72
2 CoreFoundation 0x00000001e4b61538 __CFRunLoopServiceMachPort + 236
3 CoreFoundation 0x00000001e4b5f1a8 __CFRunLoopRun + 1408
4 CoreFoundation 0x00000001e4a98430 CFRunLoopRunSpecific + 436
5 WebCore 0x00000001edd61f4c RunWebThread+ 274252 (void*) + 592
6 libsystem_pthread.dylib 0x00000001e47d65a4 _pthread_body + 132
7 libsystem_pthread.dylib 0x00000001e47d64f8 _pthread_start + 48
8 libsystem_pthread.dylib 0x00000001e47d5374 thread_start + 4

Thread 9 name: WTF::AutomaticThread
Thread 9:
0 libsystem_kernel.dylib 0x00000001e4758484 __psynch_cvwait + 8
1 libsystem_pthread.dylib 0x00000001e47d909c _pthread_cond_wait$VARIANT$mp + 636
2 JavaScriptCore 0x00000001ec83a88c WTF::ThreadCondition::timedWait+ 1484940 (WTF::Mutex&, WTF::WallTime) + 148
3 JavaScriptCore 0x00000001ec82698c WTF::ParkingLot::parkConditionallyImpl(void const*, WTF::ScopedLambda<bool ()> const&, WTF::ScopedLambda<void + 1403276 ()> const&, WTF::TimeWithDynamicClockType const&) + 2004
4 JavaScriptCore 0x00000001ec80b520 bool WTF::Condition::waitUntilWTF::Lock+ 1291552 (WTF::Lock&, WTF::TimeWithDynamicClockType const&) + 184
5 JavaScriptCore 0x00000001ec80b8c0 WTF::Function<void ()>::CallableWrapper<WTF::AutomaticThread::start(WTF::AbstractLocker const&)::$_0>::call+ 1292480 () + 216
6 JavaScriptCore 0x00000001ec838b3c WTF::Thread::entryPoint+ 1477436 (WTF::Thread::NewThreadContext*) + 256
7 JavaScriptCore 0x00000001ec6d9630 WTF::wtfThreadEntryPoint+ 38448 (void*) + 12
8 libsystem_pthread.dylib 0x00000001e47d65a4 _pthread_body + 132
9 libsystem_pthread.dylib 0x00000001e47d64f8 _pthread_start + 48
10 libsystem_pthread.dylib 0x00000001e47d5374 thread_start + 4

Thread 0 crashed with ARM Thread State (64-bit):
x0: 0x0000000000000000 x1: 0x0000000000000000 x2: 0x0000000000000000 x3: 0x0000000283d80137
x4: 0x00000001e3e54b41 x5: 0x000000016b503fa0 x6: 0x000000000000006e x7: 0xffffffffffffffec
x8: 0x0000000000000800 x9: 0x00000001e47dbe2c x10: 0x00000001e47d73a0 x11: 0x0000000000000003
x12: 0x0000000000000001 x13: 0x0000000000000000 x14: 0x0000000000000010 x15: 0x00000000000007fb
x16: 0x0000000000000148 x17: 0x0000000000000000 x18: 0x0000000000000000 x19: 0x0000000000000006
x20: 0x000000021cd310c0 x21: 0x000000016b503fa0 x22: 0x0000000000000303 x23: 0x000000021cd311a0
x24: 0x000000021cd311a0 x25: 0x0000000000000000 x26: 0x0000000044000000 x27: 0x00000002806c5240
x28: 0x0000000002ffffff fp: 0x000000016b503f00 lr: 0x00000001e47d7520
sp: 0x000000016b503ed0 pc: 0x00000001e475867c cpsr: 0x00000000

anybody could give me a clue of what could go wrong?

@francisco-sanchez-molina

I think it's the same issue that #19806

@eshikerya
Copy link
Author

confirmed. it is crashing with message:
Unhandled JS Exception: Can't find variable: regeneratorRuntime

@elicwhite
Copy link
Member

Can you see if moving these two lines:

const ReactNativeVersionCheck = require('ReactNativeVersionCheck');
ReactNativeVersionCheck.checkVersions();

in InitializeCore

to be below the timerSetup fixes this crash?

@eshikerya
Copy link
Author

@TheSavior moved down under line defineLazyTimer('cancelIdleCallback');still got same issue:
Unhandled JS Exception: Can't find variable: regeneratorRuntime

@elicwhite
Copy link
Member

Try moving the polyfill block: polyfillGlobal('regeneratorRuntime', () => { above the polyfillGlobal('Promise', () => require('Promise')); line.

The reason I'm thinking we should be mucking around here is because I ran into this myself a while back and the issue was that something was crashing but the exception handler required regeneratorRuntime but it hadn't been polyfilled yet.

Do you have a stack trace from the exception?

Can you repro with a debugger statement and step around?

@eshikerya
Copy link
Author

eshikerya commented Jun 21, 2018

@TheSavior it doesn't help. here is what the file is looks like now:

// Set up regenerator.
polyfillGlobal('regeneratorRuntime', () => {
  // The require just sets up the global, so make sure when we first
  // invoke it the global does not exist
  delete global.regeneratorRuntime;
  /* $FlowFixMe(>=0.54.0 site=react_native_oss) This comment suppresses an
   * error found when Flow v0.54 was deployed. To see the error delete this
   * comment and run Flow. */
  require('regenerator-runtime/runtime');
  return global.regeneratorRuntime;
});

// Set up Promise
// The native Promise implementation throws the following error:
// ERROR: Event loop not supported.
polyfillGlobal('Promise', () => require('Promise'));

// Set up timers
const defineLazyTimer = name => {
  polyfillGlobal(name, () => require('JSTimers')[name]);
};
defineLazyTimer('setTimeout');
defineLazyTimer('setInterval');
defineLazyTimer('setImmediate');
defineLazyTimer('clearTimeout');
defineLazyTimer('clearInterval');
defineLazyTimer('clearImmediate');
defineLazyTimer('requestAnimationFrame');
defineLazyTimer('cancelAnimationFrame');
defineLazyTimer('requestIdleCallback');
defineLazyTimer('cancelIdleCallback');

// Check for compatibility between the JS and native code
const ReactNativeVersionCheck = require('ReactNativeVersionCheck');
ReactNativeVersionCheck.checkVersions();

exactly same issue: Unhandled JS Exception: Can't find variable: regeneratorRuntime (/Users/xxx/Library/Developer/CoreSimulator/Devices/25D07A35-FD85-44FA-AD03-18D47AF6F3DA/data/Containers/Bundle/Application/xxx/xxx/main.jsbundle:326)

PS: No stack trace, as far I can get this message from device log, there is no trace. even try-catch doesn't help. I can't debug as far it early initiation. could you suggest the way to debug?

@elicwhite
Copy link
Member

Can you repro on a new project and provide easy repro steps for someone else to take a look?

@eshikerya
Copy link
Author

@TheSavior
the funny thing: empty project (created by react-native init and upgraded to rc.2 - works ok. just verified. Also I tried to make production build for RNTesterproject, which also is fine.

I would try to add some portions of code from my project until it breaks...
will let you know my findings

@macrozone
Copy link

@eshikerya same issue here. Any updates on your side?

@eshikerya
Copy link
Author

very strange is going on here. stable code under 55.4 looks wierd now. removed any imports and have just simple screen with fake text, then adding line by line until it breaks, then dig deeper. regular fetch is working, promise is working, redux is working. get stuck it level where im showing login/error screen. not crashing but show empty screen, works under debug build, but not under release. going deeper. will share my finding when i find something...

@macrozone
Copy link

@eshikerya on my app it even crashes on the device started on debug from xcode. It runs on the simulator however.

@eshikerya
Copy link
Author

anything in console? which issue causing it? mine is Unhandled JS Exception: Can't find variable: regeneratorRuntime

@macrozone
Copy link

@eshikerya after doing

watchman watch-del-all
rm -rf ./node_modules
rm -rf $TMPDIR/react-*
yarn install

and reinstall the app on ios, it works no on DEBUG, i'll check now release...

@macrozone
Copy link

macrozone commented Jun 22, 2018

@eshikerya ok, can confirm it also crashes on RELEASE build with the same error:

Can't find variable: regeneratorRuntime (/var/containers/Bundle/Application/C4B19D4D-A27A-4B0F-B024-926777EFDA00/Velo-Mittwoch-staging.app/main.jsbundle:789)

i am using redux-saga which (i think) uses regenerator-runtime. Maybe it just needs to be installed because of the changes in babel 7? it makes no sense however, that it works on debug build...

Edit: i found out that i have regenerator-runtime twice: 0.11 (from react-native) and 0.10 (indirectly from react-native-firebase (react-native-firebase --> opencollective --> babel-polyfill --> [email protected])

maybe that's a clue? can you check your yarn.lock?

Edit: ok no, we already had both regenerator-runtimes in the previous react-native version...

@francisco-sanchez-molina

Android release version fail too:

06-22 17:31:37.972 27529 27632 E AndroidRuntime: Caused by: com.facebook.jni.CppException: Can't find variable: Promise (index.android.bundle:817)

@francisco-sanchez-molina
Copy link

francisco-sanchez-molina commented Jun 22, 2018

I found a workaround. I change my index.js:

import { AppRegistry } from 'react-native';
import App from './App';
AppRegistry.registerComponent('xxxxapp', () => App);

by

import { AppRegistry } from 'react-native';
AppRegistry.registerComponent('xxxxapp', () => require('./App').default);

and its work on release configuration

@macrozone
Copy link

@francisco-sanchez-molina can confirm that this seems to work on android and ios!

but this means that the error occures on usage on generators in the app code. Do you use generators? Then, shouldn't we be able to import the polyfill before AppRegistry?

@elicwhite
Copy link
Member

You changed from import to require and also inclined it. What if you only do one of those things?

import { AppRegistry } from 'react-native';
const App = require(‘./App’).default;
AppRegistry.registerComponent('xxxxapp', () => App);

@francisco-sanchez-molina

@TheSavior I test it, and this version

import { AppRegistry } from 'react-native';

const App = require('./App').default;

AppRegistry.registerComponent('newbalanceapp', () => App);

fails :/

@francisco-sanchez-molina

@macrozone I do not use generators

@eshikerya
Copy link
Author

@TheSavior rollback from where I began and changed index.js for this:

import { AppRegistry } from 'react-native';
// import App from './src/bootstrap';

AppRegistry.registerComponent('App', () => require('./src/bootstrap').default);

now it works in Production build, even I use generators... hm...

@elicwhite
Copy link
Member

Are you able to repro this on a brand new project created with the latest RC via react-native init?

Coming up with a minimal repro will help us track down the problem.

@eshikerya
Copy link
Author

goes through some seeds on react-native awesome pages, those I could quickly upgrade to latest RC - works as expected. project created by react-native initafter some magic as yarn upgrade babel-preset-react-native@next - works as expected. have no idea what is causing the issue... will dig later...

@macrozone
Copy link

macrozone commented Jun 25, 2018

@TheSavior here is a reproduction. it indeed happens when you use generators:

https://github.com/macrozone/react-native-056-crash-on-production-reproduction

it s fresh react-native init project, upgraded to 0.56-rc.2

I just added redux and redux-saga and initialized a store how you would normally do with redux and redux-saga.

on production it crashes with Unhandled JS Exception: Can't find variable: regeneratorRuntime

EDIT: It's even simple to reproduce it. Just add this line in App.js:

function* crashyMcCrashface() {}

the bare existence of a generator function will crash the app on production

@francisco-sanchez-molina

You can also reproduce issue with the following code console.log(Promise);

const instructions = Platform.select({
  ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu',
  android:
    'Double tap R on your keyboard to reload,\n' +
    'Shake or press menu button for dev menu',
});

console.log(Promise);

type Props = {};
export default class App extends Component<Props> {
  render() {

@gastonmorixe
Copy link

I have problems with missing fetch, WebSocket and alert.

Can't release my app since I have coded it using babel 7 babel-plugin-transform-optional-chaining so completely blocked by this.

@gastonmorixe

This comment has been minimized.

@kelset
Copy link
Contributor

kelset commented Jul 11, 2018

Hey @Titozzz, thanks for the deep digging. I'll link your comment to some devs on the Metro team, but yeah probably it would be best to open an issue on the metro for the InitializeCore portion.

@farwayer
Copy link
Contributor

farwayer commented Jul 11, 2018

One more production build issue with babel helpers with 2 workarounds #20150

@perryspy

This comment has been minimized.

@kelset
Copy link
Contributor

kelset commented Jul 11, 2018

@perryspy -> #19827 (comment)

@danieljvdm
Copy link

@Titozzz

Thanks for the follow-up.

I'm still stuck on this point:

  • regeneratorRuntime not defined when bundling => use .babelrc.js instead of babel.config.js

I'm not convinced that's the solution. I'm using a static .babelrc. I've even gone so far as adding babel-polyfill to my dependencies and requiring it at the start. Still no dice.

@Titozzz
Copy link
Collaborator

Titozzz commented Jul 11, 2018

@danieljvdm You can put w/e in your code, the cli is crashing before reaching your code. If you want to fix it the dirty way, have you tried adding babel/polyfill into cli.js (see my first edit here : #19827 (comment))

@nicholasrq
Copy link

faced same issue, @Titozzz's solution worked like a charm

@EdwardDrapkin

This comment has been minimized.

@gastonmorixe
Copy link

@EdwardDrapkin I have personally opted to fork 0.56 and rebase removing all babel and metro commits. After fixing some conflicts, it is working great.

@anshul-kai
Copy link

Thanks for all the research @Titozzz. Honestly, I don't understand the technical complications involved in your solution but it works like a charm on both iOS and Android. Much appreciation for your help!

@birkir
Copy link
Contributor

birkir commented Jul 13, 2018

If you have a typescript setup this fix works well:

#19827 (comment)

Make sure to put before everything else.

@anshul-kai
Copy link

Unfortunately, your fix did not work for me @birkir

@Titozzz
Copy link
Collaborator

Titozzz commented Jul 13, 2018

@EdwardDrapkin Of course they ran CI and did tests and it worked for them. It's been 4 month since the last release and honestly, I was expecting so many more things to go wrong.. You can already build working release with the fixes from this thread if you need it. If you want to follow the fix, @rafeca said he was gonna implent my fix directly into metro.

As to why they promoted to release with this issue opened, @kelset said they needed more feedback to understand the bug and that exactly what happened !
I know it can be frustrating when something you try to use is broken, but please remember that is it mostly open source people that do it on their free time.

If you need any help please post below 🎉

@anshul-kai
Copy link

@Titozzz is right. I've spent days when upgrading to new versions in the past. This was a breeze and since it only breaks for release builds, a little harder to catch. Upgrading to 0.56.0 was the easiest of all the upgrades I've done in the past.

Cheers and thanks to all for helping!

@kelset kelset added Tech: Bundler 📦 This issue is related to the bundler (Metro, Haul, etc) used. and removed 🔧Tooling labels Jul 13, 2018
@Titozzz
Copy link
Collaborator

Titozzz commented Jul 13, 2018

Hello everyone! A new release of metro, 0.38.3, has been released and it should fix this issue. Since RN 0.56.0 depends on metro version

    "metro": "^0.38.1",
    "metro-babel-register": "^0.38.1",
    "metro-core": "^0.38.1",
    "metro-memory-fs": "^0.38.1",

This means that to apply the fix you would simply need to remove the node_modules (and if they're using yarn.lock you'll need to also clean metro from the lock file) and reinstall.

Or

yarn upgrade [email protected] will update all the dependencies too !

Thanks @kelset @rafeca ❤️ 🎉

@hungdev
Copy link

hungdev commented Jul 15, 2018

@Titozzz im at the 0.56.0 version. But i still get this error.
my package.json

{
  "name": "MyAppName",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "apisauce": "^0.15.2",
    "bugsnag-react-native": "^2.10.0",
    "color": "^3.0.0",
    "lodash": "^4.17.10",
    "moment": "^2.22.2",
    "numeral": "^2.0.6",
    "react": "16.4.1",
    "react-native": "0.56.0",
    "react-native-flash-message": "^0.1.9",
    "react-native-iphone-x-helper": "^1.0.3",
    "react-native-modal": "^6.4.0",
    "react-native-orientation": "^3.1.3",
    "react-native-root-toast": "^3.0.1",
    "react-native-scrollable-tab-view": "^0.8.0",
    "react-native-vector-icons": "^4.6.0",
    "react-native-video": "^3.0.0",
    "react-native-video-controls": "^2.2.3",
    "react-navigation": "^2.6.2",
    "react-navigation-slide-from-right-transition": "^1.0.4",
    "react-redux": "^5.0.7",
    "redux": "^4.0.0",
    "redux-persist": "^5.10.0",
    "redux-saga": "^0.16.0"
  },
  "devDependencies": {
    "babel-jest": "23.2.0",
    "babel-preset-react-native": "^5",
    "jest": "23.3.0",
    "react-test-renderer": "16.4.1",
    "reactotron-react-native": "^2.0.0"
  },
  "jest": {
    "preset": "react-native"
  }
}

@Titozzz
Copy link
Collaborator

Titozzz commented Jul 16, 2018

@hungdev Are you sure you ran the upgrade command ? Which version of metro are you using right now ? (You can run yarn why metro to know)

@hungdev
Copy link

hungdev commented Jul 16, 2018

@Titozzz I did not upgrade. I set up the new project.
Could you tell me how to get version of metro?

@kelset
Copy link
Contributor

kelset commented Jul 16, 2018

@hungdev can you create a small repo with the repro and post the link?

@Titozzz
Copy link
Collaborator

Titozzz commented Jul 16, 2018

@hungdev If you set up your repo before we released the fix, you are probably running the wrong version of metro. Please run this step: yarn upgrade [email protected] even if you did not upgrade, it will make sure the dependencies are up to date. Or you can set up another new project.

@hungdev
Copy link

hungdev commented Jul 16, 2018

i ran: yarn upgrade [email protected] in my project. But it still get same error.
But when i create an example and build release. It builds release fine.
I don't understand where is my error. Maybe i should create new project and copy source code to that.

@Titozzz
Copy link
Collaborator

Titozzz commented Jul 16, 2018

@hungdev Can you paste your error trace here ? You did not specify what was your issue.

@hungdev
Copy link

hungdev commented Jul 16, 2018

im using bugsnag to detect
screen shot 2018-07-16 at 8 00 58 pm

@kelset
Copy link
Contributor

kelset commented Jul 16, 2018

It seems to me that this should require a separate issue once it has been properly understood and there is a repro. I'm closing this issue as it seems that it fixed for most people, and again please open a new one with a repro once you understand where the issue lies @hungdev

@kelset kelset closed this as completed Jul 16, 2018
@facebook facebook locked as resolved and limited conversation to collaborators Jul 16, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot. Tech: Bundler 📦 This issue is related to the bundler (Metro, Haul, etc) used.
Projects
None yet
Development

No branches or pull requests