Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem in helperUpdateTVMaze - deletes settings table #14

Closed
faulander opened this issue Jan 22, 2020 · 8 comments
Closed

Problem in helperUpdateTVMaze - deletes settings table #14

faulander opened this issue Jan 22, 2020 · 8 comments
Assignees
Labels
bug Something isn't working fixed Issue is fixed
Milestone

Comments

@faulander
Copy link
Owner

I am now getting the same error again

2020-01-22 20:07:14,012 INFO [newshows.helpers:196] Show already in DB: Sorcerous Stabber Orphen
[2020-01-22 20:07:14,742] ERROR:huey:Worker-1:Unhandled exception in task 2469f3c5-3481-441e-ae13-3835ffda4298.
Traceback (most recent call last):
  File "C:\Users\arogl\.virtualenvs\P4S-7tjkeV1a\lib\site-packages\django\db\models\options.py", line 581, in get_field
    return self.fields_map[field_name]
KeyError: 'page'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\arogl\.virtualenvs\P4S-7tjkeV1a\lib\site-packages\huey\api.py", line 345, in _execute
    task_value = task.execute()
  File "C:\Users\arogl\.virtualenvs\P4S-7tjkeV1a\lib\site-packages\huey\api.py", line 697, in execute
    return func(*args, **kwargs)
  File "C:\Users\arogl\.virtualenvs\P4S-7tjkeV1a\lib\site-packages\huey\contrib\djhuey\__init__.py", line 132, in inner
    return fn(*args, **kwargs)
  File "H:\Git\P4S\src\newshows\helpers.py", line 202, in HelperUpdateTVMaze
    q = Show.objects.filter(Q(pk=1)).update(page=page)
  File "C:\Users\arogl\.virtualenvs\P4S-7tjkeV1a\lib\site-packages\django\db\models\query.py", line 748, in update
    query.add_update_values(kwargs)
  File "C:\Users\arogl\.virtualenvs\P4S-7tjkeV1a\lib\site-packages\django\db\models\sql\subqueries.py", line 117, in add_update_values
    field = self.get_meta().get_field(name)
  File "C:\Users\arogl\.virtualenvs\P4S-7tjkeV1a\lib\site-packages\django\db\models\options.py", line 583, in get_field
    raise FieldDoesNotExist("%s has no field named '%s'" % (self.object_name, field_name))
django.core.exceptions.FieldDoesNotExist: Show has no field named 'page'
2020-01-22 20:07:14,742 ERROR [huey:360] Unhandled exception in task 2469f3c5-3481-441e-ae13-3835ffda4298.
Traceback (most recent call last):
  File "C:\Users\arogl\.virtualenvs\P4S-7tjkeV1a\lib\site-packages\django\db\models\options.py", line 581, in get_field
    return self.fields_map[field_name]
KeyError: 'page'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\arogl\.virtualenvs\P4S-7tjkeV1a\lib\site-packages\huey\api.py", line 345, in _execute
    task_value = task.execute()
  File "C:\Users\arogl\.virtualenvs\P4S-7tjkeV1a\lib\site-packages\huey\api.py", line 697, in execute
    return func(*args, **kwargs)
  File "C:\Users\arogl\.virtualenvs\P4S-7tjkeV1a\lib\site-packages\huey\contrib\djhuey\__init__.py", line 132, in inner
    return fn(*args, **kwargs)
  File "H:\Git\P4S\src\newshows\helpers.py", line 202, in HelperUpdateTVMaze
    q = Show.objects.filter(Q(pk=1)).update(page=page)
  File "C:\Users\arogl\.virtualenvs\P4S-7tjkeV1a\lib\site-packages\django\db\models\query.py", line 748, in update
    query.add_update_values(kwargs)
  File "C:\Users\arogl\.virtualenvs\P4S-7tjkeV1a\lib\site-packages\django\db\models\sql\subqueries.py", line 117, in add_update_values
    field = self.get_meta().get_field(name)
  File "C:\Users\arogl\.virtualenvs\P4S-7tjkeV1a\lib\site-packages\django\db\models\options.py", line 583, in get_field
    raise FieldDoesNotExist("%s has no field named '%s'" % (self.object_name, field_name))
django.core.exceptions.FieldDoesNotExist: Show has no field named 'page'

It seems the main database is either corrupt or encrypted:

image

I then used the sqlite3 command line to open and check the database and all OK and working again.

The error occurs when running "run_huey", and the HelperUpdateTVMaze() runs and a page increment needs to be saved back to the database.

Originally posted by @arogl in #13 (comment)

@faulander faulander self-assigned this Jan 22, 2020
@faulander faulander added the bug Something isn't working label Jan 22, 2020
faulander pushed a commit that referenced this issue Jan 22, 2020
@faulander faulander added Feedback Feedback or more info is needed testing Needs to be tested labels Jan 22, 2020
@faulander
Copy link
Owner Author

i have added a fix (hopefully) but i cannot test it since i am not at home.
Can you try and check if your newshows_setting table still gets deleted? If yes, it's a bug in the django orm; i double and tripple checked the code, it doesn't delete anything anywhere. I just changed that the settings gets loaded again before changing the page the 2nd time.

@arogl
Copy link
Contributor

arogl commented Jan 23, 2020

I tested be choosing my 720p profile and hitting save, no other changes. A little while later the settings had been deleted.

Default profile when going to the settings page is the "---------" profile.

@faulander
Copy link
Owner Author

faulander commented Jan 23, 2020 via email

@faulander faulander removed Feedback Feedback or more info is needed testing Needs to be tested labels Jan 23, 2020
@arogl
Copy link
Contributor

arogl commented Feb 1, 2020

Could it be a database lock between the helperGetSonarrProfiles and HelperUpdateTVMaze functions?

@faulander
Copy link
Owner Author

I have reworked the complete settings system in 0.2.0 and it still happens, even when i don't run the management tasks in background - simply by reloading the settings page a few times. I am out of options, can't figure out why it happens. There are no errors, nothing.

I have writte the problem on stackoverflow and on the django mailing list - let's see if they come up with a solution.

@faulander
Copy link
Owner Author

Next thing i will try is moving to Postgres. I wanted to use sqlite to have minimum requirements, but if it works with postgres, i can live with it.

@faulander
Copy link
Owner Author

I think i found the problem: If i switch to Standard Django Forms, it behaves as it should, so the problem lies within Django Crispy Forms! The remodeling wasn't the baddest idea though, it's no compatible with docker and thus should receiver more users.

@faulander
Copy link
Owner Author

Fixed in 0.2.0

@faulander faulander added this to the 0.2.0 milestone Mar 24, 2020
@faulander faulander added the fixed Issue is fixed label Jul 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed Issue is fixed
Projects
None yet
Development

No branches or pull requests

2 participants