Groups | Blog | Home
all groups > dotnet remoting > may 2005 >

dotnet remoting : remoting - nasty bug?


David Krmpotic
5/6/2005 12:00:00 AM
In specific (repeatable) cases the client fails to connect to the server
running on the same machine. The client receives the
System.Net.Sockets.SocketException: "A socket operation was attempted to an
unreachable host" although the server is still running and listening on the
right port (45326 my case).

This happens when LAN (or internet) connection is present upon starting the
server and then desactivated (cable is removed). After LAN is no accessible,
the client cannot connect to the server anymore (note that they are on the
same machine!). When the cable is reinserted, the connection works again!

On the other side if server is started when LAN is not present, it will work
no matter what.

I put more details here:

http://www.david13.com/cases/DotNet/Remoting-BUG-Server-Inaccessible-From-Local-Machine/

I would kindly ask you to check it and help me with advice so we can confirm
a bug or find a solution together. Thank you very much!

PS: I noticed the same behaviour for example on Pocket PC emulator.. when
the LAN cable is unplugged, it cannot longer access shared folders that are
on the same computer as the emulator is running.

David Krmpotic
http://www.david13.com

Sergey Radkevich
5/7/2005 12:00:00 AM
[quoted text, click to view]
anymore (note that they are on the
same machine!). When the cable is reinserted, the connection works again!

One possible solution is to install loopback network adapter.

David Krmpotic
5/7/2005 12:00:00 AM
Ohhh great! Now I'm getting somewhere..

- So I guess that's not a bug, but it is predictable, right?
- now everybody that uses my programs which are affected by this have to
manually install this loopback adapter?
- what's the best IP address to set for the loopback adapter and how do I
determine this in each case?
- you said this is one possible solution.. what would be the others?

Thank you so much!
Spasiba! :)



[quoted text, click to view]

Sergey Radkevich
5/7/2005 12:00:00 AM
[quoted text, click to view]

I have just tried to reproduce it, and was unable to reproduce this
situation
(Connection always work with or without loopback adapter and with or without
network connection
even if I unplug cable between calls to localhost server object)

So, I was wrong in my assumption and don't know the real reason.
Nonetheless loopback adapter may help (Have you tried it?)

[quoted text, click to view]

The installation process can be automated...
But you are right - remoting should be easy to use, so probably a better
solution exists.

[quoted text, click to view]

It is possible to configure loopback adapter in the same way as any other
network adapters.
When you install them you can specify any address manually,
or use automatically configured ip address

There is also exist ways to programmatically enumerate network adapters from
..NET,
but for this task them should be choosen automatically.

[quoted text, click to view]

It is possible configure another type of [nonstandart] channel which doesn't
use packets
(in the internet there are examples of channels which use named pipes, raw
files, shared memory and other mechanisms of interprocess communications)

[quoted text, click to view]
Pozhalujsta! :)


Sergey Radkevich
5/8/2005 12:00:00 AM
[quoted text, click to view]

Currently I think we need to investigate Alex Passos's idea (about incorrect
name resolution)

[quoted text, click to view]

The reason to check is following:
at this moment telnet uses new name resolution scheme (which is occurs after
disconnection),
but client still use old IP address (which was before disconnection)

[quoted text, click to view]

It might be a problem with a whole network configuration
(If you are in domain, then chances are good
that for some aspects all machines behave in the same way)

Please provide the following information at your page with problem
description:
- source code of client application
- dump from "ipconfig /all" command
- content of HOSTS file
- dump from "route print" command
- dump from "ping localhost" and "tracert localhost" commands in
disconnected state
(but "telnet localhost 45326" works so disconnection it is not a problem)
- dump from "nslookup" utility




HOSTS file is located in "%SystemRoot%\system32\drivers\etc" for WindowsNT
family

The following types of problems can occur because of errors related to the
HOSTS file:
- The HOSTS file or the DNS server does not contain the particular host
name.
- The host name in the HOSTS file or in the command is misspelled or uses
different capitalization.
(Note: Host names are case-sensitive.)
- An invalid IP address is entered for the host name in the HOSTS file.
- The HOSTS file contains multiple entries for the same host on separate
lines; if so, the first entry is the one that is used.
- A mapping for a computer name-to-IP-address was mistakenly added to the
HOSTS file (rather than LMHOSTS).
- Last line should ends with carriage return symbol (see KB105998)

The correct format of the file is the following: "IP Address" "Friendly
Name"
For example:
127.0.0.1 localhost # Remarks are denoted with a #.

"ipconfig /flushdns" can be used to clear client name resolution cache






Next thing to check is packet routing (route print)

The resolved IP address is passed to the IP routing component. The routing
component returns either a routing error because a route was not found for
the destination IP address or the forwarding IP address and interface over
which the packet is to be forwarded cannot be found.






About channels I have found following quotes from various sources:

There are various considerations while writing a channel. They include a
balance of performance, scalability and implementation complexity.
Performance of a shared memory implementation would be certainly better than
named pipes. But issues when synchronizing between between reader/writers
could lead to scalibility concerns, especially with multiple clients. Named
Pipes provide good mix of both perf and scalability as compared to the TCP
channel.

Remoting in v2.0 of the framework is introducing a new IPC Channel meant for
x-proc communication on the same machine. It is based on named pipes and
works on win2k based platforms (win2k, winxp, win2k3). It will provide
better performance characteristics than the current TCP channel. It will
also provide a way to control access to the underlying pipe, so that the
server can limit the access to a specific group. As with the new TCP channel
it also supports authentication and impersonation of client identities.

For Framework 1.1 you can try
http://www.gotdotnet.com/Community/UserSamples/Details.aspx?SampleGuid=43a1ef11-c57c-45c7-a67f-ed68978f3d6d
(I have not tried it myself)





[quoted text, click to view]

Horosho, spasibo. Zavtra moj 27-j denx rozhdeniya :)
Fine, thanks. I am going to celebrate my 27-th birthday anniversary tommorow
:)

[quoted text, click to view]

I visited your homepage and was amused by number of languages which you are
learning :)

David Krmpotic
5/8/2005 12:00:00 AM
Thank you for your effort... I discovered something important..

The problem only arises when you get the reference from the SAO to some
MarshaledByRef object on the server.

I wrote a simple example.. here
http://www.david13.com/cases/DotNet/Remoting-BUG-Server-Inaccessible-From-Local-Machine/LANCableProblemReproduction.zip

just start the server.exe with LAN cable plugged in, run the client.exe and
observe that it works.. then unplug the cable and try to run the client
again.. it shouldn't run... now plug the cable back in and run the client
again.. it works without restarting the server..

So.. you will see from the example what I am trying to do.. I use the same
technique in two of my programs.. but for different reasons.. the sample I
am sending is for some simple notes.. please tell me if what I am doing is a
bad practice or not, but even more important - tell me if this behaviour is
normal or not..

I've seen some peole experience the same problem, but nobody found a good
solution for it.. or at least they didn't post it / or I can't find it!!

=====[not related to the problem]===========================================
S dniom razhdjenia! (hehe I found that one on some web page..)
cool! where are you from exactly.. maybe we can chat about all that
privately once we solve the problem (thank you for helping me out again!!)
oh about languages... :) it is very rewarding.. I hope I'll have more time
in the future to learn a few more languages. that would be cool!
Russian is not very far from my language - Slovenian!


[quoted text, click to view]

David Krmpotic
5/8/2005 2:35:27 AM
[quoted text, click to view]

I suspect you are doing this: you started the server when the cable was
unplugged... yes, then you won't have that problem.. start it with LAN cable
plugged in and then remove it!

[quoted text, click to view]

yes I tried it and it does help!

[quoted text, click to view]

hmmm.. I really don't know about a better solution... I lost all hope...
until now.. this is an acceptable solution... if nothing else, it works!!!
:)

[quoted text, click to view]

I have to specify it manually, so the client at the machine with the server
can reference the server through this address.. it only works then (I tried
it). if I continue to reference it with the machine name or "localhost",
then it continues to produce the same behaviour no matter that the loopback
is present.

[quoted text, click to view]

cool! I just hope it can be done in a way that makes it transparent.. I mean
that the result is that SAOs see all the messages the same (being normal
TCPIP or shared memory ones ....).. you know what I mean.

[quoted text, click to view]

Kakva pozivljajete?

oh yes, I will learn russian some day :))

mdb
5/10/2005 1:45:03 PM
"David Krmpotic" <david.krmpotic@no-no.si> wrote in
news:jH4fe.11973$F6.2430364@news.siol.net:
[quoted text, click to view]

Another possible solution, if you can wait for .NET 2.0, is to use the IPC
channel instead of a tcp channel.

David Krmpotic
5/12/2005 9:31:09 PM
yes.. this is for local thing.. what about the network?

ok... thank you all (especially Sergey)!! I will hopefully have some time
tomorrow and I'll update the info on my web page on what I know currently..
If nothing else, now I have a pretty good work-around with loopback
adapter!!




[quoted text, click to view]

Sergey Radkevich
5/13/2005 12:00:00 AM
[quoted text, click to view]

You can use "localhost" and it should work with both local and remote
clients,
but I don't test it. (I beg your pardon for my english if I mislead your)

====
I received your private mail, will answer a little bit later.

David Krmpotic
5/20/2005 12:14:57 AM
Sergey, thank you again!

And I updated my problem description at
http://www.david13.com/cases/DotNet/Remoting-BUG-Server-Inaccessible-From-Local-Machine/

so... now everybody can solve the problem reasonably well...


bye for now !

[quoted text, click to view]

AddThis Social Bookmark Button