[Rcpp-devel] problems while upgrading to Rcpp 0.11.2

Pratibha Rana prana at Vertica.com
Thu Sep 4 14:13:15 CEST 2014


Hi Kevin,

For me the -O2 flag did the trick. I verified it multiple times. Just remove the -O2 and the code segfaults while initializing RInside, add the -O2 flag and everybody is happy. It is weird.

I cannot reproduce it independently of RInside because the segfault occurs when RInside is being initialized as told by the backtrace of the core. Also I can't reproduce if I don't use a DataFrame. rinside_sample0 works just fine, but if I add a dataframe then the same segfault pops back.

Thanks
Pratibha

On 09/03/2014 03:50 PM, Kevin Ushey wrote:
(sorry -- finger slipped and submitted early)

> sessionInfo()
R version 3.0.2 (2013-09-25)
Platform: x86_64-pc-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] RInside_0.2.11 Rcpp_0.11.2

Can you provide an example of a segfault occurring independently of RInside?

Kevin

On Wed, Sep 3, 2014 at 12:49 PM, Kevin Ushey <kevinushey at gmail.com<mailto:kevinushey at gmail.com>> wrote:
Hi Pratibha,

I highly doubt that the segfault is related to the optimization level. FWIW, I still cannot replicate the segfault as you described -- Ubuntu 14.04, gcc 4.8.2, and...

Kevin


On Wed, Sep 3, 2014 at 12:34 PM, Pratibha Rana <prana at vertica.com<mailto:prana at vertica.com>> wrote:
I think I got to the bottom of the issue. I was using the -O0 option
instead of the -O2 option while compiling the code. Including the -O2
option resolved the issue.

Thanks
Pratibha

On 09/02/2014 04:49 PM, Dirk Eddelbuettel wrote:
> Hi,
>
> On 2 September 2014 at 20:16, Pratibha Rana wrote:
> | Hi Dirk,
> |
> | Yes I work for Vertica which is apparent from my email. But I do not
> | work on the distributedR project. I work on the vertica-R integration.
>
> You could tell us about that too ...
>
> | I acknowledge that it is a local issue because the same code works fine
> | in the RInside's example directory on the same machine with the same
> | libraries that I installed from sources. I verified the dll's being
> | loaded in both the cases. The back trace doesn't help either. I am out
> | of ideas as to what can be wrong. I am stumped as to why Rcpp::List
> | works fine but Rcpp::DataFrame causes a segfault. Any suggestion on
> | debugging the cause are greatly appreciated.
>
> So you may be doing something different in the build process for your local
> directory.  You need to work out what is different.
>
> Can you please post this __on the list__ for a continued thread there?
>
> Dirk
>
> |
> | Thanks
> | Pratibha
> | > Dear Pratibha,
> | >
> | > On 2 September 2014 at 19:22, Pratibha Rana wrote:
> | > | I have a custom application that uses Rcpp and Rinside to execute R code. All
> | >
> | > [ Random thought: I might make people a bit more sympathetic for your cause
> | > and questions if you pointed out that a) you are selling a db solution, b)
> | > that these days Vertica is part of HP and c) the code for the R integration
> | > is apparently on GitHub: https://github.com/vertica/DistributedR (or at least
> | > that is where I think it may be).  Why you guys never announced that here
> | > is a bit of a mystery to me. ]
> | >
> | > | was well until I was using R-3.0.0, Rcpp 0.10.2 and RInside 0.2.10 but now its
> | > | time to upgrade to the latest version and I can't get even the Rinside samples
> | > | to work in place of my application. My machine has Ubuntu14.04.  The code
> | >
> | > Well, consider that
> | >
> | >   a) I (and others) develop on Ubuntu 14.04. Things work on Ubuntu 14.04
> | >
> | >   b) CRAN tests all packages on several backends, including Ubuntu, Debian,
> | >      FC, OS X and Windows and would tell me (as maintainer) in no uncertain
> | >      terms if it didn't work.
> | >
> | >   c) So if it fails to work for you, maybe assume a local issue first?
> | >
> | > | compiles fine but when I run it, I get a segfault during Rinside
> | > | initialization.  I tried to troubleshoot by replacing my code by one of the
> | > | examples rinside_sample0. The example runs fine as is but if I add just a
> | > | single line "Rcpp::DataFrame p; " it segfaults again. Here is the complete
> | > | code. The same code works fine inside the Rinside examples directory.
> | > |
> | > |
> | > | #include <RInside.h>
> | > |
> | > | int main(int argc, char *argv[])
> | > | {
> | > |
> | > |  std::getchar();
> | >
> | > That line makes little sense. I omitted it.
> | >
> | > |
> | > |  RInside R(argc, argv);
> | > |
> | > |  R["txt"] = "Hello, world!\n";
> | > |  Rcpp::DataFrame pf;             <-------- Runs fine if I comment out this line.
> | > |  R.parseEvalQ("cat(txt)");
> | > |
> | > |  exit(0);
> | > | }
> | >
> | > Works fine here:
> | >
> | > edd at max:~/git/rinside/inst/examples/standard$ cat rinside_vertica.cpp
> | >
> | > #include <RInside.h>
> | >
> | > int main(int argc, char *argv[])
> | > {
> | >
> | >   RInside R(argc, argv);
> | >
> | >   R["txt"] = "Hello, world!\n";
> | >   Rcpp::DataFrame pf;    //         <-------- Runs fine if I comment out this line.
> | >   R.parseEvalQ("cat(txt)");
> | >
> | >   exit(0);
> | > }
> | > edd at max:~/git/rinside/inst/examples/standard$ make rinside_vertica
> | > ccache g++-4.8 -I/usr/share/R/include -I/usr/local/lib/R/site-library/Rcpp/include -I/usr/local/lib/R/site-library/RInside/include -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -O3 -Wall -pipe -Wno-unused -pedantic -Wall    rinside_vertica.cpp  -Wl,--export-dynamic -fopenmp  -L/usr/lib/R/lib -lR -lpcre -llzma -lbz2 -lz -lrt -ldl -lm  -lblas -llapack  -L/usr/local/lib/R/site-library/RInside/lib -lRInside -Wl,-rpath,/usr/local/lib/R/site-library/RInside/lib -o rinside_vertica
> | > edd at max:~/git/rinside/inst/examples/standard$ ./rinside_vertica
> | > Hello, world!
> | > edd at max:~/git/rinside/inst/examples/standard$
> | >
> | >
> | > I maybe running github versions of Rcpp and/or RInside, but the only thing
> | > that may matter is that you probably should
> | >
> | >  a) install Rcpp from source
> | >  b) install RInside from source
> | >
> | > and then build these examples.
> | >
> | > A reproducible issue may help.  This was not reproducible.  Or rather, this
> | > may not even have been a bug.
> | >
> | > Regards,  Dirk
> | >
> | >
> | > | Here is the backtrace of the segfault
> | > |
> | > |
> | > | Program received signal SIGSEGV, Segmentation fault.
> | > | 0x00007ffff7597767 in reset_current_error() () from /home/prana/trunk/third-party/install/lib/R/library/RInside/lib/libRInside.so
> | > | (gdb) bt -10
> | > | #261636 0x00007ffff7597769 in reset_current_error() () from /home/prana/trunk/third-party/install/lib/R/library/RInside/lib/libRInside.so
> | > | #261637 0x00007ffff7597769 in reset_current_error() () from /home/prana/trunk/third-party/install/lib/R/library/RInside/lib/libRInside.so
> | > | #261638 0x00007ffff7597769 in reset_current_error() () from /home/prana/trunk/third-party/install/lib/R/library/RInside/lib/libRInside.so
> | > | #261639 0x00007ffff7597769 in reset_current_error() () from /home/prana/trunk/third-party/install/lib/R/library/RInside/lib/libRInside.so
> | > | #261640 0x00007ffff7598530 in Rcpp::Rcpp_eval(SEXPREC*, SEXPREC*) () from /home/prana/trunk/third-party/install/lib/R/library/RInside/lib/libRInside.so
> | > | #261641 0x00007ffff7599542 in Rcpp::Language_Impl<Rcpp::PreserveStorage>::eval() const () from /home/prana/trunk/third-party/install/lib/R/library/RInside/lib/libRInside.so
> | > | #261642 0x00007ffff75969c7 in RInside::autoloads() () from /home/prana/trunk/third-party/install/lib/R/library/RInside/lib/libRInside.so
> | > | #261643 0x00007ffff7595fd3 in RInside::initialize(int, char const* const*, bool, bool, bool) () from /home/prana/trunk/third-party/install/lib/R/library/RInside/lib/libRInside.so
> | > | #261644 0x00007ffff7595a4a in RInside::RInside(int, char const* const*, bool, bool, bool) () from /home/prana/trunk/third-party/install/lib/R/library/RInside/lib/libRInside.so
> | > | #261645 0x000000000040361e in main (argc=1, argv=0x7fffffffdc88) at rinside_sample0.cpp:14
> | > | (gdb)
> | > |
> | > |
> | > |
> | > |
> | > | I also looked at the libraries that were being loaded at runtime and they are
> | > | exactly the same for both the rinside examples and my app. Pasted below for
> | > | completeness. I am out ofdebugging tricks to get this to work. Any ideas as to
> | > | what's wrong. what am I missing?
> | > |
> | > |
> | > | prana:trunk/third-party/install/lib/R/library/RInside/examples/standard $ cat /proc/21915/maps | awk '{print $6}' | grep '\.so' | sort | uniq
> | > | /home/prana/trunk/third-party/install/lib/R/lib/libRblas.so
> | > | /home/prana/trunk/third-party/install/lib/R/lib/libRlapack.so
> | > | /home/prana/trunk/third-party/install/lib/R/lib/libR.so
> | > | /home/prana/trunk/third-party/install/lib/R/library/graphics/libs/graphics.so
> | > | /home/prana/trunk/third-party/install/lib/R/library/grDevices/libs/grDevices.so
> | > | /home/prana/trunk/third-party/install/lib/R/library/methods/libs/methods.so
> | > | /home/prana/trunk/third-party/install/lib/R/library/Rcpp/libs/Rcpp.so
> | > | /home/prana/trunk/third-party/install/lib/R/library/RInside/lib/libRInside.so
> | > | /home/prana/trunk/third-party/install/lib/R/library/stats/libs/stats.so
> | > | /home/prana/trunk/third-party/install/lib/R/library/utils/libs/utils.so
> | > | /lib/x86_64-linux-gnu/ld-2.19.so<http://ld-2.19.so>
> | > | /lib/x86_64-linux-gnu/libc-2.19.so<http://libc-2.19.so>
> | > | /lib/x86_64-linux-gnu/libdl-2.19.so<http://libdl-2.19.so>
> | > | /lib/x86_64-linux-gnu/libgcc_s.so.1
> | > | /lib/x86_64-linux-gnu/libm-2.19.so<http://libm-2.19.so>
> | > | /lib/x86_64-linux-gnu/libnsl-2.19.so<http://libnsl-2.19.so>
> | > | /lib/x86_64-linux-gnu/libnss_compat-2.19.so<http://libnss_compat-2.19.so>
> | > | /lib/x86_64-linux-gnu/libnss_files-2.19.so<http://libnss_files-2.19.so>
> | > | /lib/x86_64-linux-gnu/libnss_nis-2.19.so<http://libnss_nis-2.19.so>
> | > | /lib/x86_64-linux-gnu/libpthread-2.19.so<http://libpthread-2.19.so>
> | > | /lib/x86_64-linux-gnu/librt-2.19.so<http://librt-2.19.so>
> | > | /usr/lib/x86_64-linux-gnu/libgfortran.so.3.0.0
> | > | /usr/lib/x86_64-linux-gnu/libgomp.so.1.0.0
> | > | /usr/lib/x86_64-linux-gnu/libquadmath.so.0.0.0
> | > | /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19
> | > |
> | > |
> | > | prana:trunk/myapp $ cat /proc/21730/maps | awk '{print $6}' | grep '\.so' | sort | uniq
> | > | /home/prana/trunk/third-party/install/lib/R/lib/libRblas.so
> | > | /home/prana/trunk/third-party/install/lib/R/lib/libRlapack.so
> | > | /home/prana/trunk/third-party/install/lib/R/lib/libR.so
> | > | /home/prana/trunk/third-party/install/lib/R/library/graphics/libs/graphics.so
> | > | /home/prana/trunk/third-party/install/lib/R/library/grDevices/libs/grDevices.so
> | > | /home/prana/trunk/third-party/install/lib/R/library/methods/libs/methods.so
> | > | /home/prana/trunk/third-party/install/lib/R/library/Rcpp/libs/Rcpp.so
> | > | /home/prana/trunk/third-party/install/lib/R/library/RInside/lib/libRInside.so
> | > | /home/prana/trunk/third-party/install/lib/R/library/stats/libs/stats.so
> | > | /home/prana/trunk/third-party/install/lib/R/library/utils/libs/utils.so
> | > | /lib/x86_64-linux-gnu/ld-2.19.so<http://ld-2.19.so>
> | > | /lib/x86_64-linux-gnu/libc-2.19.so<http://libc-2.19.so>
> | > | /lib/x86_64-linux-gnu/libdl-2.19.so<http://libdl-2.19.so>
> | > | /lib/x86_64-linux-gnu/libgcc_s.so.1
> | > | /lib/x86_64-linux-gnu/libm-2.19.so<http://libm-2.19.so>
> | > | /lib/x86_64-linux-gnu/libnsl-2.19.so<http://libnsl-2.19.so>
> | > | /lib/x86_64-linux-gnu/libnss_compat-2.19.so<http://libnss_compat-2.19.so>
> | > | /lib/x86_64-linux-gnu/libnss_files-2.19.so<http://libnss_files-2.19.so>
> | > | /lib/x86_64-linux-gnu/libnss_nis-2.19.so<http://libnss_nis-2.19.so>
> | > | /lib/x86_64-linux-gnu/libpthread-2.19.so<http://libpthread-2.19.so>
> | > | /lib/x86_64-linux-gnu/librt-2.19.so<http://librt-2.19.so>
> | > | /usr/lib/x86_64-linux-gnu/libgfortran.so.3.0.0
> | > | /usr/lib/x86_64-linux-gnu/libgomp.so.1.0.0
> | > | /usr/lib/x86_64-linux-gnu/libquadmath.so.0.0.0
> | > | /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19
> | > |
> | > |
> | > |
> | > |
> | > | Thanks
> | > | Pratibha
> | > | _______________________________________________
> | > | Rcpp-devel mailing list
> | > | Rcpp-devel at lists.r-forge.r-project.org<mailto:Rcpp-devel at lists.r-forge.r-project.org>
> | > | https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
> | >
> |
>

_______________________________________________
Rcpp-devel mailing list
Rcpp-devel at lists.r-forge.r-project.org<mailto:Rcpp-devel at lists.r-forge.r-project.org>
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20140904/55834428/attachment-0001.html>


More information about the Rcpp-devel mailing list