-
Notifications
You must be signed in to change notification settings - Fork 15.4k
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
ArenaTest.BlockSizeSmallerThanAllocation fails on 32 bit alpine linux #8459
Comments
This change makes the test pass, which still tests if the allocation is bigger than space used: diff --git a/src/google/protobuf/arena_unittest.cc b/src/google/protobuf/arena_unittest.cc
index 7e90164..cf633e3 100644
--- a/src/google/protobuf/arena_unittest.cc
+++ b/src/google/protobuf/arena_unittest.cc
@@ -1256,12 +1256,10 @@ TEST(ArenaTest, BlockSizeSmallerThanAllocation) {
Arena arena(opt);
*Arena::Create<int64>(&arena) = 42;
- EXPECT_GE(arena.SpaceAllocated(), 8);
- EXPECT_EQ(8, arena.SpaceUsed());
+ EXPECT_GE(arena.SpaceAllocated(), arena.SpaceUsed());
*Arena::Create<int64>(&arena) = 42;
- EXPECT_GE(arena.SpaceAllocated(), 16);
- EXPECT_EQ(16, arena.SpaceUsed());
+ EXPECT_GE(arena.SpaceAllocated(), arena.SpaceUsed());
}
}
|
I found the problem: protobuf/src/google/protobuf/arena.cc Line 424 in a001250
The problem is that the I think the test is broken in this case because it checks against a fixed size, regardless of platform. |
seems like we should be able to use |
This seems to make this specific test pass on both 64bit and 32bit: diff --git a/src/google/protobuf/arena_unittest.cc b/src/google/protobuf/arena_unittest.cc
index 7e9016429..178ad13fd 100644
--- a/src/google/protobuf/arena_unittest.cc
+++ b/src/google/protobuf/arena_unittest.cc
@@ -1257,11 +1257,11 @@ TEST(ArenaTest, BlockSizeSmallerThanAllocation) {
*Arena::Create<int64>(&arena) = 42;
EXPECT_GE(arena.SpaceAllocated(), 8);
- EXPECT_EQ(8, arena.SpaceUsed());
+ EXPECT_EQ(16 - sizeof(void*), arena.SpaceUsed());
*Arena::Create<int64>(&arena) = 42;
EXPECT_GE(arena.SpaceAllocated(), 16);
- EXPECT_EQ(16, arena.SpaceUsed());
+ EXPECT_EQ(24 - sizeof(void*), arena.SpaceUsed());
}
}
but, I'm not really familiar with the code and I have no idea how the In the |
The align8 thingy was introduced in 885b612, but there are no explanation in commit message why it needs to be aligned that way. The sizeof(AllocPolicy) thingy - which likely broke it - seems to be introduced in commit 5c028d6, without any good explanation in commit message. I'm giving up. I'll let people who know this code deal with it. |
that is fair, thanks for taking a look. |
I also have this test failing along ArenaTest.SpaceAllocated_and_Used on i686-linux (32 bits as well). |
We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please add a comment. This issue is labeled |
We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please reopen it. This issue was closed and archived because there has been no new activity in the 14 days since the |
What version of protobuf and what language are you using?
Version: protobuf-3.15.7
Language: C++
What operating system (Linux, Windows, ...) and version?
Alpine linux edge (rolling release)
What runtime / compiler are you using (e.g., python version or gcc version)
gcc (Alpine 10.2.1_git20210328) 10.2.1 20210328
Python 3.9.4
What did you do?
Steps to reproduce the behavior:
CXXFLAGS="$CXXFLAGS -fno-delete-null-pointer-checks -Wno-error" ./configure --prefix=/usr ...
make -j24
cd src
make -j24 protobuf-test && ./protobuf-test --gtest_filter=ArenaTest.BlockSizeSmallerThanAllocation
What did you expect to see
test passed
What did you see instead?
Anything else we should know about your project / environment
This happens on both 32 bit x86 and armv7.
musl libc is used.
Probably same underlying issue as #8367
The text was updated successfully, but these errors were encountered: