Not logged in. · Lost password · Register
Forum: MatriX RSS
Matrix goes boom trying to send keep-alive on dead connection
Avatar
nullable #1
Member since Mar 2018 · 8 posts
Group memberships: Members
Show profile · Link to this post
Subject: Unhandled exception
Greetings!
I'm evaluating Matrix and found an issue I want to share with you.
I'm developing a library which uses Matrix websockets.

The problem at hand is a built-in keep-alive mechanism which periodically sends a space character over the websocket.
The xmpp server do not like this at all and responds with
  1. <stream:error xmlns:stream='http://etherx.jabber.org/streams'><xml-not-well-formed xmlns='urn:ietf:params:xml:ns:xmpp-streams'></xml-not-well-formed></stream:error>
and closes the connection.
Even though the connection is closed Matrix tries to send another keep-alive, space, character, which results in a application crash.

Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
   at Matrix.Net.WebSocket.Send(Byte[] bData)
   at Matrix.XmppStream.SendData(String xml)
   at Matrix.XmppStream.Send(String xml)
   at Matrix.XmppStream.KeepAliveTick(Object state)
   at System.Threading.TimerQueueTimer.CallCallbackInContext(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.TimerQueueTimer.CallCallback()
   at System.Threading.TimerQueueTimer.Fire()
   at System.Threading.TimerQueue.FireNextTimers()
   at System.Threading.TimerQueue.AppDomainTimerCallback()

Edit: I'm using Matrix SDK 2.1.0.3
This post was edited on 2018-03-15, 09:38 by Alex.
Avatar
Alex #2
Member since Feb 2003 · 4327 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Please set the KeepAliveInterval to -1 to disable keep alive packets.
We can add something in a future release to make sure they never get sent on a websocket connection, regardless what the KeepAlive setting is.
Avatar
nullable #3
Member since Mar 2018 · 8 posts
Group memberships: Members
Show profile · Link to this post
Brilliant!
Works like a charm, much apreciated!
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