G
Guest
Hello,
We have an application which communicates using remoting. There is a server
which is a Windows Service. The server exposes an object which is a
singleton. The client is a Web Application which makes calls to the service.
We are using tcp channel which is using binaryformatter by default. The
problem is that after a certain number of remoting calls the calls dont get
through to the server. The client application makes the call and hangs up.
The call never reaches the service. The initial calls get through. Earlier we
used http channel. Then the problem was worse. The client could not make more
than 20 calls. Now it hangs up after about 100 or so calls if made
sucessively. We had come to conclusion that it is some threadpool issue as we
observed that after some time the thread count goes high. The observation in
case of both http and tcp was that if the thread count crosses a certain
limit, the server does not accept more calls. If the calls don't come
successively, ie with in a short amount of time, the service does accept
calls. I believe this is not a synchronization problem as we have use sync
objects to protect in remoting calls. Also another point in this favor is
that the same code hangs up earlier with http channel.
The configuration for remote server is
<system.runtime.remoting>
<application>
<service>
<wellknown mode="Singleton" displayName="*****"
type="***.***,Service.exe" objectUri="***.rem" />
</service>
<channels>
<channel ref="tcp" port="1978"></channel>
</channels>
</application>
</system.runtime.remoting>
// This is in the shared assembly
public __gc __interface IInterface
{
virtual System::String* Request(System::String* a_pRequest) = 0;
};
// This is in an assembly with the service
public __gc class CInterface : public IInterface, public
System::MarshalByRefObject
{
public:
// Singleton Pattern applied
virtual System::String* Request(System::String* a_pRequest) {
privateLock(); Process(); privateUnLock();
System::GC::Collect(); // After ading this we get to process more calls
return "****" };
virtual System::Object* InitializeLifetimeService() {return 0;};
void privateRegisterForRemoting()
{
try
{
System::Runtime::Remoting::RemotingConfiguration::Configure(System::AppDomain::CurrentDomain->SetupInformation->ConfigurationFile);
System::Runtime::Remoting::RemotingServices::Marshal(this, "***.rem");
}
catch(System::Exception* a_pException)
{
WRITETOSYSTEMLOG(a_pException);
}
};
What could be the problem and how can this be addressed? We strongly think
this is some threadpool issue. Or there may be some problem the way we use
remoting.
We can change it to singlecall if needed, but first we want to check the issue
We have an application which communicates using remoting. There is a server
which is a Windows Service. The server exposes an object which is a
singleton. The client is a Web Application which makes calls to the service.
We are using tcp channel which is using binaryformatter by default. The
problem is that after a certain number of remoting calls the calls dont get
through to the server. The client application makes the call and hangs up.
The call never reaches the service. The initial calls get through. Earlier we
used http channel. Then the problem was worse. The client could not make more
than 20 calls. Now it hangs up after about 100 or so calls if made
sucessively. We had come to conclusion that it is some threadpool issue as we
observed that after some time the thread count goes high. The observation in
case of both http and tcp was that if the thread count crosses a certain
limit, the server does not accept more calls. If the calls don't come
successively, ie with in a short amount of time, the service does accept
calls. I believe this is not a synchronization problem as we have use sync
objects to protect in remoting calls. Also another point in this favor is
that the same code hangs up earlier with http channel.
The configuration for remote server is
<system.runtime.remoting>
<application>
<service>
<wellknown mode="Singleton" displayName="*****"
type="***.***,Service.exe" objectUri="***.rem" />
</service>
<channels>
<channel ref="tcp" port="1978"></channel>
</channels>
</application>
</system.runtime.remoting>
// This is in the shared assembly
public __gc __interface IInterface
{
virtual System::String* Request(System::String* a_pRequest) = 0;
};
// This is in an assembly with the service
public __gc class CInterface : public IInterface, public
System::MarshalByRefObject
{
public:
// Singleton Pattern applied
virtual System::String* Request(System::String* a_pRequest) {
privateLock(); Process(); privateUnLock();
System::GC::Collect(); // After ading this we get to process more calls
return "****" };
virtual System::Object* InitializeLifetimeService() {return 0;};
void privateRegisterForRemoting()
{
try
{
System::Runtime::Remoting::RemotingConfiguration::Configure(System::AppDomain::CurrentDomain->SetupInformation->ConfigurationFile);
System::Runtime::Remoting::RemotingServices::Marshal(this, "***.rem");
}
catch(System::Exception* a_pException)
{
WRITETOSYSTEMLOG(a_pException);
}
};
What could be the problem and how can this be addressed? We strongly think
this is some threadpool issue. Or there may be some problem the way we use
remoting.
We can change it to singlecall if needed, but first we want to check the issue