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

ObjectDisposedException in Gremlinq After Service Inactivity #1488

Closed
EliorGigi opened this issue Feb 25, 2024 Discussed in #1487 · 5 comments
Closed

ObjectDisposedException in Gremlinq After Service Inactivity #1488

EliorGigi opened this issue Feb 25, 2024 Discussed in #1487 · 5 comments
Labels

Comments

@EliorGigi
Copy link

EliorGigi commented Feb 25, 2024

Discussed in #1487

Originally posted by EliorGigi February 23, 2024
Description:

I have developed an ASP.NET Core Web API utilizing Gremlinq for CosmosDB graph data access. The service, injected with IGremlinQuerySource, is registered as a singleton.

The issue arises after the service has been inactive for a few hours. Subsequently, the first Gremlin query results in a System.ObjectDisposedException associated with the semaphore.

Error log:

[2024/02/22 22:51:42.583  DBG]  ThreadId :74 ExRam.Gremlinq.Core.AspNet.GremlinqQueries Executing Gremlin query 2d455629-6d93-4720-89c5-9bb3c6f7d5c9 (Script=g.V(_a).hasLabel(_b).limit(_c), Bindings={}). 
[2024/02/22 22:51:42.584  ERR]  ThreadId :74 ExRam.Gremlinq.Core.AspNet.GremlinqQueries Execution of Gremlin query 2d455629-6d93-4720-89c5-9bb3c6f7d5c9 failed. 
System.ObjectDisposedException: The semaphore has been disposed.

Any idea what could be going wrong? It occurs for every Gremlin query and not for a specific one.

@danielcweber
Copy link
Contributor

Version 12.3.0-preview.7 (on GitHub packages) aims to provide a fix. Could you give it a try?

@EliorGigi
Copy link
Author

I tried version 12.3.0-preview.13 and still encountered the same error.

@danielcweber
Copy link
Contributor

I tried version 12.3.0-preview.13 and still encountered the same error.

@EliorGigi I'd be surprised if it was the same stack trace though. Can you provide a stack trace for the latest stable version (12.3.0) ?

@bobvaselaarchs
Copy link

bobvaselaarchs commented Apr 18, 2024

We updated to version 12.6.0 and saw a large reduction in timeout exceptions with this and similar stack traces.

However, we started seeing a few that looked like this:

Message : The CancellationTokenSource has been disposed.
Exception type : System.ObjectDisposedException
Failed method: ExRam.Gremlinq.Providers.Core.WebSocketGremlinqClientFactory+WebSocketGremlinqClientFactoryImpl`1+WebSocketGremlinqClient.Dispose

Stack Trace:

System.ObjectDisposedException:
   at System.ThrowHelper.ThrowObjectDisposedException (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
   at System.Threading.CancellationTokenSource.Cancel (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
   at ExRam.Gremlinq.Providers.Core.WebSocketGremlinqClientFactory+WebSocketGremlinqClientFactoryImpl`1+WebSocketGremlinqClient.Dispose (ExRam.Gremlinq.Providers.Core, Version=12.6.0.0, Culture=neutral, PublicKeyToken=null: /_/src/Providers.Core/Factory/WebSocketGremlinqClientFactory.cs:281)
   at ExRam.Gremlinq.Providers.Core.GremlinqClientExtensions+ThrottledGremlinqClient.Dispose (ExRam.Gremlinq.Providers.Core, Version=12.6.0.0, Culture=neutral, PublicKeyToken=null: /_/src/Providers.Core/Extensions/GremlinqClientExtensions.cs:165)
   at ExRam.Gremlinq.Providers.Core.GremlinqClientFactory+PoolGremlinqClientFactory`1+PoolGremlinqClient+PoolSlotGremlinqClient+<<SubmitAsync>g__Core|3_0>d`1.MoveNext (ExRam.Gremlinq.Providers.Core, Version=12.6.0.0, Culture=neutral, PublicKeyToken=null: /_/src/Providers.Core/Factory/GremlinqClientFactory.cs:58)
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
   at ExRam.Gremlinq.Providers.Core.GremlinqClientFactory+PoolGremlinqClientFactory`1+PoolGremlinqClient+PoolSlotGremlinqClient+<<SubmitAsync>g__Core|3_0>d`1.MoveNext (ExRam.Gremlinq.Providers.Core, Version=12.6.0.0, Culture=neutral, PublicKeyToken=null: /_/src/Providers.Core/Factory/GremlinqClientFactory.cs:63)
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
   at System.Threading.Tasks.Sources.ManualResetValueTaskSourceCore`1.ThrowForFailedGetResult (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
   at ExRam.Gremlinq.Providers.Core.GremlinqClientFactory+PoolGremlinqClientFactory`1+PoolGremlinqClient+PoolSlotGremlinqClient+<<SubmitAsync>g__Core|3_0>d`1.System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult (ExRam.Gremlinq.Providers.Core, Version=12.6.0.0, Culture=neutral, PublicKeyToken=null)
   at ExRam.Gremlinq.Providers.Core.GremlinqClientExtensions+RetryGremlinqClient+<<SubmitAsync>g__Core|3_0>d`1.MoveNext (ExRam.Gremlinq.Providers.Core, Version=12.6.0.0, Culture=neutral, PublicKeyToken=null: /_/src/Providers.Core/Extensions/GremlinqClientExtensions.cs:225)
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
   at ExRam.Gremlinq.Providers.Core.GremlinqClientExtensions+RetryGremlinqClient+<<SubmitAsync>g__Core|3_0>d`1.MoveNext (ExRam.Gremlinq.Providers.Core, Version=12.6.0.0, Culture=neutral, PublicKeyToken=null: /_/src/Providers.Core/Extensions/GremlinqClientExtensions.cs:238)
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
   at System.Threading.Tasks.Sources.ManualResetValueTaskSourceCore`1.ThrowForFailedGetResult (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
   at ExRam.Gremlinq.Providers.Core.GremlinqClientExtensions+RetryGremlinqClient+<<SubmitAsync>g__Core|3_0>d`1.System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult (ExRam.Gremlinq.Providers.Core, Version=12.6.0.0, Culture=neutral, PublicKeyToken=null)
   at ExRam.Gremlinq.Providers.Core.GremlinqClientFactory+PoolGremlinqClientFactory`1+PoolGremlinqClient+<<SubmitAsync>g__Core|9_0>d`1.MoveNext (ExRam.Gremlinq.Providers.Core, Version=12.6.0.0, Culture=neutral, PublicKeyToken=null: /_/src/Providers.Core/Factory/GremlinqClientFactory.cs:131)
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
   at ExRam.Gremlinq.Providers.Core.GremlinqClientFactory+PoolGremlinqClientFactory`1+PoolGremlinqClient+<<SubmitAsync>g__Core|9_0>d`1.MoveNext (ExRam.Gremlinq.Providers.Core, Version=12.6.0.0, Culture=neutral, PublicKeyToken=null: /_/src/Providers.Core/Factory/GremlinqClientFactory.cs:131)
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
   at System.Threading.Tasks.Sources.ManualResetValueTaskSourceCore`1.ThrowForFailedGetResult (System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
   at ExRam.Gremlinq.Providers.Core.GremlinqClientFactory+PoolGremlinqClientFactory`1+PoolGremlinqClient+<<SubmitAsync>g__Core|9_0>d`1.System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult (ExRam.Gremlinq.Providers.Core, Version=12.6.0.0, Culture=neutral, PublicKeyToken=null)
   at ExRam.Gremlinq.Providers.Core.GremlinqClientExtensions+LoggingGremlinqClient+<<SubmitAsync>g__Core|6_0>d`1.MoveNext (ExRam.Gremlinq.Providers.Core, Version=12.6.0.0, Culture=neutral, PublicKeyToken=null: /_/src/Providers.Core/Extensions/GremlinqClientExtensions.cs:100) 

@danielcweber
Copy link
Contributor

danielcweber commented Apr 19, 2024

Regarding as fixed, later issue tracked here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants