Medusa: Forced Search

Created on 7 Feb 2017  路  12Comments  路  Source: pymedusa/Medusa

Before submitting your issue:

Enable debug logging in Medusa settings, reproduce the error (be sure to disable after the bug is fixed)
Branch: develop
Commit: 016cda64b01ac2d6b7327e95f9910e3961c4ba2b
Version: v0.1.10
Database: 44.4
What you did:Tried to do a force search on a show in the Schedule
**What happened:
it had an error nothing happen, No search.
What you expected: to do a search
Logs:

PASTE LOGS HERE
2017-02-07 03:01:56 DEBUG    SEARCHQUEUE-FORCED-255192 :: [016cda6] Building internal name cache for Call the Midwife
2017-02-07 03:01:56 DB       SEARCHQUEUE-FORCED-255192 :: [016cda6] cache.db: DELETE FROM scene_names WHERE indexer_id = 0 OR    indexer_id = ? with args [255192]
2017-02-07 03:01:56 DEBUG    SEARCHQUEUE-FORCED-255192 :: [016cda6] Traceback (most recent call last):
  File "C:\Medusa\medusa\search\queue.py", line 322, in run
    self.manual_search, self.manual_search_type)
  File "C:\Medusa\medusa\search\core.py", line 483, in search_providers
    name_cache.build_name_cache(show)
  File "C:\Medusa\medusa\name_cache.py", line 133, in build_name_cache
    _cache_name(show)
  File "C:\Medusa\medusa\name_cache.py", line 101, in _cache_name
    clear_cache(indexer_id)
  File "C:\Medusa\medusa\name_cache.py", line 80, in clear_cache
    for key in to_remove:
  File "C:\Medusa\medusa\name_cache.py", line 76, in <genexpr>
    key
RuntimeError: dictionary changed size during iteration

Bug Concluded

Most helpful comment

Imo this is perfectly solvable in code without exception handling.

All 12 comments

Already fixed in develop. Are you updated?

This was fixed just yesterday btw. So I understand if you are not.

I was up to date as of 27 minutes ago it wasn't fixed for me was on Commit: 016cda64b01ac2d6b7327e95f9910e3961c4ba2b i am updating right now. i am at the current Commit: Branch: develop
Commit: 72337f83428810f9dc74394d7bbde1d89f0a30b7 now and still not fixed.

I confirm its happening on windows after deleting cache.db and start a new one.

2017-02-07 11:10:21 DEBUG    SEARCHQUEUE-MANUAL-295068 :: [51ff22a] Traceback (most recent call last):
  File "C:/Users/Fernando/Documents/Medusa\medusa\search\queue.py", line 322, in run
    self.manual_search, self.manual_search_type)
  File "C:/Users/Fernando/Documents/Medusa\medusa\search\core.py", line 483, in search_providers
    name_cache.build_name_cache(show)
  File "C:/Users/Fernando/Documents/Medusa\medusa\name_cache.py", line 133, in build_name_cache
    _cache_name(show)
  File "C:/Users/Fernando/Documents/Medusa\medusa\name_cache.py", line 101, in _cache_name
    clear_cache(indexer_id)
  File "C:/Users/Fernando/Documents/Medusa\medusa\name_cache.py", line 80, in clear_cache
    for key in to_remove:
  File "C:/Users/Fernando/Documents/Medusa\medusa\name_cache.py", line 76, in <genexpr>
    key
RuntimeError: dictionary changed size during iteration

@labrys

I found out that if show already have cached items in cache.db it works
It fails when there is no cached item

also this error doesn't appear in UI. only if you open viewlogs

need a try:except globaly in the name_cache creation imo

Imo this is perfectly solvable in code without exception handling.

i said that because all our threads have a global try:except to not let it die. That's what i'm talking about

Actually this is a quick fix... pushed now just waiting for a review and merge.

ok

Exception handling should not be avoided. Python is, by design, intended to use liberal exception handling, its part of the EAFP mantra (easier to ask forgiveness than permission). However just catching all exceptions to avoid killing a thread isn't the answer either, particularly for cases like this where the fix is quick and simple, since you can end up hiding an underlying issue and let it go unaddressed..

Fixed as of the current commit.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

skarekrow picture skarekrow  路  4Comments

a10kiloham picture a10kiloham  路  3Comments

Miicker picture Miicker  路  3Comments

GritGub picture GritGub  路  3Comments

Shootersss picture Shootersss  路  3Comments