Esri / Esri/arcgis-python-api

Requests in internal functions to a non-working ArcGIS Server services causes execution freeze

Aperta
#1,231 9 commenti 1 reazione 1 assegnatario Rivendicata da @achapkowski Vedi su GitHub
bug
Lingua principale
Python
Stelle
2.2k
Fork
1.2k
Merge medio
2h 40m
PR unite (30g)
2

Descrizione

**Describe the bug**
Accessing some properties or methods on an Item object where the underlying FeatureServer or MapServer is not working will cause an infinite freeze.
This boils down to a self._con.post call in the self._refresh method of the Item object.
The reason, in our case, for the service not working was a deleted table in the database.
Perhaps this can be considered an edge case.
Tested with 2.0.0 of the API

**To Reproduce**
Steps to reproduce the behavior:

1. Publish a service which uses an enterprise geodatabase to ArcGIS Server
2. If necessary, add an item in Portal referencing the service published in step 1
3. Delete the underlying feature class from the enterprise geodatabase. This may need to be done in SQL Server Management Studio (or similar) or disable schema locking at the service in AGS Manager, if not able to delete it from ArcGIS Pro/ArcMap.
4. Make sure the service is still running
5. Run the code below

```python
from arcgis.gis import GIS
gis = GIS(portal_url, username, password)
item = gis.content.get("")
print(item.shared_with)
```
error:
it just sits there, waiting. To end, kill the python process/kernel.

**Expected behavior**
I expect the Python API to throw an error (perhaps by adding a timeout value to the post request).

**Platform (please complete the following information):**
- OS: Windows 10
- Python API Version 2.0.0
- Python 3.7.11 from ArcGIS Pro 2.9.2

**Additional context**
I've tracked down the request freezing to the line below (in my case, where the Item was a Feature Service)
Line 14549 in the file \Lib\site-packages\arcgis\gis\__init__.py

```python
dictdata = self._con.post(
self.url, params
)
```

A bit more context, starting at line 14541
```python
else:
try:
if is_raster:
dictdata = self._con.post(
self.url, params, timeout=None # token=self._lazy_token,
)
else:
try:
dictdata = self._con.post(
self.url, params
) # , token=self._lazy_token)
```

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.