GithubHelp home page GithubHelp logo

Bad binding access about lobstr HOT 22 OPEN

r-lib avatar r-lib commented on July 18, 2024
Bad binding access

from lobstr.

Comments (22)

hadley avatar hadley commented on July 18, 2024 1

More minimal:

con <- sparklyr::spark_connect(master = "local")
lobstr::obj_size(con$state)

Error probably comes from https://github.com/wch/r-source/blob/79298c499218846d14500255efd622b5021c10ec/src/include/Rinlinedfuns.h#L89

from lobstr.

hadley avatar hadley commented on July 18, 2024 1

Looks like this is an "immediate binding": https://github.com/wch/r-source/blob/79298c499218846d14500255efd622b5021c10ec/doc/notes/immbnd.md#L25

from lobstr.

hadley avatar hadley commented on July 18, 2024 1

@eliotmcintire can you please file a new issue?

from lobstr.

mjsteinbaugh avatar mjsteinbaugh commented on July 18, 2024

I can also reproduce this error with the legacy pryr::object_size(), whereas utils::object.size() works as expected.

from lobstr.

hadley avatar hadley commented on July 18, 2024

Can you provide a reprex?

from lobstr.

PinkAppleFlower avatar PinkAppleFlower commented on July 18, 2024

I receive this error when attempting to calculate the size of tibble that is a link to Spark data table. Error shows up in both pryr and lobstr with slightly different semantics.

pryr: "<simpleError in object_sizes(list(...), env): bad binding access>"

lobstr: "<simpleError in obj_size_(dots, env, size_node(), size_vector()): bad binding access>"

The pryr information is not meant to be distracting/off topic, but rather hopefully add additional information that is helpful.

Also, I used the tidyft package to calculate object size and that worked.

LMK if you need a reprex or more info.

Thanks.

from lobstr.

hadley avatar hadley commented on July 18, 2024

A reprex would be very useful because I'll need to figure out what's going wrong in the C code.

from lobstr.

PinkAppleFlower avatar PinkAppleFlower commented on July 18, 2024

object size reprex zipped.zip

Above is the link to the notebook and the RMD file.

👍

Just let me know if you need anything else.

from lobstr.

hadley avatar hadley commented on July 18, 2024

Could you please made a small reprex and include it inline?

from lobstr.

PinkAppleFlower avatar PinkAppleFlower commented on July 18, 2024

Sure, here is just the code for the lobstr package. I hope this is minimal enough.

#Convert the time series data to a tibble
EU_stock_tibl <- ts_tbl(EuStockMarkets)

#Spark Connection
spark_connection <- spark_connect(master = "local")

#Copy data to Spark
EU_stock_spark_link <- copy_to(spark_connection, EU_stock_tibl, "EU_stock_spark", overwrite = TRUE)

#Size
tryCatch({
lobstr::obj_size(EU_stock_spark_link)
},
error = print
)

from lobstr.

PinkAppleFlower avatar PinkAppleFlower commented on July 18, 2024

Just following up on this to see where things are at and if my code sample worked out as needed. I see it still has the reprex label. Datacamp uses the pypr package, but not the lobstr package in their course. I mentioned this issue to them so I am just following up as the ticket is still in my inbox.

from lobstr.

hadley avatar hadley commented on July 18, 2024

Could you please rework your reproducible example to use the reprex package ? That makes it easier to see both the input and the output, formatted in such a way that I can easily re-run in a local session.

from lobstr.

PinkAppleFlower avatar PinkAppleFlower commented on July 18, 2024

Yep, below is the example created with the reprex package. Thanks for letting me know this is what you were looking for.

library(pryr)
#> Registered S3 method overwritten by 'pryr':
#>   method      from
#>   print.bytes Rcpp
library(lobstr)
#> 
#> Attaching package: 'lobstr'
#> The following objects are masked from 'package:pryr':
#> 
#>     ast, mem_used
library(tidyft)
#> 
#> Life's short, use R.
#> 
#> Attaching package: 'tidyft'
#> The following object is masked from 'package:pryr':
#> 
#>     object_size
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:tidyft':
#> 
#>     add_count, anti_join, arrange, count, cummean, distinct, filter,
#>     full_join, group_by, groups, inner_join, lag, lead, left_join,
#>     mutate, nth, pull, relocate, rename, right_join, select,
#>     select_vars, semi_join, slice, slice_head, slice_max, slice_min,
#>     slice_sample, slice_tail, summarise, transmute, ungroup
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
library(tsbox)
library(sparklyr)
#> 
#> Attaching package: 'sparklyr'
#> The following objects are masked from 'package:tidyft':
#> 
#>     distinct, fill, full_join, inner_join, left_join, nest, right_join,
#>     separate, unite, unnest
library(datasets)


EU_stock_tibl <- ts_tbl(EuStockMarkets)


spark_connection <- spark_connect(master = "local")

EU_stock_spark_link <- copy_to(spark_connection, EU_stock_tibl, "EU_stock_spark", overwrite = TRUE)


tryCatch({
  tidyft::object_size(EU_stock_spark_link)
  },
  error = print
)
#> 10.1 Kb

tryCatch({
  pryr::object_size(EU_stock_spark_link)
},
error = print
)
#> <simpleError in object_sizes(list(...), env): bad binding access>

tryCatch({
  lobstr::obj_size(EU_stock_spark_link)
},
error = print
)
#> <simpleError in obj_size_(dots, env, size_node(), size_vector()): bad binding access>

Created on 2021-01-07 by the reprex package (v0.3.0)

from lobstr.

hadley avatar hadley commented on July 18, 2024

Could you please try to make your reprex a little more minimal by only showing the problem with lobstr, and removing anything that isn't directly related? (e.g. the tryCatch() calls).

from lobstr.

PinkAppleFlower avatar PinkAppleFlower commented on July 18, 2024

from lobstr.

PinkAppleFlower avatar PinkAppleFlower commented on July 18, 2024

Okay, the new reprex is posted below. Thank you.

library(lobstr)
library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
library(tsbox)
library(sparklyr)
library(datasets)


EU_stock_tibl <- ts_tbl(EuStockMarkets)

spark_connection <- spark_connect(master = "local")

EU_stock_spark_link <- copy_to(spark_connection, EU_stock_tibl, "EU_stock_spark", overwrite = TRUE)

lobstr::obj_size(EU_stock_spark_link)
#> Error in obj_size_(dots, env, size_node(), size_vector()): bad binding access

Created on 2021-01-07 by the reprex package (v0.3.0)

from lobstr.

hadley avatar hadley commented on July 18, 2024

More minimal reprex:

con <- sparklyr::spark_connect(master = "local")
spark_mtcars <- dplyr::copy_to(con, mtcars, "mtcars", overwrite = TRUE)
lobstr::obj_size(spark_mtcars)
#> Error in obj_size_(dots, env, size_node(), size_vector()): bad binding access

Created on 2022-06-21 by the reprex package (v2.0.1)

from lobstr.

hadley avatar hadley commented on July 18, 2024

I have a fix that works locally, but making it work properly will be quite a lot of extra effort so unfortunately probably won't make it for this release.

from lobstr.

mjsteinbaugh avatar mjsteinbaugh commented on July 18, 2024

Cool thanks @hadley !

from lobstr.

eliotmcintire avatar eliotmcintire commented on July 18, 2024

Are there updates on this?

I am seeing the same error (bad binding access) now with my reproducible package on CRAN with devel versions of R.

I can manually reproduce this with R-devel on my local machines.

The minimal reprex using R-devel is:

lobstr::obj_size(as.environment("package:lobstr"))

This worked with all previous versions of R.

from lobstr.

juliasilge avatar juliasilge commented on July 18, 2024

I'm seeing this same problem in butcher on R-devel, because of the use of lobstr here. It's not for all models, just for nnet, FWIW.

from lobstr.

juliasilge avatar juliasilge commented on July 18, 2024

I just used rig to install R-devel and I cannot reproduce the problem locally. 😔

from lobstr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.