Skip to content

Task Cancelled Exceptions for long-running channel connections #19

Open
@bdcodestuff

Description

@bdcodestuff

Hello,

I'm using this excellent library in a mobile app that subscribes to changes on various supabase tables as follows:

Client.Instance.From<Condition>().On(Supabase.Client.ChannelEventType.Insert,action)
Client.Instance.From<Condition>().On(Supabase.Client.ChannelEventType.Update,action)
others...

where Condition is a database table model, and action is a callback to fire when the event occurs

This works great initially but after long periods of time I eventually get crashes due to unhandled "Task Cancelled" exceptions.

Here's a possibly useful stack trace from MS App center sent from the app when it crashes. I also noticed the same behavior when setting up long-running channel subscriptions within an ASP Netcore server app:

Websocket.Client.WebsocketClient.StartClient(Uri uri, CancellationToken token, ReconnectionType type, Boolean failFast)
Websocket.Client.WebsocketClient.StartInternal(Boolean failFast)
Supabase.Realtime.Socket.Connect()
System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_1(Object )
System.Threading.QueueUserWorkItemCallbackDefaultContext.Execute()
System.Threading.ThreadPoolWorkQueue.Dispatch()
System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
System.Threading.Thread.StartCallback()

Any thoughts why this might be happening and what I could do to fix it? It causes my app to crash every few hours throughout the day...

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions