std::bad_alloc Loading SDK Sample Libraries
My problem is very similar to these two unanswered questions, but with a different Vertica version:
https://forum.vertica.com/discussion/235890/rollback-3399-vsql-create-library-failure-in-udx-error
I installed Vertica 9.0.1 on Ubuntu using vertica_9.0.1-0_amd64.deb and installed the following:
sudo apt-get install libboost-dev libboost-doc
sudo apt-get install libbz2-dev
sudo apt-get install libcurl4-openssl-dev
sudo apt-get install zlib1g-dev
Next I:
1. copied /opt/vertica/sdk/examples to a subfolder of my home folder
2. ran make
3. Ran vsql -f on a few of the sql scripts
All of them produced:
[Code: 3399, SQL State: VP001] [Vertica]VJDBC ROLLBACK: Failure in UDx RPC call InvokeGetLibraryManifest(): Exception calling getLibraryManifest() in User Defined Object [], message: std::bad_alloc
Vertica is running fine; I have some schema and data loaded.
Comments
For what it's worth, there may be some additional hints on what's happening (e.g. out of memory in PermGen space) in the UDxFencedProcessesJava.log which resides under your database catalog/UDxLogs dir.
Can you post the results of trying to compile just one of the Java example?
Example:
make JavaFunctions
See below for rerun results.
I initially built using make. It gave warnings about skipping different components due to missing headers; the build appeared successful otherwise. I did not try loading it at this point; instead I installed headers using the apt-get commands above, rebuilt incrementially after each one, and then got a clean build from make. I have tried using make clean and then make again, and loading again, and still get bad_alloc.
Log file is attached; interestingly there is only one failure directly related to the library file (I made multiple attempts on Jan 2).
Rerun results from today:
$ make clean
rm -rf /home/jpotts/code/vertica-9-examples/build/tmp
rm -f /home/jpotts/code/vertica-9-examples/build/.so
rm -f /home/jpotts/code/vertica-9-examples/build/.jar
rm -rf /home/jpotts/code/vertica-9-examples/build/Java*
rmdir /home/jpotts/code/vertica-9-examples/build >/dev/null 2>&1 || true
$ make
(see attached; some folders obfuscated. appears successful)
$ g++ --version
g++ (Ubuntu 5.4.0-6ubuntu1~16.04.5) 5.4.0 20160609
Copyright (C) 2015 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.
$ java -version
java version "1.8.0_151"
Java(TM) SE Runtime Environment (build 1.8.0_151-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)
$ javac -version
javac 1.8.0_151
$ free -m
Mem: 15914 1629 10592 629 3693 13281
Swap: 16251 0 16251
Error I get using vsql (error in first post is using DBVisualizer):
vsql:AggregateFunctions.sql:12: ROLLBACK 3399: Failure in UDx RPC call InvokeGetLibraryManifest(): Exception calling getLibraryManifest() in User Defined Object [], message: std::bad_alloc
And a portion of the vertica.log file from the immediately above vsql run, attached.
Hi!
What is version of Ubuntu?
Can you post full output of:
???
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.3 LTS
Release: 16.04
Codename: xenial
$ ldd /opt/vertica/bin/vertica-udx-C++
tldr: java fixed now; c++ sample still not working
$ vsql -U dbadmin -f JavaFunctions.sql
vsql:JavaFunctions.sql:14: ROLLBACK 5702: Couldn't create new UDx side process: Java Binary not found: /usr/bin/java/bin/java
$ sudo -u dbadmin printenv | grep JAVA_HOME
JAVA_HOME=/usr/bin/java
The JAVA_HOME variable above is incorrect; it points at an executable rather than a folder. It wasn't obvious because it was only affecting the dbadmin user rather than my user account.
How I found where JAVA_HOME was set
grep -r JAVA_HOME /etc/* 2>&1 | grep -v "Permission denied"
grep -r JAVA_HOME ~/.*
JAVA_HOME was being set correctly here:
But I had set it incorrectly here:
The profile.d flavor was loading into my personal login, but the /etc/environment flavor was being used for the dbadmin user.
Fixed it by setting JAVA_HOME in /home/dbadmin/.bashrc
Still getting std::bad_alloc for C++ example
Hi!
Ubuntu 16.04.3 LTS is unsupported platform, try 14.04 LTS.
ps: I got same error on 16.04(just checked).
That's disappointing.
Hi Josh,
Hope you are doing well.
I got same error... on CentOS 7.3.... on gcc 7.3.1... and I can load properly with gcc 7.2.1... and it completely unexplainable.
Statement that Ubuntu version is desupported is not relevant here, just a way to send you out.
Try to compile on different box, may be luck will be with you.
Great to hear from you, hope all is well. We should grab a beer soon.
I may try compiling on Ubuntu 14 with the default packages and see if I can get the binary to run on Ubuntu 16.
Reach out to me through LinkedIn.
you need to compile with
to disable new ABI of std::string
unless vertica is compiled with modern gcc
tested on ubuntu 16 and debian 9 with vertica binaries compiled on gcc4X
and now with vertica 9 you need to patch sdk (see attachment)