keittlab / rpg

An R package for reading from and writing to a PostgreSQL database
14 stars 1 forks source link

toggle_echo crash R session #9

Open artemklevtsov opened 4 years ago

artemklevtsov commented 4 years ago

When rpg::toggle_echo() called R session crashed every time.

> rpg::toggle_echo()

 *** caught segfault ***
address 0x7f77ef672c60, cause 'invalid permissions'

Traceback:
 1: rpg::toggle_echo()

Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace
Selection: 1
R is aborting now ...

Build log:

Installing package into '/home/xxx/R/x86_64-pc-linux-gnu-library/3.6'
(as 'lib' is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/rpg_1.6.tar.gz'
Content type 'application/x-gzip' length 44069 bytes (43 KB)
==================================================
downloaded 43 KB

* installing *source* package 'rpg' ...
** package 'rpg' successfully unpacked and MD5 sums checked
** using staged installation
Using pkg-config cflags and libs!
Using PKG_CFLAGS=
Using PKG_LIBS=-lpq
** libs
g++ -std=gnu++11 -I"/usr/include/R/" -DNDEBUG  -I"/home/xxx/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/include" -I"/home/xxx/R/x86_64-pc-linux-gnu-library/3.6/RApiSerialize/include" -D_FORTIFY_SOURCE=2  -fpic  -march=native -O3 -pipe -fstack-protector-strong -fno-plt  -c RcppExports.cpp -o RcppExports.o
g++ -std=gnu++11 -I"/usr/include/R/" -DNDEBUG  -I"/home/xxx/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/include" -I"/home/xxx/R/x86_64-pc-linux-gnu-library/3.6/RApiSerialize/include" -D_FORTIFY_SOURCE=2  -fpic  -march=native -O3 -pipe -fstack-protector-strong -fno-plt  -c rpg.cpp -o rpg.o
g++ -std=gnu++11 -shared -L/usr/lib64/R/lib -Wl,-O1,--sort-common,--as-needed,-z,relro -o rpg.so RcppExports.o rpg.o -lpq -L/usr/lib64/R/lib -lR
installing to /home/xxx/R/x86_64-pc-linux-gnu-library/3.6/00LOCK-rpg/00new/rpg/libs
** R
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (rpg)

The downloaded source packages are in
        '/tmp/RtmpnsGmRk/downloaded_packages'

Session info:

> sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Arch Linux

Matrix products: default
BLAS:   /usr/lib/libblas.so.3.8.0
LAPACK: /usr/lib/liblapack.so.3.8.0

locale:
[1] C

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

loaded via a namespace (and not attached):
[1] compiler_3.6.1 tools_3.6.1    parallel_3.6.1

libpq headers included in the postgresql-libs 11.5-3 package.

Process 22119 (R) of user 1000 dumped core.
Stack trace of thread 22119:
#0  0x00007f77ecf74607 n/a (/home/xxx/R/x86_64-pc-linux-gnu-library/3.6/rpg/libs/rpg.so)
thk686 commented 4 years ago

I can't reproduce it. I wonder if the global flag variable got optimized away? I made it static. See if that helps.

artemklevtsov commented 4 years ago

Now it works as expected. Thank you for the quick fix.