Lee Jenkins wrote:
> Lukas Gebauer wrote:
>>> I just tried 2006-09-12 (size: 722K) - release no. 37 and it has the
>>> same behavior unfortunately.  I also tried the dev snapshot:
>>>
>>> 2007-04-02 (size: 267K) - 38b5
>>>
>>> Which exhibited the same behavior.
>>>
>>> What else can I try?
>> Are you really sure, if problem is not in your added code? Are you 
>> syure if you have compiled with correct Synapse sources? (some 
>> similar bug has been corrected long time ago!)
>>
>>
> 
> Thanks for the help guys, I fixed it.  It's a good thing I never say 
> "its not my code"!.  I have to run out the door, but I will post back 
> what the problem was when I return.  Just don't want anyone wasting time 
> answering my post in the meantime.
> 
> 
> 

OK, sorry it took so long to get back.  I went out to the store and 
while I was out, I got the call that my wife was in an auto accident. 
She is fine.  Bad day for posting though...

I am using Rem Objects Pascal Script to run script services from a 
threaded TCP server.  Client connects to our server and then accepts 
commands from our server.  So, the client connects, we send a command 
and wait for a response, repeated often while the script runs.  The 
scripts written for the pascal script engine are actually making the 
required communication with the client.

When a client makes a call to the server, the server runs the script, 
the script sends commands to the client to execute.  The problem was 
when the client disconnected before the script ended.  The client 
disconnected, but the script kept trying to execute it's commands.  So 
now, it would send some string with SendString and the thread would then 
be blocked, while the SendString command tried to execute against an 
(now) invalid end point and hung.  CPU usage gets gobbled up.

To fix it:

Uptil now, I used a TThread decendent called TDTAGIHandler which itself 
creates a non-threaded object called TAGI to communicate with the client 
application  and can be accessed from within the scripts.  The TAGI 
constructor allows to pass a reference to a TSocket which it uses to 
with a TTCPBlockSocket.  I added a var reference parameter to the 
constructor that allowed me to pass a reference to the TDTAGIHandler to 
the TAGI.

AGI := TAGI.Create(sock, self);

Now when the AGI sends a command through synapse and LastError > 0, I 
now have a reference to the parent thread object, TDTAGIHandler, and 
call its terminate method upon error.  The script will usually attempt 
to try to send another command, but in every test I've done this 
afternoon, all destructors are being called and everything is now being 
freed.  I'll have to add log information from here is my guess...

If someone has a better way of handling this, I'd be grateful.

Thanks again,


-- 

Warm Regards,

Lee



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
synalist-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/synalist-public

Reply via email to