R-ArcGIS / r-bridge

Bridge library to connect ArcGIS and R, including arcgisbinding R library.
Apache License 2.0
118 stars 26 forks source link

arc.open() causes R to fatally abort #77

Open jt-tbc opened 1 year ago

jt-tbc commented 1 year ago

Describe the bug arc.open() and other arcgisbinding functions crash R. I'm not sure if there has been an update somewhere? Any help would be greatly appreciated.

To Reproduce Steps to reproduce the behavior:

  1. Open R studio
  2. Load packages (arcgisbinding and terra)
  3. Check product
  4. run arc.open function and R crashes

Screenshots image

arcgisbinding info (please complete the following information):

library(arcgisbinding) *** Please call arc.check_product() to define a desktop license.

arc.check_product() product: ArcGIS Pro (13.1.0.41833) license: Advanced version: 1.0.1.300

arc.check_portal() *** Current url : https://www.arcgis.com/ version : 2023.1 user : TBC_GIS1 organization : The Biodiversity Consultancy

JosiahParry commented 1 year ago

Is there more detail that you can provide? Is there a specific data source that you are accessing? Can you please provide a reproducible example that we can test as well?

jt-tbc commented 1 year ago

Essentially, trying to load any raster or shapefile from a .gdb is failing and causing R to abort when using arc.open().

Earlier this morning it was all working on my computer, but after a restart it stopped. I'm not sure if any updates for windows, R, ArcGIS Pro or arcgisbinding have been made

mmachir commented 1 year ago

@jt-tbc Are you loading all packages and then running arc.check_product()? e.g.:

# load all packages
library(terra)
library(arcgisbinding)

# then check product
arc.check_product()

arc.open <- 'data-source-here'

If you're doing this and still seeing the crash, can you let me know which other packages you're loading in addition to arcgisbinding and terra so I can do some further testing? Thank you!

jt-tbc commented 1 year ago

Yes, and arc.check_product() gives the output of:

arc.check_product() product: ArcGIS Pro (13.1.0.41833) license: Advanced version: 1.0.1.300

no other packages loaded when the crashes occur

mmachir commented 1 year ago

At this point I'm unable to reproduce the crash with the following code:

library(terra)
#> terra 1.7.3
library(arcgisbinding)
#> *** Please call arc.check_product() to define a desktop license.
arc.check_product()
#> product: ArcGIS Pro (13.1.0.41833)
#> license: Advanced
#> version: 1.0.1.300
arc.open('C:/Data/Census/States/census.gdb/us_states')
#> dataset_type    : FeatureClass
#> path            : C:/Data/Census/States/census.gdb/us_states 
#> fields          : OBJECTID, Shape, STATE_ABBR, STATE_FIPS, STATE_NAME, 
#> fields          : POPULATION, POP_SQMI, SQMI, Shape_Length, Shape_Area
#> extent          : xmin=-179.1489, ymin=18.91069, xmax=-66.94961, ymax=71.36516
#> geometry type   : Polygon
#> WKT             : GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984"...
#> WKID            : 4326

I also tested with a raster and remote feature service, which were both successful. Does this produce a consistent crash for you (replacing the feature class with a locally available one)? Are there any other details about your code or other configuration(s) that might help us reproduce this?

Testing setup: RStudio 2023.03.0+386 "Cherry Blossom" Release (3c53477afb13ab959aeb5b34df1f10c237b256c3, 2023-03-09) for Windows Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) RStudio/2023.03.0+386 Chrome/108.0.5359.179 Electron/22.0.3 Safari/537.36 R: 4.2.3 OS: Windows 10 Enterprise arcgisbinding version 1.0.1.300

mmachir commented 1 year ago

@jt-tbc A new arcgisbinding build has been released (v305). To upgrade to the new version, in ArcGIS Pro go to Project > Options > Geoprocessing > R-ArcGIS Support and select "Check package for updates" from the "Installed 'arcgisbinding' package version" drop-down (after closing R Studio and ensuring that other R sessions are not active): image

This new version should address the issue with arc.open(). Please let us know if you continue to encounter the crash when using arcgisbinding v305. Thank you!

JosiahParry commented 1 year ago

@jt-tbc can you please confirm if you were able to update to the new version of arcgisbinding?

You can do the above as Martha suggested or run the following directly from R

install.packages("arcgisbinding", repos="https://r.esri.com", type="win.binary")
minaungmyatko commented 1 year ago

Joining this conversation since I am having the exact same issue. Here are a few important specs for my ArcGIS and R platform:

arc.check_product() product: ArcGIS Pro (13.0.2.36056) license: Advanced version: 1.0.1.244

image

My desktop at work have the same version of arcgisbinding but has a different version of ArcGIS Pro:

product: ArcGIS Pro (12.9.5.32739) license: Advanced version: 1.0.1.244

It works perfectly fine on my work desktop but when I tried using the arcgisbinding package on my personal desktop, it terminates whenever I tried to read ESRI layers and they are all saved on local storage space.

The other difference I notice is that my work desktop is Windows 10 Enterprise and my personal desktop is Windows 10 Pro. I really hope you all can suggest something that would fix.

JosiahParry commented 1 year ago

Can you please ensure that you are using the most recent version of arcgisbinding?

On Sat, Apr 29, 2023 at 4:23 PM minaungmyatko @.***> wrote:

Joining this conversation since I am having the exact same issue. Here are a few important specs for my ArcGIS and R platform:

arc.check_product() product: ArcGIS Pro (13.0.2.36056) license: Advanced version: 1.0.1.244

[image: image] https://user-images.githubusercontent.com/67610189/235322415-0519a6d4-99ee-4511-854e-1e0556e217ec.png

My desktop at work have the same version of arcgisbinding but has a different version of ArcGIS Pro:

product: ArcGIS Pro (12.9.5.32739) license: Advanced version: 1.0.1.244

It works perfectly fine on my work desktop but when I tried using the arcgisbinding package on my personal desktop, it terminates whenever I tried to read ESRI layers and they are all saved on local storage space.

The other difference I notice is that my work desktop is Windows 10 Enterprise and my personal desktop is Windows 10 Pro. I really hope you all can suggest something that would fix.

— Reply to this email directly, view it on GitHub https://github.com/R-ArcGIS/r-bridge/issues/77#issuecomment-1528865368, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADHIKLB5XENB3HDGNICX77TXDV2CTANCNFSM6AAAAAAXBMXCPY . You are receiving this because you commented.Message ID: @.***>

minaungmyatko commented 1 year ago

I tried that but as you can see in the screenshot, it only said 1.0.1.244 is the latest version of arcgisbinding, so I am puzzled. Do I need to update my ArcGIS Pro version?

On Sat, Apr 29, 2023 at 4:33 PM Josiah Parry @.***> wrote:

Can you please ensure that you are using the most recent version of arcgisbinding?

On Sat, Apr 29, 2023 at 4:23 PM minaungmyatko @.***> wrote:

Joining this conversation since I am having the exact same issue. Here are a few important specs for my ArcGIS and R platform:

arc.check_product() product: ArcGIS Pro (13.0.2.36056) license: Advanced version: 1.0.1.244

[image: image] < https://user-images.githubusercontent.com/67610189/235322415-0519a6d4-99ee-4511-854e-1e0556e217ec.png

My desktop at work have the same version of arcgisbinding but has a different version of ArcGIS Pro:

product: ArcGIS Pro (12.9.5.32739) license: Advanced version: 1.0.1.244

It works perfectly fine on my work desktop but when I tried using the arcgisbinding package on my personal desktop, it terminates whenever I tried to read ESRI layers and they are all saved on local storage space.

The other difference I notice is that my work desktop is Windows 10 Enterprise and my personal desktop is Windows 10 Pro. I really hope you all can suggest something that would fix.

— Reply to this email directly, view it on GitHub <https://github.com/R-ArcGIS/r-bridge/issues/77#issuecomment-1528865368 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/ADHIKLB5XENB3HDGNICX77TXDV2CTANCNFSM6AAAAAAXBMXCPY

. You are receiving this because you commented.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/R-ArcGIS/r-bridge/issues/77#issuecomment-1528866815, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQD2MTKZE73GFR3MCLIRGBLXDV3JFANCNFSM6AAAAAAXBMXCPY . You are receiving this because you commented.Message ID: @.***>

jt-tbc commented 1 year ago

I tried running the code above

install.packages("arcgisbinding", repos="https://r.esri.com", type="win.binary")

However, I get an error: image

When I remove the "type" argument I get the error: image

jt-tbc commented 1 year ago

Similarly, when installing via ArcPro image

dpavlushko commented 1 year ago

It looks like a network problem SSL connect error. Try downloading the package as a zip file from here https://r.esri.com/bin/ and installing it manually.

dpavlushko commented 1 year ago

@minaungmyatko arcgisbinding 1.0.1.244 is fully binary compatible with R 3.5-4.0 only. Each R 4.* requires an exclusive binary package. Unfortunately, the UI installer on Pro v 2.9 and some early 3.0.x is not capable of installing the proper arcgisbinding build for the latest R, so skip the UI installer and use manual installation only.

The current arcgisbinding build number is 305 for R 3.5 up to 4.2. Use install.packages() command to install correct build of the package:

install.packages("arcgisbinding", repos="https://r.esri.com", type="win.binary")
minaungmyatko commented 1 year ago

@dpavlushko Thank you very much! It finally works after manually installing the arcgisbinding version that is compatible with the current R version on my computer.

lisamr commented 1 year ago

Hi there, I'm having issues with arcgisbinding version 305. I'm working with a Survey123 feature layer, which has a point layer and multiple tables. The tables can be opened no problem, but R will abort when opening the point layer. I'm revisiting old code that worked 7 months ago, but no longer.

arc.check_product() product: ArcGIS Pro (12.9.1.32739) license: Advanced version: 1.0.1.305

This is the code that I'm running:

# download parent dataset
transectPath <- <my path to my Survey123 feature layer>
transectParent <- arc.open(paste0(transectPath))

# get IDs of various tables
FtID <- transectParent@children$FeatureClass
tabID <- transectParent@children$Table

# loads tables fine
tabDataset <- lapply(1:length(tabID), function(x){
  arc.open(paste0(transectPath, '/', tabID[x]))
})

# crashes when I try loading the point layer
ftDataset <- arc.open(paste0(transectPath, '/', FtID))

Here's my R version

R.version _
platform x86_64-w64-mingw32
arch x86_64
os mingw32
crt ucrt
system x86_64, mingw32
status
major 4
minor 2.2
year 2022
month 10
day 31
svn rev 83211
language R
version.string R version 4.2.2 (2022-10-31 ucrt) nickname Innocent and Trusting

JosiahParry commented 1 year ago

Is FtID larger than a length 1 vector? Do you have a reproducible example that you can share?

lisamr commented 1 year ago

It's a single element. see below. I don't currently have a reproducible example but can make one.

FtID [1] "L0transect_levelFuels_060822"

lisamr commented 1 year ago

I haven't had others outside my organization try to access Survey123 forms before, so I'm not sure if that URL will work. But below is a simple example with a table that works and a featurelayer that crashes.

library(arcgisbinding)
library(glue)

# define desktop licence
arc.check_product()

# feature layer URL
transectURL <- 'https://services.arcgis.com/v01gqwM5QqNysAAi/arcgis/rest/services/service_e2d8729fe7934cc7baab33e2c9fe0613/FeatureServer'

# open parent
p <- arc.open(transectURL)

# get names of the the sublayers/subtables
tab1 <- p@children$Table[1]
ftclass <- p@children$FeatureClass

# try to open them
arc.open(glue("{transectURL}/{tab1}")) # works with tables
arc.open(glue("{transectURL}/{ftclass}")) # crashes with featureClass

EDIT: I reverted to arcgisbinding version 300 and the above code now works. So, I'll stick with that until the next version works with R v4.3.

scdub commented 1 year ago

@lisamr Would you be able to share the feature service or a truncated copy that we can look at? It looks to be shared within your organization but not publicly, and I'm unable to reproduce this without the feature service. Thanks!

lisamr commented 1 year ago

@scdub unfortunately I don't have that ability. I work for the federal government and my agency is pretty tight with sharing.

So are you saying that you can't reproduce this error with a survey123 form that you've made? I can see if I can share the template I used to make my form.

scdub commented 1 year ago

@lisamr The template would be great. Ideally, we'd want to match the structure of your data and include the same column types, because potentially there is a specific column type which is introducing the crash.

lisamr commented 1 year ago

sample_canopy.xlsx Above is the excel template I made to make my Survey123 form that produced the crash. It's a copy of one of the forms that our field crews use, so it does have extra bells and whistles. Sorry about that.

Use this form: it's one of the simplest form you can make and automatically generated from a Survey123 template. I just confirmed it also causes a crash on version 305, but not on version 300. Form 1.xlsx

scdub commented 1 year ago

@lisamr OK great, thanks. Could you confirm the Pro version you're using? If this is with Pro 2.x, we have a known issue we're looking into which prevents all reading from working correctly that we were investigating yesterday.

lisamr commented 1 year ago

arc.check_product() product: ArcGIS Pro (12.9.1.32739) license: Advanced version: 1.0.1.300

scdub commented 1 year ago

@lisamr OK thanks for the report. Please continue using v300 until we understand the issue with v305 on Pro 2.x and create a new release, this issue isn't data specific but a broader problem between that version of Pro and the bridge.

scdub commented 1 year ago

@lisamr v305 has been released, and it should address the issue you described. Thanks!