[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

SOAP4r, threads, and Windows ... the mystery

Clark Snowdall

5/24/2007 7:11:00 PM

Hello,

I am part of a team developing a remote computing tool of sorts. My
part is to write the part that accesses a remote machine and dispatches
essentially a batch job on that machine and fetches the output from the
process. I have decided to use SOAP as the communication protocol.
Everything was well and good until we started tackling batch jobs on
remote machines that would last longer than the SOAP timeout.

I came up with a prototype that uses two SOAP servers to communicate
between the initiating machine and the remote machine running the batch
file. I then put the batch call into a thread and when it completes it
notifies the initiating machine through its SOAP server.

Here's where things get interesting. If both machines are Unix (I've
tested on FC6 and Mac OS X), everything works fine. But, if the remote
machine executing the batch file is Windows, then the SOAP call to
initiate the run of the batch thread blocks until that thread completes,
even though you can see execution PAST the thread start. And if the
batch file thread takes longer, then hte SOAP connection times out on
the client end. It sems that there is some issues in how SOAP and
thread execution are handled on Windows.

In the short term I was going to punt on this: capture the timeout error
and move on (as usual we have a product demo coming up). But I'd
eventually like a more elegant solution. I'm hoping someone else on
this list might have seen something like this before.

You can find the source of my prototype at:

http://homepage.mac.com/snowdall/.Public/...

To run it:
1. untar the package
2. in one terminal window cd into the directory and type "ruby
inner_wrapper_server.rb" to start the process that would be on the
remote machine
3. in another terminal window, cd into the directory and type "ruby
runner.rb" to start the process from the initiating machine.

The file core.rb represents what would be the remote batch file. The
set_input and get_output methods would be used to send input to the
batch file and get the output repsectively. Try running it on Unix and
it works ... trying Windows and it fails.

Good luck and thanks,
Snowdall

--
Posted via http://www.ruby-....

1 Answer

Phil Meier

5/25/2007 7:18:00 AM

0

Hi

> Hello,
>
> I am part of a team developing a remote computing tool of sorts. My
> part is to write the part that accesses a remote machine and dispatches
> essentially a batch job on that machine and fetches the output from the
> process. I have decided to use SOAP as the communication protocol.
> Everything was well and good until we started tackling batch jobs on
> remote machines that would last longer than the SOAP timeout.
>
> I came up with a prototype that uses two SOAP servers to communicate
> between the initiating machine and the remote machine running the batch
> file. I then put the batch call into a thread and when it completes it
> notifies the initiating machine through its SOAP server.
>
> Here's where things get interesting. If both machines are Unix (I've
> tested on FC6 and Mac OS X), everything works fine. But, if the remote
> machine executing the batch file is Windows, then the SOAP call to
> initiate the run of the batch thread blocks until that thread completes,
> even though you can see execution PAST the thread start. And if the
> batch file thread takes longer, then hte SOAP connection times out on
> the client end. It sems that there is some issues in how SOAP and
> thread execution are handled on Windows.

That's the point - threading in Ruby is done the "green threading" way.
It does not uses real windows threads.
Search for Ruby/Threading in this newsgroup and you will find many hints.

>
> In the short term I was going to punt on this: capture the timeout error
> and move on (as usual we have a product demo coming up). But I'd
> eventually like a more elegant solution. I'm hoping someone else on
> this list might have seen something like this before.
>
> You can find the source of my prototype at:
>
> http://homepage.mac.com/snowdall/.Public/...
>
> To run it:
> 1. untar the package
> 2. in one terminal window cd into the directory and type "ruby
> inner_wrapper_server.rb" to start the process that would be on the
> remote machine
> 3. in another terminal window, cd into the directory and type "ruby
> runner.rb" to start the process from the initiating machine.
>
> The file core.rb represents what would be the remote batch file. The
> set_input and get_output methods would be used to send input to the
> batch file and get the output repsectively. Try running it on Unix and
> it works ... trying Windows and it fails.
>
> Good luck and thanks,
> Snowdall
>

BR
Phil