vale46n1 / immich_duplicate_finder

A Comprehensive Solution for Identifying and Managing Duplicate Photos in Immich
Apache License 2.0
184 stars 12 forks source link

Read Timeout #13

Closed phoenixmillenia closed 4 months ago

phoenixmillenia commented 4 months ago

I can't get to requesting the assets from the server, keeps timing out, increasing the timeout in the interface doesn't seem to help. (set to 50). Can we increase the readtimeout?

Error fetching assets: HTTPConnectionPool(host='192.168.1.135', port=30041): Read timed out. (read timeout=10) UnboundLocalError: cannot access local variable 'assets' where it is not associated with a value File "/usr/local/lib/python3.11/dist-packages/streamlit/runtime/scriptrunner/script_runner.py", line 542, in _run_script exec(code, module.dict) File "/root/immich_duplicate_finder/app.py", line 282, in main() File "/root/immich_duplicate_finder/app.py", line 244, in main assets = fetchAssets(immich_server_url,api_key) # Ensure this handles errors/exceptions properly ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/streamlit/runtime/caching/cache_utils.py", line 210, in wrapper return cached_func(*args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/streamlit/runtime/caching/cache_utils.py", line 239, in call return self._get_or_create_cached_value(args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/streamlit/runtime/caching/cache_utils.py", line 266, in _get_or_create_cached_value return self._handle_cache_miss(cache, value_key, func_args, func_kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/streamlit/runtime/caching/cache_utils.py", line 322, in _handle_cache_miss computed_value = self._info.func(func_args, **func_kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/root/immich_duplicate_finder/immichApi.py", line 57, in fetchAssets return assets ^^^^^^

vale46n1 commented 4 months ago

Try timeout 5000. Are milliseconds and maybe 50 are not sufficient

phoenixmillenia commented 4 months ago

Thanks for the quick reply! I changed request timeout to 5000ms, but still receive the same error, I see the error still says read timeout=10?

Error fetching assets: HTTPConnectionPool(host='192.168.1.135', port=30041): Read timed out. (read timeout=10)

vale46n1 commented 4 months ago

I just tried to rebuild my database, and everything went smoothly. Did you ensure to save the changes when you set the duration to 5000ms

image

phoenixmillenia commented 4 months ago

Yes, the setting is saved, even tried restarting to make sure the setting persists on the next run.

I recently imported a large google takeout, nearly 100,000 items - perhaps that's too much for a first run. I think I'll try starting over and only importing a part of the takeout, see if it works with just that first.

vale46n1 commented 4 months ago

This should not be the problem. Port is correct? It's a custom port? Default port in Minch is different

mahir1505 commented 4 months ago

same error here increasing timeout did not help i can access immich on the specified ip/port but i get an error in the duplicate app

phoenixmillenia commented 4 months ago

no issue connecting. It works fine before I load my images from takeout.

Just started a new instance, loaded only one zip from my takeout rather than the whole thing, seems to be working now. I'll process one zip at a time.

vale46n1 commented 4 months ago

I tried once again but without problem. I'll have a look again

mahir1505 commented 4 months ago

I tried once again but without problem. I'll have a look again

Did you try it with around 30k (150GB) pictures and videos?

phoenixmillenia commented 4 months ago

I've imported 31k photos so far and it still seems to work. It looks like when you import too many all at once, this does not wait for the server to do a first run on the duplicate search. If some have already been processed, it works just fine. Importing one takeout zip, and then running the search is working for me so far.

Have run into a different issue - it's not actually deleting the dupes, it shows me a duplicate, once I click to delete one, it just flashes and then starts processing all over again. tried a few times.

TheLinuxGuy commented 4 months ago

I am seeing the same error.

` __ _ __

File "/home/gfm/immich_duplicate_finder/immichApi.py", line 57, in fetchAssets return assets UnboundLocalError: local variable 'assets' referenced before assignment 2024-04-10 16:21:45.367 Uncaught app exception Traceback (most recent call last): File "/usr/local/lib/python3.10/dist-packages/streamlit/runtime/scriptrunner/script_runner.py", line 542, in _run_script exec(code, module.dict) File "/home/gfm/immich_duplicate_finder/app.py", line 285, in main() File "/home/gfm/immich_duplicate_finder/app.py", line 264, in main assets = fetchAssets(immich_server_url,api_key) # Ensure this handles errors/exceptions properly File "/usr/local/lib/python3.10/dist-packages/streamlit/runtime/caching/cache_utils.py", line 210, in wrapper return cached_func(*args, *kwargs) File "/usr/local/lib/python3.10/dist-packages/streamlit/runtime/caching/cache_utils.py", line 239, in call return self._get_or_create_cached_value(args, kwargs) File "/usr/local/lib/python3.10/dist-packages/streamlit/runtime/caching/cache_utils.py", line 266, in _get_or_create_cached_value return self._handle_cache_miss(cache, value_key, func_args, func_kwargs) File "/usr/local/lib/python3.10/dist-packages/streamlit/runtime/caching/cache_utils.py", line 322, in _handle_cache_miss computed_value = self._info.func(func_args, **func_kwargs) File "/home/gfm/immich_duplicate_finder/immichApi.py", line 57, in fetchAssets return assets UnboundLocalError: local variable 'assets' referenced before assignment ^[[A^[[A `

vale46n1 commented 4 months ago

I'll have a look

vale46n1 commented 4 months ago

variable assets is used before being defined in all possible paths of the function. This can cause the UnboundLocalError if any exception occurs before assets is assigned from the response.json() call. To avoid this I'll fix the code to initialize assets to a default value before the try block

vale46n1 commented 4 months ago

Code fixed. let me know if now is working