471,354 Members | 1,170 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,354 software developers and data experts.

Threading locks with remoting

I have a project where we have a windows service that creates a
remoting object for an external client application to communicate with
using ipc. We've discovered the client is making updates to the class
fields by calling the update methods in the remoting object class and
while thats not an issue I'm curious about threading with remote calls.

I can't find much in the way of what threading issues can occur. If
the service's thread (which instantiates the remoting class) calls
method A() through a proxy class attained through
Activator.GetObject() while the client calls method A(). Does the
proxy class returned by Activator.GetObject have any thread safety to
it, being that it's dealing with two objects (client and server) that
are possible callers, or do I need to add my own thread safety code to
the class?

Is it possible to lead to a deadlock via a remote call and if so would
the remote call ever terminate or would that lead to a system issue
requiring a reboot?

Dec 20 '05 #1
2 3845
Greg,

I would imagine that the proxy itself would be thread-safe. I can't
guarantee this, but I would imagine that the proxy is just sending messages
to the server, which doesn't require a good deal of shared state (at least,
updating it at the same time).

However, on the server side, if you are using a singleton instance, then
you have to worry about thread safety on the instance that is created.
That's where you will have to pay attention.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<gr***********@gmail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
I have a project where we have a windows service that creates a
remoting object for an external client application to communicate with
using ipc. We've discovered the client is making updates to the class
fields by calling the update methods in the remoting object class and
while thats not an issue I'm curious about threading with remote calls.

I can't find much in the way of what threading issues can occur. If
the service's thread (which instantiates the remoting class) calls
method A() through a proxy class attained through
Activator.GetObject() while the client calls method A(). Does the
proxy class returned by Activator.GetObject have any thread safety to
it, being that it's dealing with two objects (client and server) that
are possible callers, or do I need to add my own thread safety code to
the class?

Is it possible to lead to a deadlock via a remote call and if so would
the remote call ever terminate or would that lead to a system issue
requiring a reboot?

Dec 24 '05 #2
Testing showed us that the proxy code coming from multiple clients can
call the same remoted method with no thread safety and cause issues, so
I converted the remoted class to a singleton instance.

We managed to instance the remoted class in the server and get local
access to it's members via activator.getobject while getting another
instance lock using the client. Twice we were able to cause a stack
fault in the windows service (the server) by getting a deadlock. The
clients exception catch never even fired, the application simply died.

..NET 2 was nice in catching the lock from within the service and
brought me to the calling code in vs2005 which is a lot better than
what vs2003 was able to do for me.

Dec 24 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

12 posts views Thread by Gurpreet Sachdeva | last post: by
2 posts views Thread by Brad Quinn | last post: by
6 posts views Thread by Morten Snedker | last post: by
1 post views Thread by Antimon | last post: by
2 posts views Thread by WXS | last post: by
2 posts views Thread by danielhamd | last post: by
2 posts views Thread by =?Utf-8?B?TWljaGFlbCBNYWVz?= | last post: by
126 posts views Thread by Dann Corbit | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.