Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong error message #50

Closed
rbotafogo opened this issue Jan 18, 2019 · 2 comments
Closed

Wrong error message #50

rbotafogo opened this issue Jan 18, 2019 · 2 comments
Assignees
Labels

Comments

@rbotafogo
Copy link

The following code has a bug... in 'mutate', 'gain_per_hour' uses 'hour' in the formula instead of 'hours'. Using 'hours' gives the right result.

library('dplyr')
library('nycflights13')

flights_sml =
  flights %>%
    select(year: day,
           ends_with("delay"),
           distance,
           air_time)

print(flights_sml)

mu = flights_sml %>%
  mutate(gain = arr_delay - dep_delay,
              hours = air_time / 60,
              gain_per_hour = gain / hour)

print(mu)

and this is the stack trance:

RuntimeError:
java.lang.ArrayIndexOutOfBoundsException: -1 (RInternalError)
from com.oracle.truffle.r.nodes.function.FunctionDefinitionNode.execute(FunctionDefinitionNode.java:325)
from org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callProxy(OptimizedCallTarget.java:275)
from org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callRoot(OptimizedCallTarget.java:264)
from org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callBoundary(OptimizedCallTarget.java:251)
from org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.doInvoke(OptimizedCallTarget.java:233)
from org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callDirect(OptimizedCallTarget.java:216)
from org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.callProxy(OptimizedDirectCallNode.java:84)
from org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.call(OptimizedDirectCallNode.java:68)
from com.oracle.truffle.r.nodes.function.call.CallRFunctionNode.execute(CallRFunctionNode.java:59)
from com.oracle.truffle.r.nodes.function.RCallNode$DispatchedCallNode.execute(RCallNode.java:1169)
Caused by:
-1 (ArrayIndexOutOfBoundsException)
from java.util.ArrayList.elementData(ArrayList.java:422)
from java.util.ArrayList.remove(ArrayList.java:499)
from com.oracle.truffle.r.ffi.impl.common.JavaUpCallsRFFIImpl.Rf_unprotect(JavaUpCallsRFFIImpl.java:1572)
from com.oracle.truffle.r.ffi.impl.upcalls.Rf_unprotectCall$Rf_unprotectCallFactory$1.execute(Rf_unprotectCall.java:54)
from org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callProxy(OptimizedCallTarget.java:275)
from org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callRoot(OptimizedCallTarget.java:264)
from org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callBoundary(OptimizedCallTarget.java:251)
from org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.doInvoke(OptimizedCallTarget.java:233)
from org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callDirect(OptimizedCallTarget.java:216)
from org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.callProxy(OptimizedDirectCallNode.java:84)

@steve-s
Copy link
Member

steve-s commented Jan 18, 2019

Hi Rodrigo,

thank you for the report. We can reproduce the issue and are working on a fix.

@steve-s
Copy link
Member

steve-s commented Jan 25, 2019

Should be fixed in d8bb267

Edit: sorry to mislead here a bit, the other dplyr issue (#51) is fixed in that commit, but in this case we believe that the problem may be actually on the side of the Rcpp package used by dplyr. We've reported that issue RcppCore/Rcpp#935. In the meantime as a workaround you can patch Rcpp sources:

--- a/inst/include/Rcpp/protection/Shelter.h
+++ b/inst/include/Rcpp/protection/Shelter.h
@@ -26,7 +26,7 @@ namespace Rcpp {
         Shelter() : nprotected(0){}
 
         inline SEXP operator()(SEXP x){
-            nprotected++;
+           if ( x != R_NilValue ) nprotected++;
             return Rcpp_protect(x) ;
         }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants