ShokoAnime / ShokoServer

Repository for Shoko Server.
https://shokoanime.com/
MIT License
408 stars 74 forks source link

Error when recreating groups #750

Closed CtrlAltDefeat94 closed 6 years ago

CtrlAltDefeat94 commented 6 years ago

On commit: 691f6b5ecae875dd465134c09d55b8a092d997be

Seems recreating groups broke my groups entirely: image

Log: https://gist.github.com/CtrlAltDefeat94/8a3d07f8c1f4a1f6d6dc585b748e0c3a

CtrlAltDefeat94 commented 6 years ago

Attempted to recreate groups with grouping turned off, resulted in the following error


[2018-07-21 16:23:32:006] Error|MonoMethod.Invoke => MonoMethod.InternalInvoke => ShokoServiceImplementation.RecreateAllGroups System.NullReferenceException: Object reference not set to an instance of an object
  at System.Linq.Enumerable+<SelectManyIterator>d__167`3[TSource,TCollection,TResult].MoveNext () [0x00060] in <521f3fe476f34ea88748e97b3b984d05>:0 
  at System.Linq.Lookup`2[TKey,TElement].Create[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] keySelector, System.Func`2[T,TResult] elementSelector, System.Collections.Generic.IEqualityComparer`1[T] comparer) [0x00031] in <521f3fe476f34ea88748e97b3b984d05>:0 
  at System.Linq.Enumerable.ToLookup[TSource,TKey,TElement] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] keySelector, System.Func`2[T,TResult] elementSelector, System.Collections.Generic.IEqualityComparer`1[T] comparer) [0x0002a] in <521f3fe476f34ea88748e97b3b984d05>:0 
  at System.Linq.Enumerable.ToLookup[TSource,TKey,TElement] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] keySelector, System.Func`2[T,TResult] elementSelector) [0x00000] in <521f3fe476f34ea88748e97b3b984d05>:0 
  at Shoko.Server.Repositories.Cached.GroupFilterRepository+<>c__DisplayClass28_0.<CalculateAnimeSeriesPerTagGroupFilter>b__7 (System.Int32 key) [0x00000] in /usr/src/app/source/Shoko.Server/Repositories/Cached/GroupFilterRepository.cs:685 
  at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] keySelector, System.Func`2[T,TResult] elementSelector, System.Collections.Generic.IEqualityComparer`1[T] comparer) [0x00096] in <521f3fe476f34ea88748e97b3b984d05>:0 
  at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] keySelector, System.Func`2[T,TResult] elementSelector) [0x00000] in <521f3fe476f34ea88748e97b3b984d05>:0 
  at Shoko.Server.Repositories.Cached.GroupFilterRepository.CalculateAnimeSeriesPerTagGroupFilter (Shoko.Server.Repositories.NHibernate.ISessionWrapper session) [0x0010c] in /usr/src/app/source/Shoko.Server/Repositories/Cached/GroupFilterRepository.cs:685 
  at Shoko.Server.Tasks.AnimeGroupCreator.UpdateGroupFilters (Shoko.Server.Repositories.NHibernate.ISessionWrapper session) [0x00024] in /usr/src/app/source/Shoko.Server/Tasks/AnimeGroupCreator.cs:190 
  at Shoko.Server.Tasks.AnimeGroupCreator.RecreateAllGroups (Shoko.Server.Repositories.NHibernate.ISessionWrapper session) [0x001ef] in /usr/src/app/source/Shoko.Server/Tasks/AnimeGroupCreator.cs:510 
  at Shoko.Server.Tasks.AnimeGroupCreator.RecreateAllGroups () [0x0000b] in /usr/src/app/source/Shoko.Server/Tasks/AnimeGroupCreator.cs:525 
  at Shoko.Server.ShokoServiceImplementation.RecreateAllGroups (System.Boolean resume) [0x00000] in /usr/src/app/source/Shoko.Server/API/v1/Implementations/ShokoServiceImplementation/ShokoServiceImplementation_Entities.cs:1798
da3dsoul commented 6 years ago

That is one that I can fix

da3dsoul commented 6 years ago

I pushed something that might help. If it fails, then there's something up in your DB.

In that case run this on your DB.

DELETE FROM GroupFilter WHERE FilterType = 16

and restart the server

CtrlAltDefeat94 commented 6 years ago

Filters are populating again with grouping turned off. With grouping turned on, I managed to get the error from the first post again, however this time just one, rather than 15 inner exceptions(though I doubt that's progress there heh)

da3dsoul commented 6 years ago

I wonder if it's better to drop all tag filters and regenerate them during Recreate All Groups

da3dsoul commented 6 years ago

Should be fixed now

CtrlAltDefeat94 commented 6 years ago

When trying to recreate groups with grouping enabled

[2018-07-22 08:33:22:775] Error|MonoMethod.Invoke => MonoMethod.InternalInvoke => ShokoServiceImplementation.RecreateAllGroups System.NullReferenceException: Object reference not set to an instance of an object
  at System.Linq.Enumerable+<SelectManyIterator>d__167`3[TSource,TCollection,TResult].MoveNext () [0x00060] in <521f3fe476f34ea88748e97b3b984d05>:0 
  at System.Linq.Lookup`2[TKey,TElement].Create[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] keySelector, System.Func`2[T,TResult] elementSelector, System.Collections.Generic.IEqualityComparer`1[T] comparer) [0x00031] in <521f3fe476f34ea88748e97b3b984d05>:0 
  at System.Linq.Enumerable.ToLookup[TSource,TKey,TElement] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] keySelector, System.Func`2[T,TResult] elementSelector, System.Collections.Generic.IEqualityComparer`1[T] comparer) [0x0002a] in <521f3fe476f34ea88748e97b3b984d05>:0 
  at System.Linq.Enumerable.ToLookup[TSource,TKey,TElement] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] keySelector, System.Func`2[T,TResult] elementSelector) [0x00000] in <521f3fe476f34ea88748e97b3b984d05>:0 
  at Shoko.Server.Repositories.Cached.GroupFilterRepository+<>c__DisplayClass29_0.<CalculateAnimeSeriesPerTagGroupFilter>b__8 (System.Int32 key) [0x00000] in /usr/src/app/source/Shoko.Server/Repositories/Cached/GroupFilterRepository.cs:709 
  at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] keySelector, System.Func`2[T,TResult] elementSelector, System.Collections.Generic.IEqualityComparer`1[T] comparer) [0x00096] in <521f3fe476f34ea88748e97b3b984d05>:0 
  at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] keySelector, System.Func`2[T,TResult] elementSelector) [0x00000] in <521f3fe476f34ea88748e97b3b984d05>:0 
  at Shoko.Server.Repositories.Cached.GroupFilterRepository.CalculateAnimeSeriesPerTagGroupFilter (Shoko.Server.Repositories.NHibernate.ISessionWrapper session) [0x000fb] in /usr/src/app/source/Shoko.Server/Repositories/Cached/GroupFilterRepository.cs:709 
  at Shoko.Server.Tasks.AnimeGroupCreator.UpdateGroupFilters (Shoko.Server.Repositories.NHibernate.ISessionWrapper session) [0x00024] in /usr/src/app/source/Shoko.Server/Tasks/AnimeGroupCreator.cs:190 
  at Shoko.Server.Tasks.AnimeGroupCreator.RecreateAllGroups (Shoko.Server.Repositories.NHibernate.ISessionWrapper session) [0x001ef] in /usr/src/app/source/Shoko.Server/Tasks/AnimeGroupCreator.cs:510 
  at Shoko.Server.Tasks.AnimeGroupCreator.RecreateAllGroups () [0x0000b] in /usr/src/app/source/Shoko.Server/Tasks/AnimeGroupCreator.cs:525 
  at Shoko.Server.ShokoServiceImplementation.RecreateAllGroups (System.Boolean resume) [0x00000] in /usr/src/app/source/Shoko.Server/API/v1/Implementations/ShokoServiceImplementation/ShokoServiceImplementation_Entities.cs:1798 

All groups are now empty, as seen in an earlier screenshot. Turning off grouping, running the query and then restarting shoko allows me to recreate the groups again, but only without grouping enabled.

CtrlAltDefeat94 commented 6 years ago

I just noticed that after recreating groups with grouping disabled(after I did above mentioned), all shows are grouped according to the settings used before the crash(so, settings are set to not use grouping, but shows are grouped anyway)

da3dsoul commented 6 years ago

WTF. @CtrlAltDefeat I think there's something seriously up with your DB. It's throwing nullpointers in places that should never be null. I'll try to make it run again, but you may end up with strange errors later that seem to make no sense.

da3dsoul commented 6 years ago

Try with latest commit

bigretromike commented 6 years ago

@da3dsoul the "corrupt db" is in most cases because some errors in server ;-)

da3dsoul commented 6 years ago

@ctrlaltdefeat what was the status with latest? I know that you said it doesn't work, but I'd like a stack

CtrlAltDefeat94 commented 6 years ago

This was from my latest try https://gist.github.com/CtrlAltDefeat94/ce7226c3421af531ed69cf2a3639f8ce

da3dsoul commented 6 years ago

Those are MySQL timeouts..... They aren't explicitly related. Are those common? I haven't seen them on Windows, but I don't use MySQL, either, so....

bigretromike commented 6 years ago

@da3dsoul no, no mysql timeout normaly. But I dont recreate groups.

CtrlAltDefeat commented 6 years ago

Just a heads up, yall keep @ ing me instead of @CtrlAltDefeat94 @da3dsoul

da3dsoul commented 6 years ago

Wait! Who are you?

CtrlAltDefeat94 commented 6 years ago

@CtrlAltDefeat change your name, problem solved :)

CtrlAltDefeat commented 6 years ago

Ha, yeah.. Alternatively just pay attention to the actual username of whoever you're pinging :p Good luck on your project! No worries obviously, figured I'd give daed(?) soul over there the heads up.

da3dsoul commented 6 years ago

Yeah, I wouldn't have noticed if you didn't say. Have fun with whatever. We make an anime metadata manager if you ever need one

CtrlAltDefeat94 commented 6 years ago

Issue appears to be resolved on f548b39444f44ab897fbcf9647fb771d4abdab8c