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

WeakReferences tests fail on Android ARMv7 and x86 #107

Closed
triplef opened this issue May 21, 2019 · 12 comments
Closed

WeakReferences tests fail on Android ARMv7 and x86 #107

triplef opened this issue May 21, 2019 · 12 comments

Comments

@triplef
Copy link
Member

triplef commented May 21, 2019

Running the WeakReferences* tests on Android ARMv7 fail with the following messages. The same tests succeed on ARM64.

RUNNING WeakReferences_arc...
Insert failed [repeated 2179 times]
../Test/WeakReferences_arc.m:34: int main(int, const char **): assertion "refs[i] == nil" failed
Aborted 
FAILED: WeakReferences_arc

RUNNING WeakReferences_arc_legacy...
Insert failed [repeated 2179 times]
../Test/WeakReferences_arc.m:34: int main(int, const char **): assertion "refs[i] == nil" failed
Aborted 
FAILED: WeakReferences_arc_legacy

RUNNING WeakReferences_arc_legacy_optimised...
Insert failed [repeated 2179 times]
../Test/WeakReferences_arc.m:34: int main(int, const char **): assertion "refs[i] == nil" failed
Aborted 
FAILED: WeakReferences_arc_legacy_optimised

RUNNING WeakReferences_arc_optimised...
Insert failed [repeated 2179 times]
../Test/WeakReferences_arc.m:34: int main(int, const char **): assertion "refs[i] == nil" failed
Aborted 
FAILED: WeakReferences_arc_optimised

From the "Insert failed" message it looks like an issue with the hash table implementation. I’d appreciate any pointers to track this down further.

This is with libobjc2 compiled using the GNUstep Android toolchain, i.e. using the latest master version of libobjc2 built with clang from the Android NDK.

@davidchisnall
Copy link
Member

The insert failed message can happen if you have too many hash collisions, such that increasing the size of the hash table does not remove collisions. We may need to change the hash function.

@davidchisnall
Copy link
Member

I believe this is fixed by 8809f01

@triplef
Copy link
Member Author

triplef commented Jul 31, 2019

I re-run the tests with the latest changes including 8809f01, but they still fail the same way. I believe you mean that it should be fixed with #119?

@davidchisnall
Copy link
Member

8809f01 contains a back-port of the fix from #119. Does it work with #119?

@davidchisnall davidchisnall reopened this Aug 1, 2019
@triplef
Copy link
Member Author

triplef commented Aug 5, 2019

The WeakReferences_arc tests succeed with #119 on both armeabi-v7a and arm64-v8a.

@davidchisnall
Copy link
Member

But not with the back-port of the fix to the master branch? Interesting, that implies another bug in the hash table implementation...

@triplef
Copy link
Member Author

triplef commented Aug 5, 2019

Nope, I double checked and the WeakReferences_arc tests still fail with the latest master branch (containing 8809f01) on armeabi-v7a.

If I understand it correctly though, 8809f01 fixed a memory corruption, whereas the WeakReferences_arc tests failed due to the hash table implementation, which was improved in #119. So I think it’s all how it should be (i.e. this issue will be resolved by #119)?

@davidchisnall
Copy link
Member

Ah, it's failing due to hash collisions. We can probably fix it in the master branch by improving the hash function...

@jordo
Copy link
Contributor

jordo commented Aug 19, 2019

we experienced some weak ref issues with latest commit, and posted #123. Was potentially unrelated to hash table impl

@triplef triplef changed the title WeakReferences tests fail on ARMv7 WeakReferences tests fail on Android ARMv7 and x86 Nov 8, 2019
@triplef
Copy link
Member Author

triplef commented Nov 8, 2019

I did some more testing and found that the test also fails on Android x86, but not on x86_64.

@davidchisnall
Copy link
Member

Makes sense - we probably experience a lot more hash collisions on 32-bit. Is this fixed for you in the #119 branch?

@triplef
Copy link
Member Author

triplef commented Nov 8, 2019

Just tried with the arc-cxx branch... the WeakReferences_arc tests pass, but these don’t on both x86 and x86_64:

RUNNING WeakRefLoad...
../Test/WeakRefLoad.m:15: int main(int, const char **): assertion "w1 == nil" failed
Aborted 
FAILED: WeakRefLoad

RUNNING WeakRefLoad_optimised...
../Test/WeakRefLoad.m:15: int main(int, const char **): assertion "w1 == nil" failed
Aborted 
FAILED: WeakRefLoad_optimised

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

No branches or pull requests

3 participants