I noticed we have a lot more Replicas now with Field Maps. Initial testing shows that if I am online and remove a offline area the replica is removed. But if I remove the offline area while the tablet is offline it does not remove the replica. Even when I get back online and refresh the app, map, etc. Testing with iPad Pro using AGOL hosted service.
Is there a trick to this? Is this a known issue?
We have to move some content to a new owner and the admin is saying all replicas must be removed first. I have 800 in just one service. I think so many due to the above. Is this true? Is there a API way to remove them all?
thanks
I'm not sure if this is expected behavior or not.
There is a REST API and Python wrapper to remove them:
It looks like if you use "*" for the replicaID it will remove all the replicas.
Well that star would sure help! Thanks. Not sure why this would be expected behavior to have orphan replicas.
Doug,
What platform are you using Field Maps on? Also, check the troubleshooting logs within the app. We have logs for when an unregister attempt happens and whether or not its successful.
Regards,
Colin
iPad Pro 2020 using a AGOL hosted service - latest Field Maps and at 14.6 iOS.
The log is saying [UNREGISTER] failed to load task for (then url of service).
Seems like it is not checking if you are offline at the time?
thanks
Thank you! We have been investigating this but the behavior is far from consistent in our efforts to reproduce it. Your feedback is helpful.
Regards,
Colin
Any update yet? Over the last year now it has been causing us issues. We have 450+ replicas in just one service. I created a script for a report and we have many replicas that are months old. Other teams here have been seeing this also.
It got the point one of our services starting having issues. We could not export at all for one. Also random offline errors. I created another script to unregister anything not touched before June 1. As soon as I did our export starting working again.
The group with the most issues use iOS but other groups have a mix.
For anyone that needs it here - it is the very simple and not buffed out code.
Get a list
import arcpy
from arcgis.gis import GIS
import arcgis
from arcgis.features import FeatureLayerCollection
gis = GIS('pro')
itemID = "417ebcae"
item = gis.content.get(itemID)
flc = FeatureLayerCollection.fromitem(item)
replicas = flc.replicas.get_list()
print ("ReplicaOwner,ReplicaName,ReplicaID,CreateDate,LastSyncDate")
for r in replicas:
replica = flc.replicas.get(r['replicaID'])
create_date = datetime.datetime.fromtimestamp(replica['creationDate'] / 1000)
last_sync_date = 'n/a' # don't trust this to always be populated
if type(replica['lastSyncDate']) is int:
last_sync_date = datetime.datetime.fromtimestamp(replica['lastSyncDate'] / 1000)
print(replica['replicaOwner'] + "," + replica['replicaName'] + "," + replica['replicaID'] + "," + str(create_date) + "," + str(last_sync_date))
Remove - cool trick to use the token from Pro is way easier. Input is just a text list of replicaIDs.
import requests, arcpy
# read in the list of replcias to remove from file
replicaFile = r"C:\ReplicaList.txt"
replicaRead = open(replicaFile,"r")
replicaList = replicaRead.read().splitlines()
replicaRead.close()
# base URL to the HFS
serviceURL = 'https://services1.arcgis.com/Hp6G80QvQ/arcgis/rest/services/My_Service/FeatureServer/unRegisterReplica?replicaID='
token = arcpy.GetSigninToken()
for replica in replicaList:
urlResponse = requests.post(serviceURL + "{" + replica + "}&token=" + token['token'])
Thank you.
Looks like other seeing this also. https://community.esri.com/t5/arcgis-field-maps-questions/how-to-delete-offline-sync-version-created...
Any update? @ColinLawrence We are still seeing it and it seems to be causing issues with being able to download to GDB. We are now having 500+ replicas.
thanks a lot
Hey @DougBrowning , unfortunately this one has stalled out as it is elusive to reproduce in house. Do you have any additional details about your or your field workers general workflow when removing offline areas? Obviously its happening pretty frequently for you so maybe there is something we are missing.
The only way I could fairly consistently get this problem to happen was if I was disconnected, removed the offline area from Field Maps, then force closed the app shortly after. In this case it seems to happen because the app is closed before it can save the info needed to unregister the replica the next time the device gains connectivity.
A note on the "expected" behavior from what I know: Replicas are only attempted to be unregistered at the time of removal, and if unsuccessful, on subsequent sign ins when a portal loads.
At UC I asked this in a Demo theater and at least 4 people around me said they have the same issue. So it does seem wide spread.
Our users are contactrors so we are a bit isolated from them to track it down more. But in my testing I can see it fail in the log.
thanks a lot