We are using Rebex HTTPS Legacy 2019R3.3 in different Windows Embedded Handheld 6.5.3 devices. When receiving data for a longer period we get a TlsException on each request after nearly 2 minutes.
Here is the Rebex log of a sample request:
2020-01-27 21:46:23 DEBUG HttpRequest(14) HTTP: Using cached HTTP session (6) provided by Rebex.Net.HttpRequestCreator(1).
2020-01-27 21:46:23 INFO HttpRequest(14) HTTP: Sending request: GET [our query string]
2020-01-27 21:46:23 DEBUG HttpRequest(14) HTTP: PreAuthenticate: False
2020-01-27 21:46:23 DEBUG HttpRequest(14) HTTP: Request Connection: keep-alive.
2020-01-27 21:46:23 DEBUG HttpRequest(14) HTTP: Sending request (356 bytes).
2020-01-27 21:46:23 VERBOSE HttpRequest(14) TLS: Sent TLS packet:
2020-01-27 21:46:23 VERBOSE HttpRequest(14) HTTP: Raw data:
2020-01-27 21:46:31 VERBOSE HttpRequest(14) TLS: Received TLS packet:
2020-01-27 21:46:31 VERBOSE HttpRequest(14) HTTP: Received data:
2020-01-27 21:46:31 INFO HttpRequest(14) HTTP: Received response: 200 OK.
2020-01-27 21:46:31 DEBUG HttpRequest(14) HTTP: Received 11 headers.
2020-01-27 21:46:31 DEBUG HttpRequest(14) HTTP: Response Content-Length not specified.
2020-01-27 21:46:31 DEBUG HttpRequest(14) HTTP: Response Connection: keep-alive.
2020-01-27 21:46:31 DEBUG HttpRequest(14) HTTP: Response Content-Encoding: gzip.
2020-01-27 21:46:31 DEBUG HttpRequest(14) HTTP: Response Transfer-Encoding: chunked.
[repeating patterns of “HTTP: Received data” and “TLS: Received TLS packet”]
2020-01-27 21:48:05 DEBUG HttpRequest(14) TLS: TLS socket error, 2024 bytes of data were received.
2020-01-27 21:48:05 DEBUG HttpRequest(14) TLS: Error while processing TLS packet: System.Net.Sockets.SocketException: Eine vorhandene Verbindung wurde vom Remotehost geschlossen
2020-01-27 21:48:05 INFO HttpRequest(14) TLS: Alert Alert:Alert was sent.
2020-01-27 21:48:05 VERBOSE HttpRequest(14) TLS: Sent TLS packet:
2020-01-27 21:48:05 ERROR HttpRequest(14) HTTP: Error while reading response: Rebex.Net.TlsException: Connection was closed by the remote connection end. ---> System.Net.Sockets.SocketException: Eine vorhandene Verbindung wurde vom Remotehost geschlossen
2020-01-27 21:48:05 DEBUG HttpRequest(14) HTTP: Closing response stream.
2020-01-27 21:48:05 DEBUG HttpRequest(14) TLS: Closing TLS socket.
2020-01-27 21:48:05 DEBUG HttpRequest(14) HTTP: Closing HTTP session (6).
Here is the exception stack for SocketException caught internally:
2020-01-27 21:46:05 DEBUG HttpRequest(11)[-1294189126] TLS: Error while processing TLS packet: System.Net.Sockets.SocketException: Eine vorhandene Verbindung wurde vom Remotehost geschlossen
at System.Net.Sockets.Socket.ReceiveNoCheck(Byte[] buffer, Int32 index, Int32 request, SocketFlags socketFlags)
at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
at xtwc.Receive(Byte[] buffer, Int32 offset, Int32 count, SocketFlags socketFlags)
at Rebex.Net.ProxySocket.Receive(Byte[] buffer, Int32 offset, Int32 count, SocketFlags socketFlags)
at xubb.krpl(Int32 atp)
at xubb.krpm()
at xubb.krpn()
at Rebex.Net.TlsSocket.Poll(Int32 microSeconds, SocketSelectMode mode)
at Rebex.Net.TlsSocket.Rebex.Net.ISimpleSocket.Poll(Int32 microSeconds)
at qhiw.aybz(Byte[] df, Int32 dg, Int32 dh)
at qhiw.Receive(Byte[] buffer, Int32 offset, Int32 count)
at qhiu.rgvl(Byte[] cw, Int32 cx, Int32 cy)
at qhiu.rgvh(Byte[] cs, Int32 ct, Int32 cu)
at qhiu.Read(Byte[] buffer, Int32 offset, Int32 count)
at qhjx.Read(Byte[] buffer, Int32 offset, Int32 count)
at qhjy.noxc.fcec()
at qhjy.vuvj[a](Func`1 qv)
at qhjy.Read(Byte[] buffer, Int32 offset, Int32 count)
at System.IO.StreamReader.ReadBuffer()
at System.IO.StreamReader.Read()
at Newtonsoft.Json.JsonTextReader.MoveNext()
at [our code]
On the server side we see, that nginx served the request with a HTTP status 200 (OK) after 6 or 7 seconds.
As the devices are slow receiving and processing the data, could the TlsException be masking a timeout?
Should we get a different exception here?
In this sample the HttpSessionCacheTimeout was set to 5 minutes, but the excption is also thrown with HttpSessionCacheEnabled = false.