fastr icon indicating copy to clipboard operation
fastr copied to clipboard

Cannot install package rkdb

Open komsit37 opened this issue 6 years ago • 3 comments

I got below error when trying to install https://github.com/KxSystems/rkdb in FastR. My FastR version is 3.5.1.

The package is mainly an R wrapper of a c code connecting to kdb database. I understand that you are still working on more package compatibility. This package is not so popular but I just want to raise an issue here anyway so that you are aware of it.

> devtools::install_github('kxsystems/rkdb', quiet=FALSE,INSTALL_opts=c("--no-multiarch"))
Downloading GitHub repo kxsystems/rkdb@master
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x0000000138d0c0a8, pid=70685, tid=0x0000000000000307
#
# JRE version: OpenJDK Runtime Environment (8.0_222-b08) (build 1.8.0_222-20190711112007.graal.jdk8u-src-tar-gz-b08)
# Java VM: OpenJDK 64-Bit GraalVM CE 19.2.0.1 (25.222-b08-jvmci-19.2-b02 mixed mode bsd-amd64 compressed oops)
# Problematic frame:
# C  [libR.dylib+0xc0a8]  R_WeakRefKey+0x18
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /private/var/folders/k1/vb1sbtbs339gmglv7q5bgl8h0000gp/T/RtmppbiP9J/hs_err_pid70685.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
#
fish: '$GRAALVM_HOME/bin/R' terminated by signal SIGABRT (Abort)

Here is a some information extracted from error report file

Stack: [0x00007ffeea049000,0x00007ffeea849000],  sp=0x00007ffeea845a20,  free space=8178k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [libR.dylib+0xc0a8]  R_WeakRefKey+0x18
C  [processx.so+0x5a3f]  processx__sigchld_callback+0x9f
C  [libsystem_platform.dylib+0x4b5d]  _sigtramp+0x1d
C  [libobjc.A.dylib+0x17382]  _ZL27_fetchInitializingClassListb+0x12
C  [CoreFoundation+0x3b99e]  __CFRunLoopServiceMachPort+0x148
C  [CoreFoundation+0x3af0c]  __CFRunLoopRun+0x64c
C  [CoreFoundation+0x3a66e]  CFRunLoopRunSpecific+0x1c7
C  [java+0x643e]  CreateExecutionEnvironment+0x367
C  [java+0x200c]  JLI_Launch+0x7a0
C  [java+0x84a2]  main+0x6c
C  [java+0x1864]  start+0x34

---------------  S Y S T E M  ---------------

OS:Bsduname:Darwin 18.7.0 Darwin Kernel Version 18.7.0: Sat Oct 12 00:02:19 PDT 2019; root:xnu-4903.278.12~1/RELEASE_X86_64 x86_64
rlimit: STACK 8192k, CORE 0k, NPROC 2837, NOFILE 10240, AS infinity
load average:2.12 1.75 1.91

CPU:total 12 (initial active 12) (6 cores per cpu, 2 threads per core) family 6 model 158 stepping 10, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, avx, avx2, aes, clmul, erms, 3dnowpref, lzcnt, ht, tsc, tscinvbit, bmi1, bmi2, adx

Memory: 4k page, physical 33554432k(2447428k free)

/proc/meminfo:


vm_info: OpenJDK 64-Bit GraalVM CE 19.2.0.1 (25.222-b08-jvmci-19.2-b02) for bsd-amd64 JRE (8u222), built on Jul 19 2019 10:37:18 by "graal" with gcc 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.37)

Let me know if you need more info.

komsit37 avatar Nov 21 '19 01:11 komsit37

Hello,

thank you for a detailed report. It seems that the issue may be in devtools rather than in rkdb. Here is how I managed to get rkdb installed without devtools on GraalVM 19.2.0:

  • install dependency bit64: install.packages("bit64")
  • install dependency nanotime:
    • the issue here is that FastR uses CRAN snapshot by default to provide some stability, but nanotime was published on CRAN after the snapshot we use was taken, so you need to explicitly request current CRAN when installing
    • install.packages("nanotime", repos="https://cran.r-project.org")
  • download the rkdb package from GitHub and install it: R CMD INSTALL /path/to/rkdb

Using devtools is of course the preferred way and we'll look into the error you reported anyway. devtools is unfortunately very complex package with huge amount of (transitive) dependencies, so getting that to work is rather challenging.

P.S.: the same installation procedure works also on 19.3.0

steve-s avatar Nov 21 '19 07:11 steve-s

@steve-s Thank you for the detailed workaround. I managed to get rkdb installed!

The package works in most cases, but I ran into an issue where FastR crashes when return datatype is nanotime.

> library(rkdb)
> h = open_connection('localhost',5555)
> execute(h, '2019.01.01')
[1] "2019-01-01"
> execute(h, '2019.01.01D00:00')
unimplemented Rf_asS4

Since this is not really an installation issue, let me know if I should raise this as a separate issue.

komsit37 avatar Nov 21 '19 08:11 komsit37

Since this is not really an installation issue, let me know if I should raise this as a separate issue.

yes, it would be great if you could create another issue. Thank you for testing this on FastR.

steve-s avatar Nov 21 '19 13:11 steve-s