Closed ghost closed 8 years ago
P. S. I compiled with some -Wno-errors and warning with sigreturn/other.
Warnings*
I fixed it by commenting lines with this code. But how to really fix it?
Hmm, I believe bad_alloc
happens when memory cannot be allocated. If you run cpp/merkletree/merkle_tree_test
manually, you get the same error? Repeatedly?
Maybe you would get more information if you ran it under Valgrind (which should have an apt-get
package for it on Ubuntu), simply like so: valgrind cpp/merkletree/merkle_tree_test
I'll give this a try with GCC today, see if I can reproduce it locally.
Valgrind — the same error, but very long tests and Valgrind message "no errors". P. S. GCC 4.8 (GCC 4.9 available), G++ 4.8 (no 4.9 in my distro packages).
Hmm, couldn't reproduce it...
$ ./config.status --config
'CXXFLAGS=-O2 -ggdb -Wall -Werror -Wno-sign-compare -Wno-return-type -Wno-comment' 'evhtp_CFLAGS=-I/usr/local/google/home/pphaneuf/src/libevhtp -I/usr/local/google/home/pphaneuf/src/libevhtp/evthr -I/usr/local/google/home/pphaneuf/src/libevhtp/htparse' 'evhtp_LIBS=-L/usr/local/google/home/pphaneuf/src/libevhtp -levhtp' 'INSTALL_DIR=./install'
$ g++ --version
g++ (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ make V=1 cpp/merkletree/merkle_tree_test
depbase=`echo cpp/merkletree/merkle_tree_test.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
g++ -DHAVE_CONFIG_H -I. -I./cpp -I/usr/src/gmock/include -I/usr/src/gmock/gtest/include -Ithird_party/objecthash -I/usr/local/google/home/pphaneuf/src/libevhtp -I/usr/local/google/home/pphaneuf/src/libevhtp/evthr -I/usr/local/google/home/pphaneuf/src/libevhtp/htparse -I/usr/include/x86_64-linux-gnu -I/usr/include/json-c -D_FORTIFY_SOURCE=2 -fno-exceptions -O2 -ggdb -Wall -Werror -Wno-sign-compare -Wno-return-type -Wno-comment -std=gnu++11 -fstack-protector-all -fPIC -Wa,--noexecstack -Wformat -Wformat-security -MT cpp/merkletree/merkle_tree_test.o -MD -MP -MF $depbase.Tpo -c -o cpp/merkletree/merkle_tree_test.o cpp/merkletree/merkle_tree_test.cc &&\
mv -f $depbase.Tpo $depbase.Po
sed -e "s/%BUILD_VERSION%/`git describe --abbrev=0 --dirty --always --tags`/" cpp/version.cc.in >cpp/version.cc.tmp && diff cpp/version.cc.tmp cpp/version.cc >/dev/null 2>&1 || mv -f cpp/version.cc.tmp cpp/version.cc
rm -f cpp/version.cc.tmp
g++ -fno-exceptions -O2 -ggdb -Wall -Werror -Wno-sign-compare -Wno-return-type -Wno-comment -std=gnu++11 -fstack-protector-all -fPIC -Wa,--noexecstack -Wformat -Wformat-security -pie -o cpp/merkletree/merkle_tree_test cpp/util/util.o cpp/merkletree/merkle_tree_test.o cpp/libcore.a cpp/libtest.a -L/usr/local/google/home/pphaneuf/src/libevhtp -levhtp -levent_openssl -levent_pthreads -levent -ltcmalloc -lssl -lcrypto -lglog -lgflags -llzma -ldl -lpthread -lresolv
$ cpp/merkletree/merkle_tree_test
[==========] Running 15 tests from 5 test cases.
[----------] Global test environment set-up.
[----------] 3 tests from MerkleTreeFuzzTest
[ RUN ] MerkleTreeFuzzTest.RootFuzz
[ OK ] MerkleTreeFuzzTest.RootFuzz (170 ms)
[ RUN ] MerkleTreeFuzzTest.PathFuzz
[ OK ] MerkleTreeFuzzTest.PathFuzz (165 ms)
[ RUN ] MerkleTreeFuzzTest.ConsistencyFuzz
[ OK ] MerkleTreeFuzzTest.ConsistencyFuzz (166 ms)
[----------] 3 tests from MerkleTreeFuzzTest (501 ms total)
[----------] 5 tests from CompactMerkleTreeTest
[ RUN ] CompactMerkleTreeTest.RootFuzz
[ OK ] CompactMerkleTreeTest.RootFuzz (1531 ms)
[ RUN ] CompactMerkleTreeTest.RootTestVectors
[ OK ] CompactMerkleTreeTest.RootTestVectors (0 ms)
[ RUN ] CompactMerkleTreeTest.TestCopyCtorWithRootTestVectors
[ OK ] CompactMerkleTreeTest.TestCopyCtorWithRootTestVectors (0 ms)
[ RUN ] CompactMerkleTreeTest.TestCopyCtorThenAddLeafWithRootTestVectors
[ OK ] CompactMerkleTreeTest.TestCopyCtorThenAddLeafWithRootTestVectors (0 ms)
[ RUN ] CompactMerkleTreeTest.TestCloneEmptyTreeProducesWorkingTree
[ OK ] CompactMerkleTreeTest.TestCloneEmptyTreeProducesWorkingTree (0 ms)
[----------] 5 tests from CompactMerkleTreeTest (1531 ms total)
[----------] 4 tests from MerkleTreeTest
[ RUN ] MerkleTreeTest.RootTestVectors
[ OK ] MerkleTreeTest.RootTestVectors (0 ms)
[ RUN ] MerkleTreeTest.PathTestVectors
[ OK ] MerkleTreeTest.PathTestVectors (0 ms)
[ RUN ] MerkleTreeTest.ConsistencyTestVectors
[ OK ] MerkleTreeTest.ConsistencyTestVectors (0 ms)
[ RUN ] MerkleTreeTest.AddLeafHash
[ OK ] MerkleTreeTest.AddLeafHash (0 ms)
[----------] 4 tests from MerkleTreeTest (0 ms total)
[----------] 1 test from CompactMerkleTreeFuzzTest
[ RUN ] CompactMerkleTreeFuzzTest.CopyCtorForLargerTreesThenAppend
[ OK ] CompactMerkleTreeFuzzTest.CopyCtorForLargerTreesThenAppend (2499 ms)
[----------] 1 test from CompactMerkleTreeFuzzTest (2499 ms total)
[----------] 2 tests from MerkleVerifierTest
[ RUN ] MerkleVerifierTest.VerifyPath
[ OK ] MerkleVerifierTest.VerifyPath (2224 ms)
[ RUN ] MerkleVerifierTest.VerifyConsistencyProof
[ OK ] MerkleVerifierTest.VerifyConsistencyProof (1843 ms)
[----------] 2 tests from MerkleVerifierTest (4067 ms total)
[----------] Global test environment tear-down
[==========] 15 tests from 5 test cases ran. (8598 ms total)
[ PASSED ] 15 tests.
I tried it with Valgrind, too, and it was slow, but it passed without errors.
I did find a number of warnings with GCC that we do not get with Clang, hence the -Wno-sign-compare -Wno-return-type -Wno-comment
I put in CXXFLAGS
, we'll be fixing that.
14.04.1, not 3
Waiting for reply… :( g++ (Ubuntu 4.8.4-2ubuntu1~14.04.1)
Are you running this on a system with a low amount of memory? Like a Raspberry Pi, or maybe a VPS (virtual private server)? Could you send the output of ulimit -a
? It should look like this:
$ ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 256630
max locked memory (kbytes, -l) unlimited
max memory size (kbytes, -m) unlimited
open files (-n) 32768
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 32768
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
myuser@mypc:~$ ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 14592
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 14592
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
myuser@mypc:~$
Does cpp/merkletree/merkle_tree_test --gtest_filter=CompactMerkleTreeTest.TestCloneEmptyTreeProducesWorkingTree
(running only the specific test) also cause the same crash? If so could you try the following command:
strace -o foobar cpp/merkletree/merkle_tree_test --gtest_filter=CompactMerkleTreeTest.TestCloneEmptyTreeProducesWorkingTree
And attach the "foobar" file here?
The same error, no additional info, only note (filter). No additional info.
ERROR: unknown command line flag 'o'
P. S. Sorry, incorrect command. Wait for strace log.
http://files.step-m.ru/files/20379/foobar.txt
echo $INSTALL_DIR /home/myuser/apache2/ct_post_latest
You can see this file?
Press this link again. Waiting for reply…
CPU not supports required features (cpufreq and other feature). Close.
I compiled CT successfully with GCC. I changed one file because it contain error (objecthash). make check-TESTS fails.