# Threading nightmare

**URL:** <https://www.ruby-forum.com/t/threading-nightmare/81631>\
**Category:** Rails\
**Created:** [January 10, 2007, 8:51pm UTC](https://www.ruby-forum.com/t/threading-nightmare/81631 "2007-01-10T20:51:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jimmy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ee59a6/32.png) [@jimmy](https://www.ruby-forum.com/u/jimmy)\
**Post date:** [January 10, 2007, 8:51pm UTC](https://www.ruby-forum.com/t/threading-nightmare/81631/1 "2007-01-10T20:51:22Z")

</div>

This is more of a ruby question but I thought I’d give a shot over here  
as well.

The scenario (for test purposes) I’m trying to accomplish when running  
rake on a new Rakefile is:

1. start a server and get its pid
2. run things that sends stuff to the server
3. stop the server

I’ve tried using IO’s popen, fork, thread, even sending the server to

> > /dev/null when starting it but none of them work as I expected. Once  
> > the server (step 1) starts it just hangs in there, not letting the  
> > following steps to run. But if I kill the server (control+c) the step 2  
> > tries to run and fails because the server is no longer running.

Any ideas how it can be done?

Thanks a lot.

---

<div class="post-metadata">

**Author:** ![jimmy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ee59a6/32.png) [@jimmy](https://www.ruby-forum.com/u/jimmy)\
**Post date:** [January 10, 2007, 10:21pm UTC](https://www.ruby-forum.com/t/threading-nightmare/81631/2 "2007-01-10T22:21:33Z")

</div>

What server are you trying to start? If it is mongrel, perhaps sending  
it the -d flag so it starts in daemon mode?

V/r  
Anthony

On 1/10/07, Jimmy [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> –  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
> 
> >

–  
Cell: 808 782-5046  
Current Location: Melbourne, FL

---

<div class="post-metadata">

**Author:** ![jimmy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ee59a6/32.png) [@jimmy](https://www.ruby-forum.com/u/jimmy)\
**Post date:** [January 10, 2007, 11:28pm UTC](https://www.ruby-forum.com/t/threading-nightmare/81631/3 "2007-01-10T23:28:40Z")

</div>

Anthony E. wrote:

> What server are you trying to start? If it is mongrel, perhaps sending  
> it the -d flag so it starts in daemon mode?
> 
> V/r  
> Anthony
> 
> On 1/10/07, Jimmy [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > –  
> > Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
> > 
> > >
> 
> –  
> Cell: 808 782-5046  
> Current Location: Melbourne, FL

Anthony,

I’m trying to start a java server, which unfortunately doesn’t have the  
option to ‘daemonize’ it.
