I am using ruby 1.8.7 and rails 2.3.4 . I am developing a plugin so I don't have too much of leeway.
In my controller I need to invoke a rake task. The rake task will take longer to finish so I am following the approach mentioned in Railscast which is
system "rake #{task} &"
This solution works great and everything is fine. I know this solution will not work on windows and I'm fine with that.
I started my server at port 3000. The controller was invoked which fired the rake task in the background. However if I ctrl +c my script/server and if I try to restart the server then I get this error.
Address already in use - bind(2) (Errno::EADDRINUSE)
Then I changed my code to do this
fork do
system "rake #{task} &"
end
Still the same issue.
Does anyone how do I get around this problem of port 3000 getting blocked. Also any explanation of why rake task is blocking port 3000 would help.