xmartlabs / XLForm

XLForm is the most flexible and powerful iOS library to create dynamic table-view forms. Fully compatible with Swift & Obj-C.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Crash in version 4.0.0 - CALayerInvalidGeometry; CALayer bounds contains NaN

liraz opened this issue · comments

Device: iPhone SE
OS: 11.3.1

Seems related to UIPickerTableView changing visibility of another row.
This might be related to multi-threading - two threads are changing visibility at the same time.

This is the crash log from Fabric:

Crashed: com.apple.main-thread
0  UIKit                          0x18b665478 -[UISectionRowData heightForRow:inSection:canGuess:] + 56
1  UIKit                          0x18b665414 -[UITableViewRowData heightForRow:inSection:canGuess:adjustForReorderedRow:] + 332
2  UIKit                          0x18b66517c -[UITableViewRowData rectForRow:inSection:heightCanBeGuessed:] + 1004
3  UIKit                          0x18b6e10f0 -[UITableView _rectForRowAtIndexPath:usingPresentationValues:] + 236
4  UIKit                          0x18b6e0fc4 -[UITableView rectForRowAtIndexPath:] + 84
5  UIKit                          0x18befda54 -[UIPickerTableView contentOffsetForRowAtIndexPath:] + 32
6  UIKit                          0x18befbe58 -[UIPickerTableView _scrollRowAtIndexPathToSelectionBar:animated:] + 192
7  UIKit                          0x18befc248 -[UIPickerTableView selectRow:animated:notify:updateChecked:] + 756
8  UIKit                          0x18b96b9b0 -[UIPickerView _selectRow:inComponent:animated:notify:] + 156
9  XLForm                         0x101dfcb7c -[XLFormPickerCell update] (XLFormPickerCell.m:86)
10 XLForm                         0x101e13158 -[XLFormViewController configureCell:] (XLFormViewController.m:580)
11 XLForm                         0x101e130f4 -[XLFormViewController updateFormRow:] (XLFormViewController.m:572)
12 XLForm                         0x101e136c0 -[XLFormViewController tableView:cellForRowAtIndexPath:] (XLFormViewController.m:609)
13 UIKit                          0x18b668148 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 668
14 UIKit                          0x18b667e00 -[UITableView _createPreparedCellForGlobalRow:willDisplay:] + 80
15 UIKit                          0x18b6cbb90 -[_UITableViewUpdateSupport(Private) _setupAnimationsForNewlyInsertedCells] + 5168
16 UIKit                          0x18b6c718c -[_UITableViewUpdateSupport _setupAnimations] + 140
17 UIKit                          0x18b6c6b4c -[UITableView _updateWithItems:updateSupport:] + 2428
18 UIKit                          0x18b6c3bb4 -[UITableView _endCellAnimationsWithContext:] + 15284
19 UIKit                          0x18b6bff10 -[UITableView endUpdates] + 92
20 XLForm                         0x101e10e54 -[XLFormViewController formRowHasBeenAdded:atIndexPath:] (XLFormViewController.m:279)
21 XLForm                         0x101e02df4 -[XLFormSectionDescriptor observeValueForKeyPath:ofObject:change:context:] (XLFormSectionDescriptor.m:251)
22 Foundation                     0x1823592f8 NSKeyValueNotifyObserver + 304
23 Foundation                     0x182358e30 NSKeyValueDidChange + 380
24 Foundation                     0x1823ddca0 NSKeyValueDidChangeWithPerThreadPendingNotifications + 140
25 Foundation                     0x1823db6f4 NSKVOInsertObjectAtIndexAndNotify + 232
26 XLForm                         0x101e02a30 -[XLFormSectionDescriptor showFormRow:] (XLFormSectionDescriptor.m:231)
27 XLForm                         0x101dffb58 -[XLFormRowDescriptor evaluateIsHidden] (XLFormRowDescriptor.m:449)
28 XLForm                         0x101dffdb0 -[XLFormRowDescriptor setHidden:] (XLFormRowDescriptor.m:465)
29 XLForm                         0x101e03480 -[XLFormSectionDescriptor insertObject:inAllRowsAtIndex:] (XLFormSectionDescriptor.m:316)
30 XLForm                         0x101e021e0 -[XLFormSectionDescriptor addFormRow:afterRow:] (XLFormSectionDescriptor.m:143)
31 XLForm                         0x101df7794 -[XLFormInlineSelectorCell becomeFirstResponder] (XLFormInlineSelectorCell.m:56)
32 XLForm                         0x101e147a8 -[XLFormViewController tableView:didSelectRowAtIndexPath:] (XLFormViewController.m:746)
33 UIKit                          0x18b8a3f10 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 1356
34 UIKit                          0x18b8f7b94 -[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 268
35 UIKit                          0x18b9828b8 _runAfterCACommitDeferredBlocks + 296
36 UIKit                          0x18b97898c _cleanUpAfterCAFlushAndRunDeferredBlocks + 384
37 UIKit                          0x18b85d550 _afterCACommitHandler + 132
38 CoreFoundation                 0x181972910 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
39 CoreFoundation                 0x181970238 __CFRunLoopDoObservers + 412
40 CoreFoundation                 0x181970884 __CFRunLoopRun + 1436
41 CoreFoundation                 0x181890da8 CFRunLoopRunSpecific + 552
42 GraphicsServices               0x183873020 GSEventRunModal + 100
43 UIKit                          0x18b87178c UIApplicationMain + 236
44 EVgo                           0x1009237ec main (main.m:25)
45 libdyld.dylib                  0x181321fc0 start + 4

i am not able to reproduce this crash on my own currently, it came from one of the users device.
and happened only once in the last 3 days - it might crash again, so i am trying to get to the bottom of this.

tried to reproduce this on the simulator with 11.3.1 and SE

Just received the following insight from fabric:
Heads Up!
CALayerInvalidGeometry; CALayer bounds contains NaN: [...]

This crash is likely due to a division by zero when applying a transform to a view or layer. Setting the 'CG_NUMERICS_SHOW_BACKTRACE' environment variable in Xcode can help pinpoint the root cause. Check out the references below for more details.

External resources:

  1. Crash occurring because “CALayer bounds contains NaN: [nan 0; nan 15.1]
  2. 'CALayerInvalidGeometry', reason: 'CALayer bounds contains NaN' exception
  3. Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [nan nan]' #15

Another crash just happend - and added more info to our fabric crash logs.
This time it's iPhone 6 with iOS 11.2.5 (15D60)
It happend at the same page, with the same component - so this crash is obviously the same one, and fabric did the right thing to notice it as the same.

Fatal Exception: CALayerInvalidGeometry
0  CoreFoundation                 0x18505f164 __exceptionPreprocess
1  libobjc.A.dylib                0x1842a8528 objc_exception_throw
2  CoreFoundation                 0x18505f0ac -[NSException initWithCoder:]
3  QuartzCore                     0x1890ac87c CA::Layer::set_bounds(CA::Rect const&, bool)
4  QuartzCore                     0x18909e570 -[CALayer setBounds:]
5  UIKit                          0x18e66557c -[UIView(Geometry) setBounds:]
6  UIKit                          0x18e672f38 -[UIScrollView setBounds:]
7  UIKit                          0x18e6e9fd4 -[UITableView setBounds:]
8  UIKit                          0x18ef10004 -[UIPickerTableView setBounds:]
9  UIKit                          0x18e637da8 -[UIScrollView setContentOffset:]
10 UIKit                          0x18e6dd180 -[UITableView setContentOffset:]
11 UIKit                          0x18ef0f4a4 -[UIPickerTableView _setContentOffset:notify:]
12 UIKit                          0x18e91acb0 -[UIScrollView(UIScrollViewInternal) _setContentOffset:animated:animationCurve:animationAdjustsForContentOffsetDelta:animation:]
13 UIKit                          0x18ef0e744 -[UIPickerTableView _scrollRowAtIndexPathToSelectionBar:animated:]
14 UIKit                          0x18ef0eb00 -[UIPickerTableView selectRow:animated:notify:updateChecked:]
15 UIKit                          0x18e86bb50 -[UIPickerView _selectRow:inComponent:animated:notify:]
16 XLForm                         0x10151cb7c -[XLFormPickerCell update] (XLFormPickerCell.m:86)
17 XLForm                         0x101533158 -[XLFormViewController configureCell:] (XLFormViewController.m:580)
18 XLForm                         0x1015330f4 -[XLFormViewController updateFormRow:] (XLFormViewController.m:572)
19 XLForm                         0x1015336c0 -[XLFormViewController tableView:cellForRowAtIndexPath:] (XLFormViewController.m:609)
20 UIKit                          0x18e954a30 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:]
21 UIKit                          0x18e954f94 -[UITableView _createPreparedCellForGlobalRow:willDisplay:]
22 UIKit                          0x18e7faeec -[_UITableViewUpdateSupport(Private) _setupAnimationsForNewlyInsertedCells]
23 UIKit                          0x18e7f6fac -[_UITableViewUpdateSupport _setupAnimations]
24 UIKit                          0x18e7f68b0 -[UITableView _updateWithItems:updateSupport:]
25 UIKit                          0x18e7de3b4 -[UITableView _endCellAnimationsWithContext:]
26 UIKit                          0x18e7da650 -[UITableView endUpdates]
27 DZNEmptyDataSet                0x10110c060 dzn_original_implementation (UIScrollView+EmptyDataSet.m:611)
28 XLForm                         0x101530e54 -[XLFormViewController formRowHasBeenAdded:atIndexPath:] (XLFormViewController.m:279)
29 XLForm                         0x101522df4 -[XLFormSectionDescriptor observeValueForKeyPath:ofObject:change:context:] (XLFormSectionDescriptor.m:251)
30 Foundation                     0x185966894 NSKeyValueNotifyObserver
31 Foundation                     0x1859663bc NSKeyValueDidChange
32 Foundation                     0x185a1e68c NSKeyValueDidChangeWithPerThreadPendingNotifications
33 Foundation                     0x185a1c0e0 NSKVOInsertObjectAtIndexAndNotify
34 XLForm                         0x101522a30 -[XLFormSectionDescriptor showFormRow:] (XLFormSectionDescriptor.m:231)
35 XLForm                         0x10151fb58 -[XLFormRowDescriptor evaluateIsHidden] (XLFormRowDescriptor.m:449)
36 XLForm                         0x10151fdb0 -[XLFormRowDescriptor setHidden:] (XLFormRowDescriptor.m:465)
37 XLForm                         0x101523480 -[XLFormSectionDescriptor insertObject:inAllRowsAtIndex:] (XLFormSectionDescriptor.m:316)
38 XLForm                         0x1015221e0 -[XLFormSectionDescriptor addFormRow:afterRow:] (XLFormSectionDescriptor.m:143)
39 XLForm                         0x101517794 -[XLFormInlineSelectorCell becomeFirstResponder] (XLFormInlineSelectorCell.m:56)
40 XLForm                         0x1015347a8 -[XLFormViewController tableView:didSelectRowAtIndexPath:] (XLFormViewController.m:746)
41 UIKit                          0x18e730b20 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:]
42 UIKit                          0x18e7d9760 -[UITableView _userSelectRowAtPendingSelectionIndexPath:]
43 UIKit                          0x18e887aa8 _runAfterCACommitDeferredBlocks
44 UIKit                          0x18e87ae5c _cleanUpAfterCAFlushAndRunDeferredBlocks
45 UIKit                          0x18e60c464 _afterCACommitHandler
46 CoreFoundation                 0x185006cdc __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__
47 CoreFoundation                 0x185004694 __CFRunLoopDoObservers
48 CoreFoundation                 0x185004c50 __CFRunLoopRun
49 CoreFoundation                 0x184f24c58 CFRunLoopRunSpecific
50 GraphicsServices               0x186dd0f84 GSEventRunModal
51 UIKit                          0x18e67d5c4 UIApplicationMain
52 EVgo                           0x10005ad94 main (main.m:25)
53 libdyld.dylib                  0x184a4456c start

@liraz I'm facing the same crash, were you able to fix this?

Yes, this is fixed, we had to also do some memory fixes:
driivz@05506d2

You can take our version instead, this project seems to be not maintained anymore.