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

std::bad_alloc failure when running ./zerocash_pour_ppzksnark/tests/test_zerocash_pour_ppzksnark #1

Open
nathan-at-least opened this issue Sep 23, 2015 · 4 comments

Comments

@nathan-at-least
Copy link

I just did this procedure:

$ git clone 'https://github.com/zerocash/libzerocash
$ cd libzerocash
$ ./get-libsnark
$ make
$ ./zerocash_pour_ppzksnark/tests/test_zerocash_pour_ppzksnark

It fails and the last few lines are:

    (enter) Compute query densities             [0s]    (2411.1086s from start)
    (leave) Compute query densities             [0.0819s]       (2411.1905s from start)
    Choosing window size 20 for 12509677 elements
    Choosing window size 17 for 1262322 elements
    * G1 window: 20
    * G2 window: 17
    (enter) Generating G1 multiexp table        [0s]    (2412.0749s from start)
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc

I noticed that libsnark is linked dynamically, so this might just be an instance of libsnark #12. One thought is I could try changing the Makefile to use static linking and see if this symptom goes away.

My system details:

$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 8.0 (jessie)
Release:        8.0
Codename:       jessie

$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.9/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.9.1-19' --with-bugurl=file:///usr/share/doc/gcc-4.9/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.9 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.9 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.9-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.9-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.9-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --with-arch-32=i586 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.9.1 (Debian 4.9.1-19)

Edit: Before I said I ran make tests but this isn't a valid make target.

@madars
Copy link
Member

madars commented Sep 23, 2015

This sounds like out-of-memory issue as multi-exponentiation tables need quite a bit of RAM. I'll try to reproduce this, but it used to work for us at the time of release.

In the meantime, what happens if you build libsnark with LOWMEM=1 by modifying ./get-libsnark slightly? It should help reduce the memory consumption somewhat.

@madars
Copy link
Member

madars commented Sep 23, 2015

I can confirm that I'm unable to reproduce the bug both on Ubuntu wily and Debian jessie. Each of the machines has 16GB of RAM and no swap.

@nathan-at-least
Copy link
Author

Hm. I have 8Gb and no swap. I tried applying this patch:

diff --git a/get-libsnark b/get-libsnark
index 79816f9..4ff7a69 100755
--- a/get-libsnark
+++ b/get-libsnark
@@ -20,8 +20,8 @@ git pull
 # TODO: submit -fPIC patch to ate-pairing
 INC_DIR=-fPIC ./prepare-depends.sh
 make clean
-make $LIBSNARK_FLAGS
-make install PREFIX=$DEPINST $LIBSNARK_FLAGS
+make LOWMEM=1 $LIBSNARK_FLAGS
+make install LOWMEM=1 PREFIX=$DEPINST $LIBSNARK_FLAGS
 cd ..

 cd ..

-and then I did:

$ rm -rf depsrc depinst
$ ./get-libsnark
$ make
$ ./zerocash_pour_ppzksnark/tests/test_zerocash_pour_ppzksnark

I didn't measure the memory consumption to determine that was the cause, so I'll try that next.

@nathan-at-least
Copy link
Author

Ah... I didn't also run make LOWMEM=1 for libzerocash in addition to the patch above, so now I'm trying the equivalent of:

$ rm -rf depsrc depinst
$ ./get-libsnark
$ make LOWMEM=1
$ ./zerocash_pour_ppzksnark/tests/test_zerocash_pour_ppzksnark

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

2 participants