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

Thread 1: EXC_BAD_ACCESS (code=2, address=0x16b7eff30) - in function Cell.update() #1447

Closed
arakweker opened this issue Mar 2, 2018 · 44 comments

Comments

@arakweker
Copy link

The combination Xcode 9.3 beta 3 and Eureka 4.1.0 is not working properly on my physical iPhone X device with iOS 11.3 beta 3. The simulator (for iPhone X) is working fine however.

I'm getting an error Thread 1: EXC_BAD_ACCESS (code=2, address=0x16b7eff30) when I click on a Pushrow. A Textrow or Daterow does work normally.

The branch with the latest beta was working fine, so I tried to go back. But that is not working any more:

[!] Error installing Eureka
[!] Failed to download 'Eureka'

@arakweker
Copy link
Author

Even a small pushrow like the one below is causing the error.

           <<< PushRow<String>() {
                $0.value = "Test"
                $0.title = "Test"
                $0.options = ["Test 1","Test 2"]
                $0.tag = "test"
            }

@Begoodi
Copy link

Begoodi commented Mar 5, 2018

I have exactly the same issue, works fine on iPhone X simulator but not on physical device.
(I'm on xCode 9.2)

@arakweker
Copy link
Author

Thanks for letting me know... so it isn't iOS firmware related.

@arakweker
Copy link
Author

With Xcode 9.3 beta 4 and iOS 11.3 beta 4 on my physical iPhone X the problem is the same. The simulator works fine. Running my app on my iPad with iOS 11.3 beta 4 also works fine.
So it is not related to Xcode 9.3, nor iOS 11.3. It is a specific iPhone X issue.

@mtnbarreto
Copy link
Member

Hey Guys! Can anyone take a look at this ? I can provide some help if needed.

@Begoodi
Copy link

Begoodi commented Mar 7, 2018

Yes please we are completely stuck with this problem :(

@sena1or
Copy link

sena1or commented Mar 7, 2018

@mtnbarreto
Stack overflowed and infinite recursion at setup(or init) method on changing some properties, like tintColor (Cell.tintColorDidChange() called in that case).

So, quick fix for users would be to move setup of such properties somewhere after update() event of lifecycle.

@arakweker
Copy link
Author

arakweker commented Mar 7, 2018

Thanks, but I don't know what you propse?!

Even this pushrow crashes:

<<< PushRow<String>() {
                $0.value = "Test"
                $0.title = "Test"
                $0.options = ["Test 1","Test 2"]
                $0.tag = "test"
            }

There is no update( ) event in there. Or are you asking me to add in one like so:

<<< PushRow<String>() {
                .cellUpdate { cell, row in
                         if !row.isValid {
                            cell.titleLabel?.textColor = .red } }
                $0.value = "Test"
                $0.title = "Test"
                $0.options = ["Test 1","Test 2"]
                $0.tag = "test"
            }

Please advise.

@sena1or
Copy link

sena1or commented Mar 7, 2018

@arakweker I am not sure about suggested PushRow, because my case was related with custom row, and I can have an influence on that behaviour.

So, yes, could you try to move your initialisation in cellUpdate callback parameter?

As well, you can just rollback a Eureka to 4.0.1. I think there wouldn't be such issue.

@arakweker
Copy link
Author

How do I roll back to 4.01?
I tried pod 'Eureka', '4.01' and still have 4.1.

Downloading dependencies

-> Using Charts (3.0.5)
-> Using Eureka (4.1.0)
-> Using SwiftDate (4.5.1)

  • Running pre install hooks

@sena1or
Copy link

sena1or commented Mar 7, 2018

@arakweker Have you missed a . in 4.01 ? Should be 4.0.1

@arakweker
Copy link
Author

Thanks... what a difference a . makes!

Putting cellUpdate 'on top' (see above) generates an error: Reference to member 'cellSetup' cannot be resolved without a contextual type

So, what do you mean with: So, quick fix for users would be to move setup of such properties somewhere after update() event of lifecycle.

@arakweker
Copy link
Author

arakweker commented Mar 7, 2018

What do I have to change here to get it working?

<<< PushRow() {
    $0.value = "Test"
    $0.title = "Test"
    $0.options = ["Test 1","Test 2"]
    $0.tag = "test"
}

@arakweker
Copy link
Author

Oh, and rolling back to 4.0.1 means also I get the compiler error back: Type 'Section' does not conform to protocol 'RangeReplaceableCollection'

So that doesn't make sense.

@sena1or
Copy link

sena1or commented Mar 7, 2018

@arakweker
It looks like you forgot to add the generic constraint <String>

@arakweker
Copy link
Author

Whatever I do I get a compiler error with 4.0.1 (see screendump). That error goes away when I update to 4.1.0.
Then everything works in the simulator. On my physical iPhone X it doesn't work, my iPhone freezes when I click on a pushrow (even pretty simple pushrows).

So what are you asking me? I really don't understand.

  • going back to 4.0.1? doesn't work, I get a compiler error
  • editing my pushrow in 4.1.0? how? It is basic already

Guess I better wait for a new version.

screen shot 2018-03-07 at 17 56 27

.

@sena1or
Copy link

sena1or commented Mar 7, 2018

@arakweker seems, we might have different kinds of issues

Could you try, please, on Eureka 4.0.1 the last resort like that:

let row = PushRow<String>().cellUpdate { (cell, row) in
row.value = "Test"
row.title = "Test"
row.options = ["Test 1","Test 2"]
row.tag = "test"
}

@arakweker
Copy link
Author

Nope doesn't compile with 4.0.1. I get the Swift Compiler error (see screendump above).

@arakweker
Copy link
Author

I've Xcode 9.3 beta 4, so I guess Eureka 4.1.0 is the minumum version to get rid of the compiler error.

@sena1or
Copy link

sena1or commented Mar 7, 2018

@arakweker I am sorry, there was a misspell in version number, could you run again that snippet, please, with Eureka 4.1.0? Thank you in advance

@arakweker
Copy link
Author

Ok... update to 4.1.0 again :-)

let row = PushRow().cellUpdate { (cell, row) in
row.value = "Test"
row.title = "Test"
row.options = ["Test 1","Test 2"]
row.tag = "test"
}

So in Xcode the following screen.
screen shot 2018-03-07 at 19 32 53

Result... this screen in my app (all rows are gone).
screen shot 2018-03-07 at 19 33 37

What it should look like is:
screen shot 2018-03-07 at 19 34 05

@sena1or
Copy link

sena1or commented Mar 7, 2018

@arakweker

Wait, but you didn't add row to the section and form :-) So, you can put <<< operator instead let row, Xcode tell you about that :)

@arakweker
Copy link
Author

ok... if I literally do what you ask me, the code is:

<<< = PushRow().cellUpdate { (cell, row) in
row.value = "Test"
row.title = "Test"
row.options = ["Test 1","Test 2"]
row.tag = "test"
}

That is giving errors: 'Expected expression after operator' and 'Cannot convert value of type '(_) -> ()' to expected argument type 'String?'

@sena1or
Copy link

sena1or commented Mar 7, 2018

@arakweker ok, let's fix this, could you try that(remove underscore), please,

<<< PushRow_<String>_().cellUpdate { (cell, row) in
row.value = "Test"
row.title = "Test"
row.options = ["Test 1","Test 2"]
row.tag = "test"
}

?

@arakweker
Copy link
Author

Ok, thanks for your patience.

That is compiling ok and running on the simulator ok.
When I run it on my physical iPhone X I get a freeze...
On my physical iPad it is running ok.

@arakweker
Copy link
Author

If I tether my physical iPhone X to my Mac, the error I get is: 'Thread 1: EXC_BAD_ACCESS (code=2, address=0x16b0b3f30)' and it occurs in Update( ) - see screen.

That is why I called this issue ' Thread 1: EXC_BAD_ACCESS (code=2, address=0x16b7eff30) - in function Cell.update() ' in the first place...

screen shot 2018-03-07 at 20 24 43

@arakweker
Copy link
Author

And now Begoodi can react again with his message:
'I have exactly the same issue, works fine on iPhone X simulator but not on physical device. (I'm on xCode 9.2)'

@sena1or
Copy link

sena1or commented Mar 7, 2018

@arakweker Happy to hear, that code was compiled and run 👍

Could you give me a a full stacktrace for that screen? I suggesting, that there is a long recursive call.

@arakweker
Copy link
Author

stacktrace.txt

@Begoodi
Copy link

Begoodi commented Mar 8, 2018

On my side, I tried with the simpliest pushrow I could make.
Everything is working except on physical iPhone X device.
I also get this kind of recursive trace.

@sena1or
Copy link

sena1or commented Mar 8, 2018

@mtnbarreto root of the call is at ListCheckRow.swift:48, setting the tint color.
Infinite update cycle happen after that.

@sena1or
Copy link

sena1or commented Mar 8, 2018

So, that is caused 7931948

@mats-claassen
Copy link
Member

It makes sense to me that if tintColorDidChange calls row.updateCell and the cell's update changes the tintColor then there could be an infinite loop.

But why would that happen only on iPhone X?

To try and see if that is really the error, could somebody try adding a private variable in Cell to store the previous tintColor and then in tintColorDidChange only call row.updateCell if the new tintColor is different from the previous one?

@mtnbarreto
Copy link
Member

Let's remove 7931948 for now.

Could anyone make a pull request with the fix? Thanks

@arakweker
Copy link
Author

I don't get it. I don't use tintColorDidChange in my form?
And then why does it work in the simulator? And not on a physical iPhone X?
More than willing to test... but I do need instructions... I'm a newbee with Xcode.

@AndrewBennet
Copy link
Contributor

AndrewBennet commented Mar 13, 2018

I'm seeing this error (I think) in reported crashes, but unable to reproduce myself (even on a physical iPhone X). I'm also not using tintColorDidChange at all. The crashes are all reported as occurring on iPhone 7 running iOS 11.2.6.

I have an enormous stack trace which repeats the following 10 lines over and over:

6094 Eureka        0x103062bf4 ListCheckCell.update() -> () (ListCheckRow.swift:48)
6095 Eureka        0x103070f08 Row.updateCell() -> () (Row.swift:163)
6096 Eureka        0x102ffba68 Cell.tintColorDidChange() -> () (Cell.swift:156)
6097 Eureka        0x102ffbaa0 @objc Cell.tintColorDidChange() -> () (Cell.swift)
6098 UIKit         0x18e4a400c -[_UITintColorVisitor _visitView:] + 376
6099 UIKit         0x18e4a47e4 _UIViewVisitorEntertainVisitors + 104
6100 UIKit         0x18e4a37e0 _UIViewVisitorRecursivelyEntertainDescendingVisitors + 188
6101 UIKit         0x18e4a3464 +[_UIViewVisitor _startTraversalOfVisitor:withView:] + 232
6102 UIKit         0x18e1d1428 -[UIView _dispatchTintColorVisitorWithReasons:] + 144
6103 UIKit         0x18df70bb8 -[UIView setTintColor:] + 120

@arakweker
Copy link
Author

I tried iOS 11.3 beta 5. Problem persists.

AndrewBennet added a commit to AndrewBennet/ReadingListV1 that referenced this issue Mar 13, 2018
@arakweker
Copy link
Author

Nope, workaround isn't working for me.

image

@Begoodi
Copy link

Begoodi commented Mar 15, 2018

Is there other similar tools available to replace Eureka ?
It seems they will not fix that :(

@AndrewBennet
Copy link
Contributor

@mtnbarreto I've made a pull request reverting 7931948 as you suggested

@mtnbarreto
Copy link
Member

mtnbarreto commented Mar 15, 2018

merged! We will release a new version containing the fix.

sena1or referenced this issue Mar 15, 2018
So the textColor can be updated if it uses the tintColor, which a lot of cells do. It appears that the tintColor is currently used before the cell is added to the window, so if the tintColor has been customised on the window the cells aren’t updated.

Calling row.updateCell() seems like the best thing to call, as that should encompass all code (built-in and custom) that uses the tintColor.
@arakweker
Copy link
Author

After 4.1.1 everything is working fine on my physical iPhone X. Thanks for the support!

@karlvr
Copy link
Contributor

karlvr commented Mar 30, 2018

I'm sorry about all the trouble my contribution caused!

I've seen the same crash now in my crash reports, although I haven't been able to personally reproduce it. I believe the issue is the ListCheckCell which updates the tintColor inside its update method. This of course creates the infinite loop and the stack overflow that we've seen.

CheckCell does the same thing.

I have updated and resubmitted my PR with some changes, described therein. Perhaps people who experienced this issue would be able to test the branch my PR is from in order to confirm that this issue does not resurface?

@guoziqin
Copy link

Thread 1: EXC_BAD_ACCESS (code=2, address=0x103eec110)

while (cur) {
for (uint j = 0; j < cur->rebindings_nel; j++) {
if (strcmp(&symbol_name[1], cur->rebindings[j].name) == 0) {
if (cur->rebindings[j].replaced != NULL &&
indirect_symbol_bindings[i] != cur->rebindings[j].replacement) {
*(cur->rebindings[j].replaced) = indirect_symbol_bindings[i];
}
indirect_symbol_bindings[i] = cur->rebindings[j].replacement;
goto symbol_loop;
}
}
cur = cur->next;
}
symbol_loop:;
}
}

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

No branches or pull requests

8 participants