Board index » delphi » TCPServer Active := false

TCPServer Active := false

I am resetting a server by setting active to false and the back to true.  I
get a couple of seconds wait and then a thread timeout exception after which
the disconnect event is called.  Any suggestions for why the server does not
seem to be able to terminate the active threads?  It also seems that after I
catch the exception and continue on the server is refusing new connections.

Thanks,
Jeff

 

Re:TCPServer Active := false


This is an often complained about bug that I believe exists in all 9.
versions. Tony Caduto reported that he thinks it only happens when there is
code in the "ondisconnect" event. I used code to terminate all connections
before stopping the server and it works fine. Tony said he put code in the
"ondisconnect" event to test whether it was shutting down or not. IIRC and
reported that that works. Take your pick. All I know.
Larry

Quote
"Jeff Shumate" <jbshum...@earthlink.net> wrote in message

news:3e72c949$1@newsgroups.borland.com...
Quote
> I am resetting a server by setting active to false and the back to true.
I
> get a couple of seconds wait and then a thread timeout exception after
which
> the disconnect event is called.  Any suggestions for why the server does
not
> seem to be able to terminate the active threads?  It also seems that after
I
> catch the exception and continue on the server is refusing new
connections.

> Thanks,
> Jeff

Re:TCPServer Active := false


Thanks for the feedback.  I believe I already tried both of these.  I
eliminated the onDisconnect event as a test since the only side effect would
be a memory leak and the problem was still there.  I also tried terminating
the connections, but do not remember exactly what code I used to do this.
Whatever it was it did not work.  Could you be more specific about your
method?

Thanks,
Jeff

Quote
"LClark" <LCl...@Bytewiser.com> wrote in message

news:3e734af2@newsgroups.borland.com...
Quote
> This is an often complained about bug that I believe exists in all 9.
> versions. Tony Caduto reported that he thinks it only happens when there
is
> code in the "ondisconnect" event. I used code to terminate all connections
> before stopping the server and it works fine. Tony said he put code in the
> "ondisconnect" event to test whether it was shutting down or not. IIRC and
> reported that that works. Take your pick. All I know.
> Larry

> "Jeff Shumate" <jbshum...@earthlink.net> wrote in message
> news:3e72c949$1@newsgroups.borland.com...
> > I am resetting a server by setting active to false and the back to true.
> I
> > get a couple of seconds wait and then a thread timeout exception after
> which
> > the disconnect event is called.  Any suggestions for why the server does
> not
> > seem to be able to terminate the active threads?  It also seems that
after
> I
> > catch the exception and continue on the server is refusing new
> connections.

> > Thanks,
> > Jeff

Re:TCPServer Active := false


Yet more info.  I went back and reconstructed how I was terminating the
threads.  It looks like I was making a call to
threadManager.TerminateThreads.  I  just stepped through that function and
found that it is empty.  I am using the default thread manager.  I will try
looking to see if any of the decendants implement  this function.  If you
have any suggestions they would be appreciated.

Thanks,
Jeff

Quote
"JeffS" <j...@vortic.com> wrote in message

news:3e735d96$1@newsgroups.borland.com...
Quote
> Thanks for the feedback.  I believe I already tried both of these.  I
> eliminated the onDisconnect event as a test since the only side effect
would
> be a memory leak and the problem was still there.  I also tried
terminating
> the connections, but do not remember exactly what code I used to do this.
> Whatever it was it did not work.  Could you be more specific about your
> method?

> Thanks,
> Jeff

> "LClark" <LCl...@Bytewiser.com> wrote in message
> news:3e734af2@newsgroups.borland.com...
> > This is an often complained about bug that I believe exists in all 9.
> > versions. Tony Caduto reported that he thinks it only happens when there
> is
> > code in the "ondisconnect" event. I used code to terminate all
connections
> > before stopping the server and it works fine. Tony said he put code in
the
> > "ondisconnect" event to test whether it was shutting down or not. IIRC
and
> > reported that that works. Take your pick. All I know.
> > Larry

> > "Jeff Shumate" <jbshum...@earthlink.net> wrote in message
> > news:3e72c949$1@newsgroups.borland.com...
> > > I am resetting a server by setting active to false and the back to
true.
> > I
> > > get a couple of seconds wait and then a thread timeout exception after
> > which
> > > the disconnect event is called.  Any suggestions for why the server
does
> > not
> > > seem to be able to terminate the active threads?  It also seems that
> after
> > I
> > > catch the exception and continue on the server is refusing new
> > connections.

> > > Thanks,
> > > Jeff

Re:TCPServer Active := false


I might as well beat this to death.  Having stepped through the code
multiple times I am convinced that the disconnect is happening since the
client recognizes it immediately.  The bug seems to be in the code cleaning
up the threads.  If I had to guess I would say there is a deadlock on a
critical section controlling the thread list.  If this is true then
terminating the threads individually while the server is active is just
swapping a deadlock for a race.  If a new client connects between the  code
that terminates the threads and Server.Active becoming false you are right
back where you started.

Unless I am missing something it would seem that the only way to insure that
the server resets cleanly under all conditions in the face of this bug would
be to destroy and recreate it.  This is a solution I don't look forward to
since I went to all the trouble of making my server a design time component.
If anyone with a better understanding of the architecture than me can give
me an alternative I would certainly appreciate it.

Quote
"JeffS" <j...@vortic.com> wrote in message

news:3e73600a$1@newsgroups.borland.com...
Quote
> Yet more info.  I went back and reconstructed how I was terminating the
> threads.  It looks like I was making a call to
> threadManager.TerminateThreads.  I  just stepped through that function and
> found that it is empty.  I am using the default thread manager.  I will
try
> looking to see if any of the decendants implement  this function.  If you
> have any suggestions they would be appreciated.

> Thanks,
> Jeff

> "JeffS" <j...@vortic.com> wrote in message
> news:3e735d96$1@newsgroups.borland.com...
> > Thanks for the feedback.  I believe I already tried both of these.  I
> > eliminated the onDisconnect event as a test since the only side effect
> would
> > be a memory leak and the problem was still there.  I also tried
> terminating
> > the connections, but do not remember exactly what code I used to do
this.
> > Whatever it was it did not work.  Could you be more specific about your
> > method?

> > Thanks,
> > Jeff

> > "LClark" <LCl...@Bytewiser.com> wrote in message
> > news:3e734af2@newsgroups.borland.com...
> > > This is an often complained about bug that I believe exists in all 9.
> > > versions. Tony Caduto reported that he thinks it only happens when
there
> > is
> > > code in the "ondisconnect" event. I used code to terminate all
> connections
> > > before stopping the server and it works fine. Tony said he put code in
> the
> > > "ondisconnect" event to test whether it was shutting down or not. IIRC
> and
> > > reported that that works. Take your pick. All I know.
> > > Larry

> > > "Jeff Shumate" <jbshum...@earthlink.net> wrote in message
> > > news:3e72c949$1@newsgroups.borland.com...
> > > > I am resetting a server by setting active to false and the back to
> true.
> > > I
> > > > get a couple of seconds wait and then a thread timeout exception
after
> > > which
> > > > the disconnect event is called.  Any suggestions for why the server
> does
> > > not
> > > > seem to be able to terminate the active threads?  It also seems that
> > after
> > > I
> > > > catch the exception and continue on the server is refusing new
> > > connections.

> > > > Thanks,
> > > > Jeff

Re:TCPServer Active := false


Now this is just getting weird.  Since my server is at heart a chat server I
went to the demos directory and compiled the chat server demo and ran it.
After telnetting to it to create a client connection I hit the disconnect
button which sets the active property to false and I get the exact same
error I was getting from my code.  Since I am sure this demo has been tested
many times, by many different people I have to assume their is something
going on with my installation.

I am running D6 and  Indy 9 anyone with any suggestions?  If anyone has run
the chat server demo in this configuration with success I would love to know
that to.

Thanks,
Jeff

Quote
"LClark" <LCl...@Bytewiser.com> wrote in message

news:3e734af2@newsgroups.borland.com...
Quote
> This is an often complained about bug that I believe exists in all 9.
> versions. Tony Caduto reported that he thinks it only happens when there
is
> code in the "ondisconnect" event. I used code to terminate all connections
> before stopping the server and it works fine. Tony said he put code in the
> "ondisconnect" event to test whether it was shutting down or not. IIRC and
> reported that that works. Take your pick. All I know.
> Larry

> "Jeff Shumate" <jbshum...@earthlink.net> wrote in message
> news:3e72c949$1@newsgroups.borland.com...
> > I am resetting a server by setting active to false and the back to true.
> I
> > get a couple of seconds wait and then a thread timeout exception after
> which
> > the disconnect event is called.  Any suggestions for why the server does
> not
> > seem to be able to terminate the active threads?  It also seems that
after
> I
> > catch the exception and continue on the server is refusing new
> connections.

> > Thanks,
> > Jeff

Other Threads