Closed NRBPerdijk closed 5 years ago
Hello Nathan,
I've tried on R11 community edition and could not reproduce. Can you share some R code snippet that causes the issue? I've tried:
pdf_render_page(paste0(R.home(), "/doc/NEWS.pdf"))
and that produces a raw vector with the data of the PDF file as expected.
Thank you for the reply.
That is interesting, I tried running your code snippet and it failed with the same stacktrace as I posted above. I figured there must be something corrupt about my installation, so I uninstalled fastR using gu
, made sure that any trace of R on my system was removed and then deleted and reinstalled my GraalVM installation (rc11).
Sadly, this did not work, I keep running into the same issue. The command line gives me the following versions: JVM:
openjdk version "1.8.0_192"
OpenJDK Runtime Environment (build 1.8.0_192-20181024123616.buildslave.jdk8u-src-tar--b12)
GraalVM 1.0.0-rc11 (build 25.192-b12-jvmci-0.53, mixed mode)
FastR:
Filename: https://github.com/oracle/fastr/releases/download/vm-1.0.0-rc11/r-installable-ce-1.0.0-rc11-macos-amd64.jar
Name : FastR
ID : R
Version : 1.0.0-rc11
GraalVM : 1.0.0-rc11
Component bundle R cannot be installed
- The same component FastR (R) is already installed in version 1.0.0-rc11
R: R version 3.5.1 (FastR)
I am a bit at a loss concerning what else I could try or might be missing...
Sorry I didn't notice this in your first comment:
R version when running the R command from the graalvm /bin: R version 3.4.3
this looks suspicious. FastR never had this version. RC10 should show R 3.4.0 and in RC11 we migrated to R 3.5.1. We'll try reproducing on MacOS. So far I've been trying on Ubuntu box.
Yes, I thought that was odd, too. I guess it was interference from a separate R installation. In my second attempt (after explicitly deleting all R on my machine), I did have R 3.5.1, but it was not the problem.
I just found the actual issue by accident:
If you add require("tidyr")
or require("dplyr")
at the start of the file, you'll replicate the above behavior. If I leave those packages out, it works!
Edit:
The above was written in a hurry, so a bit more now that I have some time:
Importing tidyr
or dplyr
in the same file will cause the ClassCastException, even if none of their functionality is actually used. The order of my imports was:
require("tidyr")
require("glue")
require("dplyr")
require("pdftools")
Commenting out both dplyr and tidyr makes the bug go away, leaving either or both of them in => boom, very misleading exception somewhere in a pdftools function. At least I can now try to work around it, rather than it being a total showstopper. 👍 Let me know if you require any further information and keep up the good work!
Yes, thank you that was the missing piece, I can now reproduce the issue and we are working on the fix. Thank you for the report and for the help with reproducing.
You're welcome, it is an interesting issue!
I have found a few others ways to reproduce, which might be valuable to check whether all the bases have been covered:
All the following will cause the ClassCastException presented above:
require("purrrr")
to the top of the file,require("tesseract")
=> this one is extra interesting. The image_ocr
function from the magick
package needed tesseract to be installed . Bringing "tesseract" in scope would break the run (with the CCE), but not bringing it in scope would still allow "magick" to use image_ocr
. Funky, but then again, I don't usually program in R...pdftools
function pdf_render_page()
BEFORE pdf_info()
works fine, but using pdf_info()
and THEN pdf_render_page()
causes CCE (even when using two different files and even when used in two different R files).require("X")
for any of the 4 "breaking packages" I've mentioned so far, to any other R file also ran by the same GraalVM project (even when used in two different calls from the native JVM language).I hope this is of further use to you. 👍
Should be fixed by 6336e09ea0ec3d26b114fb2d8ec1fdf8a349d56c
Hello again!
This issue closely resembles issue #46, but this time on graalVM & FastR rc11.
I am still trying to render a page from a pdf with
R
usingpdf_tools
and again the FastR code has turned my RAW vector into anRDoubleVector
which cannot be cast toRIntVector
(see stacktrace at the bottom), eventhough it only contains Integers. (The Array on the Scala side is of type Int.)Edit: The installed FastR:
R version when running the R command from the graalvm /bin:
R version 3.4.3
Stacktrace: