Not logged in. · Lost password · Register
Forum: MatriX RSS
pcharlton@carbonlabs.co.uk #1
Member since Nov 2019 · 12 posts
Group memberships: Members
Show profile · Link to this post
Subject: Xamarin iOS - DotNetty.Transport.Channels.ClosedChannelException
Hi,
I'm getting this exception generated intermittently I think when the app/phone goes into sleep mode.  It's ahrd to recreate but my error log system is pickig them up.

I've added some code that tries to monitor when the app goes to sleep and disconnect the XmppClient which I think has caught a lot of these incidents, but some still seem to be slipping through.

It seems to be caused by the KeepAliveHandler.  I was wondering if there was anythign I could lookat from the calling code (in the pipeline perhaps) or whether this was mode something that needed handling in the underlying code.


Xamarin Exception Stack:
DotNetty.Transport.Channels.ClosedChannelException: I/O error occurred.
  at Matrix.Network.Handlers.KeepAliveHandler+<>c__DisplayClass4_0.<ChannelActive>b__0 (System.Object state) <0x1075f9230 + 0x001bf> in <2b86b82b658d4c92bfd52eb72504d791#ce8736efb5b41d616940f6b40b6f6dce>:0
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_1 (System.Object state) <0x1016545d8 + 0x00067> in <218435b0f6654ac1ab0cdd176f26b9bd#ce8736efb5b41d616940f6b40b6f6dce>:0
  at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context (System.Object state) <0x1015e9790 + 0x0005b> in <218435b0f6654ac1ab0cdd176f26b9bd#ce8736efb5b41d616940f6b40b6f6dce>:0
  at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) <0x1015e2cf8 + 0x0015f> in <218435b0f6654ac1ab0cdd176f26b9bd#ce8736efb5b41d616940f6b40b6f6dce>:0
  at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) <0x1015e2c3c + 0x00043> in <218435b0f6654ac1ab0cdd176f26b9bd#ce8736efb5b41d616940f6b40b6f6dce>:0
  at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem () <0x1015e96f0 + 0x00047> in <218435b0f6654ac1ab0cdd176f26b9bd#ce8736efb5b41d616940f6b40b6f6dce>:0
  at System.Threading.ThreadPoolWorkQueue.Dispatch () <0x1013bc5c0 + 0x001e7> in <218435b0f6654ac1ab0cdd176f26b9bd#ce8736efb5b41d616940f6b40b6f6dce>:0
  at ObjCRuntime.Runtime.ThreadPoolDispatcher (System.Func`1[TResult] callback) <0x1025c1fa4 + 0x00053> in <149d342757e54bfaa120bb42afe18369#ce8736efb5b41d616940f6b40b6f6dce>:0
  at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback () <0x1015e9588 + 0x00077> in <218435b0f6654ac1ab0cdd176f26b9bd#ce8736efb5b41d616940f6b40b6f6dce>:0

All the best,
Paul.
Avatar
Alex #2
Member since Feb 2003 · 4438 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hey Paul,

you can check if the KeepAliveHandler is terminating fine when you close your connection.
Apart from that I am highly suggesting that you switch to the latest code in the net5 branch on Github. Because DotNetty seems to be not in development anymore-

See also:
https://github.com/matrix-xmpp/matrix-vnext/tree/net5

Alex
pcharlton@carbonlabs.co.uk #3
Member since Nov 2019 · 12 posts
Group memberships: Members
Show profile · Link to this post
Okay, I'll do that.  Does that branch go to a nuget repository or is it a build locally kind of thing?

Paul.
Avatar
Alex #4
Member since Feb 2003 · 4438 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Nuget packages from CI are currently on the MyGet feed where you can find instructions for here:
https://matrix-xmpp.io/docs/install-from-nuget/


They should go soon to Nuget as well. But we have not decided yet on the package name. Because this should also replace all legacy MatriX packages in the future.
With the replacement of DotNetty a major redesign was required. Which means the API also changed a bit. You cannot just replace the library. I suggest to take a look at the code and samples as well.

Alex
This post was edited on 2021-11-30, 11:04 by Alex.
pcharlton@carbonlabs.co.uk #5
Member since Nov 2019 · 12 posts
Group memberships: Members
Show profile · Link to this post
np - thank you for your help!
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Forum: MatriX RSS