dataobjects-net icon indicating copy to clipboard operation
dataobjects-net copied to clipboard

Session dispose exception

Open letarak opened this issue 2 years ago • 6 comments

DO 7.0 Sorry, can not reproduce in test environment Catch this exception three times

System.ArgumentNullException: Value cannot be null. (Parameter 'node')
   at System.Collections.Generic.LinkedList`1.ValidateNode(LinkedListNode`1 node)
   at Xtensive.Collections.TopDeque`2.PopBottom() in /_/Orm/Xtensive.Orm/Collections/TopDeque.cs:line 180
   at Xtensive.Caching.LruCache`2.Clear() in /_/Orm/Xtensive.Orm/Caching/LruCache{TKey, TItem}.cs:line 159
   at Xtensive.Orm.Session.DisposeImpl(Boolean isAsync) in /_/Orm/Xtensive.Orm/Orm/Session.cs:line 661
   at Xtensive.Orm.Session.Dispose() in /_/Orm/Xtensive.Orm/Orm/Session.cs:line 614
System.InvalidOperationException: The LinkedList node does not belong to current LinkedList.
   at System.Collections.Generic.LinkedList`1.ValidateNode(LinkedListNode`1 node)
   at Xtensive.Collections.TopDeque`2.PopBottom() in /_/Orm/Xtensive.Orm/Collections/TopDeque.cs:line 180
   at Xtensive.Caching.LruCache`2.Clear() in /_/Orm/Xtensive.Orm/Caching/LruCache{TKey, TItem}.cs:line 159
   at Xtensive.Orm.Session.DisposeImpl(Boolean isAsync) in /_/Orm/Xtensive.Orm/Orm/Session.cs:line 661
   at Xtensive.Orm.Session.Dispose() in /_/Orm/Xtensive.Orm/Orm/Session.cs:line 614

letarak avatar Mar 03 '23 04:03 letarak

Hello @letarak , so this appears in some conditions on production? Does it fail all the time?

alex-kulakov avatar Mar 09 '23 06:03 alex-kulakov

Did the problem appear on a version which was publicly available as a release (7.0.3, 7.0.2 etc.) or it is on latest changes on 7.0 branch? I need the version or the commit in case it was built by you on some commit of 7.0 branch. This is important to identify whether it is old problem or has just appeared.

alex-kulakov avatar Mar 09 '23 13:03 alex-kulakov

Yes, catch on production, but very rarely (5 times total in 3-4 month) Precise version 7.0.3

Exception seen only in two blocks of code, each of them use nested session scope Nested session use entity instance from outer scope Hope this helps

letarak avatar Mar 10 '23 14:03 letarak

Hmmm... I'll try to reproduce it but probably it will be a hard-to-catch bug. Thank you for the info. If some additional details appear, please post them.

alex-kulakov avatar Mar 20 '23 13:03 alex-kulakov

I stumbled across this post in which it is told that errors like "The LinkedList node does not belong to current LinkedList" in concurrent access. Are you sure that there is no hidden switching between sessions? Do you use Session.Activate() and Session.Current in such cases?

alex-kulakov avatar Mar 20 '23 13:03 alex-kulakov

No, we do not use Session.Activate() maybe Session.Current with custom resolver and this can activate session without our help :)

I need check this

letarak avatar Mar 21 '23 08:03 letarak