-
Notifications
You must be signed in to change notification settings - Fork 151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NullReference while connecting to remote server via VPN #425
Comments
@Sergey-Terekhin , thanks for raising this issue. I did verify that locally the 0.11.0 client can connect to a NATS server v2.1.9. It's looking like the stream reader returned null, which indicates the connection was terminated before the stream reader could read the line. Are you going through a proxy or load balancer as well? Also, the stack looks different from the source. We don't have a source file named Connection.cs (but do have Conn.cs). Are you working with a modified client? https://github.com/nats-io/nats.net/blob/0.11.0/src/NATS.Client/Conn.cs#L3780 In 0.11.0 the |
There is an bug here where we need to gracefully throw a connection exception when the stream reader returns a null (indicating EOS). When this happens, we might also want to investigate a delay and retry of the read as no IOException has occurred. |
Custom exception and possible retries would be great - but previous package v. 0.10.1 works fine in same scenario
I showed decompiled stack - may be Resharper changed class name somehow - I don't know. But I definitely used unmodified client from NuGet :) Update 1: The main difference I see between 0.10.1 and 0.11.0 is the way to create Update 2: I've just replaced code to create "nats-client": {
"name": "notifications-service-russian-railways",
"servers": [ "nats://10.23.10.88:4222" ]
}, Not working code (Conn.cs line 380): client = new TcpClient(AddressFamily.InterNetworkV6);
client.Client.DualMode = true; Working code (Conn.cs line 377, 400-407 + UriExtensions.cs): client = createTcpClient(s.url);
...
private static TcpClient createTcpClient(Uri uri)
{
var interNetworkAddressFamily = uri.GetInterNetworkAddressFamily();
return interNetworkAddressFamily != null
? new TcpClient(interNetworkAddressFamily.Value)
: new TcpClient();
} May be old code with parsing server URL should be returned |
@Sergey-Terekhin Would you mind to try this patch? |
I believe this is resolved in #432. |
Closed as resolved in #432 |
Hello!
I have problem: with establishing connection with NATS server via VPN:
NullReferenceException
here:Nats client version: 0.11.0
Nats server: 2.1.9
I can see that TCP connection is established, but data can not be read from it...
Update: I seems to be a bug in the client v.0.11.0. I downgraded to the previous version (0.10.1) and was able to connect to the server
The text was updated successfully, but these errors were encountered: