For a deeper look into our Elektron API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
18 2 2 3

Websocket C# client Exception "An exception has occurred while receiving. (1006 Abnormal)"

Hi Team

We are observing some exception in websocket client application (Error "An exception has occurred while receiving. (1006 Abnormal)")
In order to recover from this issue , we need to bounce the application.

Application logs

2021-09-14 10:24:21,722 [121] INFO : MarketDataLog - WebSocket (ny1-cld-ws-ct.am.hedani.net) was closed: An exception has occurred while receiving. (1006 Abnormal)
2021-09-14 10:24:21,722 [121] INFO : MarketDataLog - MarketDataConnectionStatusChange ConnectionDown: Connection down
2021-09-14 10:24:21,723 [335] INFO : MarketDataLog - Connecting to WebSocket ws://ny1-cld-ws-ct.am.hedani.net:15000/WebSocket
2021-09-14 10:24:21,729 [335] INFO : MarketDataLog - Connected to ny1-cld-ws-ct.am.hedani.net
2021-09-14 10:24:21,729 [335] INFO : MarketDataLog - MarketDataConnectionStatusChange ConnectionUp: Connection up. Host=ny1-cld-ws-ct.am.hedani.net Position=169.254.1.222 User=559_mavenserver_0 Appid=559
2021-09-14 10:24:21,729 [335] INFO : MarketDataLog - Attempting login for 559_mavenserver_0 [appid = 559]
2021-09-14 10:24:21,735 [121] INFO : MarketDataLog - Reconnected to new WebSocket so redoing all subscriptions

2021-09-14 10:24:34,217 [181] INFO : MarketDataLog - MarketDataAdapter.Unsubscribe PI_L1_INT|CPSL3|FieldList|0
2021-09-14 10:24:34,334 [211] INFO : MarketDataLog - WebSocket (ny1-cld-ws-ct.am.hedani.net) was closed: An exception has occurred while receiving. (1006 Abnormal)
2021-09-14 10:24:34,335 [211] INFO : MarketDataLog - MarketDataConnectionStatusChange ConnectionDown: Connection down
2021-09-14 10:24:34,335 [24] INFO : Gcl.DataSources.Triarch.TriarchDataSource - Market data connection is down
2021-09-14 10:24:34,335 [152] INFO : MarketDataLog - Connecting to WebSocket ws://ny1-cld-ws-ct.am.hedani.net:15000/WebSocket

2021-09-14 10:24:34,342 [295] INFO : MarketDataLog - Unsubscribing 37139 PI_L1_INT|SITM.O|FieldList|0
2021-09-14 10:24:34,342 [295] ERROR: MarketDataLog - Received Error: An error has occurred in sending data.
2021-09-14 10:24:34,342 [121] INFO : MarketDataLog - WebSocket (ny1-cld-ws-ct.am.hedani.net) was closed: An exception has occurred while receiving. (1006 Abnormal)
2021-09-14 10:24:34,342 [121] INFO : MarketDataLog - MarketDataConnectionStatusChange ConnectionDown: Connection down
2021-09-14 10:24:34,342 [121] INFO : MarketDataLog - Connecting to WebSocket ws://ny2-cld-ws-ct.am.hedani.net:15000/WebSocket
2021-09-14 10:24:34,338 [152] INFO : MarketDataLog - Connected to ny1-cld-ws-ct.am.hedani.net
2021-09-14 10:24:34,342 [152] INFO : MarketDataLog - MarketDataConnectionStatusChange ConnectionUp: Connection up. Host=ny1-cld-ws-ct.am.hedani.net Position=169.254.1.222 User=559_mavenserver_0 Appid=559
2021-09-14 10:24:34,342 [152] INFO : MarketDataLog - Attempting login for 559_mavenserver_0 [appid = 559]
2021-09-14 10:24:34,342 [152] ERROR: MarketDataLog - Received Error: An error has occurred in sending data.

2021-09-14 10:24:34,353 [24] INFO : Gcl.DataSources.Triarch.TriarchDataSource - Sending stale message for PI_L1_INT CLLDY
2021-09-14 10:24:34,353 [24] INFO : Gcl.DataSources.Triarch.TriarchDataSource - Sending stale message for PI_L1_INT SAWAD/F
2021-09-14 10:24:34,353 [24] INFO : Gcl.DataSources.Triarch.TriarchDataSource - Sending stale message for PI_L1_INT TGNA
2021-09-14 10:24:34,353 [181] INFO : MarketDataLog - WebSocket (ny2-cld-ws-ct.am.hedani.net) was closed: An exception has occurred while receiving. (1006 Abnormal)
2021-09-14 10:24:34,353 [181] INFO : MarketDataLog - MarketDataConnectionStatusChange ConnectionDown: Connection down
2021-09-14 10:24:34,353 [181] ERROR: MarketDataLog - Unable to connect. No more hosts to try

ADS server logs for the same client for that Day

<uslp9019593.1.ads: Warning: Tue Sep 14 15:28:31.424217 2021> Output threshold OK for "559_mavenserver_0" at position "169.254.1.222" on host "" using application "559" on channel 54. Resuming normal operation.<END>
<uslp9019593.1.ads: Warning: Tue Sep 14 15:28:30.987627 2021> Output threshold breached for "559_mavenserver_0" at position "169.254.1.222" on host "" using application "559" on channel 54.<END>
<uslp9019594.1.ads: Warning: Tue Sep 14 10:24:28.680732 2021> Output threshold breached for "559_mavenserver_0" at position "169.254.1.222" on host "" using application "559" on channel 53.<END>
<uslp9019593.1.ads: Warning: Tue Sep 14 10:06:31.477451 2021> Output threshold breached for "559_mavenserver_0" at position "169.254.1.222" on host "" using application "559" on channel 49.<END>
<uslp9019593.1.ads: Warning: Tue Sep 14 09:46:15.228024 2021> Output threshold OK for "559_mavenserver_0" at position "169.254.1.222" on host "" using application "559" on channel 49. Resuming normal operation.<END>
<uslp9019593.1.ads: Warning: Tue Sep 14 09:46:15.124027 2021> Output threshold breached for "559_mavenserver_0" at position "169.254.1.222" on host "" using application "559" on channel 49.<END>

Our observation

It look like when the first time this error happened @10:24:21 , there were no buffer overflow at ADS
2021-09-14 10:24:21,722 [121] INFO : MarketDataLog - WebSocket (ny1-cld-ws-ct.am.hedani.net) was closed: An exception has occurred while receiving. (1006 Abnormal)

Later on application try to resubscribe all the instrument.
2021-09-14 10:24:21,735 [121] INFO : MarketDataLog - Reconnected to new WebSocket so redoing all subscriptions

Then I can see buffer overflow message at ADS side @10:24:28
<uslp9019594.1.ads: Warning: Tue Sep 14 10:24:28.680732 2021> Output threshold breached for "559_mavenserver_0" at position "169.254.1.222" on host "" using application "559" on channel 53.<END>

Wondering what could be reason for this error at first time ?

websocketsrrtorefinitiv-realtime-optimised
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

Upvotes
Accepted
45.2k 103 43 60

@vaibhav.sahu

I got the same error 1006 when I killed the ADS process.

Received Log Event (Level: Fatal): WebSocketSharp.WebSocketException: The header of a frame cannot be read from the stream.
   at WebSocketSharp.WebSocketFrame.processHeader(Byte[] header)
   at WebSocketSharp.WebSocketFrame.<>c__DisplayClassa.<readHeaderAsync>b__9(Byte[] bytes)
   at WebSocketSharp.Ext.<>c__DisplayClass9.<ReadBytesAsync>b__8(IAsyncResult ar)


WebSocket was closed: 1006, An exception has occurred while receiving., WebSocketSharp.CloseEventArgs

According to the WebSocket protocol, it indicates that the connection was closed abnormally.

      1006 is a reserved value and MUST NOT be set as a status code in a
      Close control frame by an endpoint.  It is designated for use in
      applications expecting a status code to indicate that the
      connection was closed abnormally, e.g., without sending or
      receiving a Close control frame.

If the ADS didn't close the connection, it could be a network issue.

You may check if there is any server, such as a firewall, used between the application and ADS.

You can also run the packet analyzer tools, such as Wireshark, or TCPDump to capture network activities. Then, we can analyze the network activities to verify which side causes the disconnection.


icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.