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

key_field_test failures on s390x [FlatBuffers 22.11.23] #7671

Closed
musicinmybrain opened this issue Nov 25, 2022 · 9 comments
Closed

key_field_test failures on s390x [FlatBuffers 22.11.23] #7671

musicinmybrain opened this issue Nov 25, 2022 · 9 comments

Comments

@musicinmybrain
Copy link
Contributor

While updating the flatbuffers package in Fedora Linux (Rawhide, gcc 12.2.1) from 22.10.26 to 22.11.23, I found that the new key_field_test fails on the s390x architecture. This is the only big-endian primary architecture in Fedora Linux.

Test project /builddir/build/BUILD/flatbuffers-22.11.23/redhat-linux-build
    Start 1: flattests
1/1 Test #1: flattests ........................***Exception: SegFault  0.25 sec
EXPECTED: "3"
VALUE: "4"
TEST FAILED: /builddir/build/BUILD/flatbuffers-22.11.23/tests/key_field_test.cpp:59, 'sorted_bar_vec->Get(3)->b()' != '4' in 
EXPECTED: "1"
VALUE: "0"
TEST FAILED: /builddir/build/BUILD/flatbuffers-22.11.23/tests/key_field_test.cpp:60, 'nullptr' == 'sorted_bar_vec->LookupByKey( &flatbuffers::CastToArray(test_float_array1))' in 
0% tests passed, 1 tests failed out of 1
Total Test time (real) =   0.25 sec
The following tests FAILED:
	  1 - flattests (SEGFAULT)

While I don’t have interactive access to an s390x system, I am happy to test any patches or experiments via test builds of the RPM package.

@sunwen18
Copy link
Contributor

I'm curious if this is related to how big endian and little endian treat float differently. The part that's failing is using float array as key, and the previous part of using uint8 array as key didn't fail.

@sunwen18
Copy link
Contributor

Hi Ben, I'm wondering if there is a way that you could test my PR #7681 ?
I updated the unit test a bit and enforced EndianSwap before comparing in the KeyCompareWithValue function, I'm not totally sure about this, would be nice to know for sure. Thanks in advance!

@musicinmybrain
Copy link
Contributor Author

Hi Ben, I'm wondering if there is a way that you could test my PR #7681 ? I updated the unit test a bit and enforced EndianSwap before comparing in the KeyCompareWithValue function, I'm not totally sure about this, would be nice to know for sure. Thanks in advance!

Based on a scratch build of the Fedora RPM with the patch applied, that doesn‘t seem to have solved the problem.

Test project /builddir/build/BUILD/flatbuffers-22.11.23/redhat-linux-build
    Start 1: flattests
1/1 Test #1: flattests ........................***Exception: SegFault  0.18 sec
EXPECTED: "2"
VALUE: "4"
TEST FAILED: /builddir/build/BUILD/flatbuffers-22.11.23/tests/key_field_test.cpp:69, 'sorted_bar_vec->Get(3)->b()' != '4' in 
EXPECTED: "1"
VALUE: "0"
TEST FAILED: /builddir/build/BUILD/flatbuffers-22.11.23/tests/key_field_test.cpp:74, 'nullptr' == 'sorted_bar_vec->LookupByKey(key_float_array)' in 
0% tests passed, 1 tests failed out of 1
Total Test time (real) =   0.18 sec
The following tests FAILED:
	  1 - flattests (SEGFAULT)

@sunwen18
Copy link
Contributor

sunwen18 commented Dec 1, 2022

Hi Ben, I made one more update, mind give it another shot? Thanks!

@musicinmybrain
Copy link
Contributor Author

I find that the current version still fails:

Test project /builddir/build/BUILD/flatbuffers-22.11.23/redhat-linux-build
    Start 1: flattests
1/1 Test #1: flattests ........................***Exception: SegFault  0.66 sec
EXPECTED: "2"
VALUE: "4"
TEST FAILED: /builddir/build/BUILD/flatbuffers-22.11.23/tests/key_field_test.cpp:69, 'sorted_bar_vec->Get(3)->b()' != '4' in 
EXPECTED: "1"
VALUE: "0"
TEST FAILED: /builddir/build/BUILD/flatbuffers-22.11.23/tests/key_field_test.cpp:74, 'nullptr' == 'sorted_bar_vec->LookupByKey(key_float_array)' in 
0% tests passed, 1 tests failed out of 1
Total Test time (real) =   0.66 sec
The following tests FAILED:
	  1 - flattests (SEGFAULT)

@sunwen18
Copy link
Contributor

sunwen18 commented Dec 6, 2022

Hi Ben, I have merged #7681 to fix this, I have tested locally with building docker of multiarch/ubuntu-core:s390x-focal. Thing should work now for s390x if you wanna pull the latest master and give it a try.

@musicinmybrain
Copy link
Contributor Author

Hi Ben, I have merged #7681 to fix this, I have tested locally with building docker of multiarch/ubuntu-core:s390x-focal. Thing should work now for s390x if you wanna pull the latest master and give it a try.

I tested #7681 as a patch to 22.11.23 (https://github.com/google/flatbuffers/pull/7681.patch), and I found that the tests do pass on s390x with the patch applied. Thank you for investigating this.

@dbaileychess
Copy link
Collaborator

Thanks! This should be in the 22.12.06 release, mind trying that as well?

@musicinmybrain
Copy link
Contributor Author

Thanks! This should be in the 22.12.06 release, mind trying that as well?

Yes, the tests pass for the 22.12.06 release as well.

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