Reverse proxy holding onto port, complicated

I have a rails app that is behind a firewall and I need to be able to
ssh into the box, so I do this…

  • create a reverse tunnel from the rails system to my system using ssh
    -R
  • ssh from my system to the rails system thru the reverse tunnel

It works great !

But, if/when I restart my mongrel cluster, one of the mongrels always
fails with an “port in use” error.

I guess what’s happening is my reverse tunnel ssh process is a child
of a mongrel process, and when I kill the mongrel process, the reverse
tunnel ssh process is still holding onto the port, in fact i can see
that with “fuse -n tcp 8001” for port 8001.

So the question is, how can I keep this from happening, I want to be
able to restart my cluster and not have any lingering ports screw me
up !