# SOAP4r, threads, and Windows ... the mystery

**URL:** <https://www.ruby-forum.com/t/soap4r-threads-and-windows-the-mystery/105004>\
**Category:** Ruby\
**Created:** [May 24, 2007, 9:10pm UTC](https://www.ruby-forum.com/t/soap4r-threads-and-windows-the-mystery/105004 "2007-05-24T21:10:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![snowdall](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/45deac/32.png) [@snowdall](https://www.ruby-forum.com/u/snowdall)\
**Post date:** [May 24, 2007, 9:10pm UTC](https://www.ruby-forum.com/t/soap4r-threads-and-windows-the-mystery/105004/1 "2007-05-24T21:10:50Z")

</div>

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/upload.tar](http://homepage.mac.com/snowdall/.Public/upload.tar)

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

---

<div class="post-metadata">

**Author:** ![snowdall](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/45deac/32.png) [@snowdall](https://www.ruby-forum.com/u/snowdall)\
**Post date:** [May 25, 2007, 9:21am UTC](https://www.ruby-forum.com/t/soap4r-threads-and-windows-the-mystery/105004/2 "2007-05-25T09:21:44Z")

</div>

Hi

> between the initiating machine and the remote machine running the batch  
> 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.

> To run it:  
> it works … trying Windows and it fails.
> 
> Good luck and thanks,  
> Snowdall

BR  
Phil
