This is some sort of race condition - if I put a sleep 5 at the bottom
of my stop task then it works fine.

I haven't been able to pin it down exactly - my suspicion is theres
something going on with

 def self.sphinx_running_by_pid?
   !!sphinx_pid && pid_active?(sphinx_pid)
 end

Where both things don't happen simultaneously while shutting down but
the exact reasoning is eluding me.. It seems that Sphinx could rely on
Riddle's .running? method rather than reimplementing it here.



On Sep 9, 11:28 am, Stephen <[email protected]> wrote:
> I'm actually working on trying to track this down myself, it seems
> that Sphinx thinks that the app is still running after the stop job
> runs but going into a console and doing ThinkingSphinx.sphinx_running?
> appears to be correct.
>
> ---
>
> # rake ts:restart --trace
>
> ** Invoke ts:restart (first_time)
> ** Invoke thinking_sphinx:restart (first_time)
> ** Invoke thinking_sphinx:app_env (first_time)
> ** Execute thinking_sphinx:app_env
> ** Invoke environment (first_time)
> ** Execute environment
> ** Invoke thinking_sphinx:stop (first_time)
> ** Invoke thinking_sphinx:app_env
> ** Execute thinking_sphinx:stop
> Stopped search daemon (pid 6302).
> ** Invoke thinking_sphinx:start (first_time)
> [Thu Sep  9 11:17:10.584 2010] [ 6302] caught SIGTERM, shutting down
> ** Invoke thinking_sphinx:app_env
> ** Execute thinking_sphinx:start
> rake aborted!
> searchd is already running.
> /usr/local/ruby19/lib/ruby/gems/1.9.1/gems/thinking-sphinx-1.3.20/lib/
> thinking_sphinx/tasks.rb:34:in `block (2 levels) in <top (required)>'
> /usr/local/ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:
> 636:in `call'
> /usr/local/ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:
> 636:in `block in execute'
> /usr/local/ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:
> 631:in `each'
> /usr/local/ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:
> 631:in `execute'
> /usr/local/ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:
> 597:in `block in invoke_with_call_chain'
> /usr/local/ruby19/lib/ruby/1.9.1/monitor.rb:190:in `mon_synchronize'
> /usr/local/ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:
> 590:in `invoke_with_call_chain'
> /usr/local/ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:
> 607:in `block in invoke_prerequisites'
> /usr/local/ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:
> 604:in `each'
> /usr/local/ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:
> 604:in `invoke_prerequisites'
> /usr/local/ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:
> 596:in `block in invoke_with_call_chain'
> /usr/local/ruby19/lib/ruby/1.9.1/monitor.rb:190:in `mon_synchronize'
> /usr/local/ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:
> 590:in `invoke_with_call_chain'
> /usr/local/ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:
> 607:in `block in invoke_prerequisites'
> /usr/local/ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:
> 604:in `each'
> /usr/local/ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:
> 604:in `invoke_prerequisites'
> /usr/local/ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:
> 596:in `block in invoke_with_call_chain'
> /usr/local/ruby19/lib/ruby/1.9.1/monitor.rb:190:in `mon_synchronize'
> /usr/local/ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:
> 590:in `invoke_with_call_chain'
> /usr/local/ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:
> 583:in `invoke'
> /usr/local/ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:
> 2051:in `invoke_task'
> /usr/local/ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:
> 2029:in `block (2 levels) in top_level'
> /usr/local/ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:
> 2029:in `each'
> /usr/local/ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:
> 2029:in `block in top_level'
> /usr/local/ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:
> 2068:in `standard_exception_handling'
> /usr/local/ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:
> 2023:in `top_level'
> /usr/local/ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:
> 2001:in `block in run'
> /usr/local/ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:
> 2068:in `standard_exception_handling'
> /usr/local/ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:
> 1998:in `run'
> /usr/local/ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/bin/rake:31:in
> `<top (required)>'
> /usr/local/ruby19/bin/rake:19:in `load'
> /usr/local/ruby19/bin/rake:19:in `<main>'
> [r...@revolution phantasytour_rails]# [Thu Sep  9 11:17:11.023 2010]
> [ 6302] shutdown complete
>
> On Sep 8, 6:47 pm, Mathew <[email protected]> wrote:
>
> > After manually killing the searchd process once, ts:start and stop -
> > as well as index - are now working.
>
> > Odd, but apparently resolved.
>
> > On Sep 8, 8:50 am, Mathew <[email protected]> wrote:
>
> > > Hi Pat - thanks for your quick reply - yes - am setting
> > > RAILS_ENV=production
>
> > > I'm just not sure why index should work, but stop/start is not.
>
> > > On Sep 8, 7:01 am, "Pat Allan" <[email protected]> wrote:
>
> > > > Hi Mathew
>
> > > > I guess I'll start with the obvious, if just to rule it out - when
> > > > you're calling all of these tasks, you're setting RAILS_ENV to
> > > > production, right?
>
> > > > --
> > > > Pat
>
> > > > On 9/8/2010, "Mathew" <[email protected]> wrote:
>
> > > > >Hello,
>
> > > > >I have seen some allusions to this around the web, but have not found
> > > > >a satisfactory solution yet:
>
> > > > >Sphinx is running fine on my server.
> > > > >I can index new content with the ts:index task and get the expected
> > > > >index stats.
> > > > >I cannot stop Sphinx using ts:stop, instead I get the 'searchd is not
> > > > >running
> > > > >' message - which is not true.
>
> > > > >I saw one note on the web from someone reporting that he needed to go
> > > > >manually kill the searchd process, and then ts:start would work, but
> > > > >that sounds pretty hacky to me, and I'd prefer to set things up so
> > > > >that ts:stop works on my production environment the way it works
> > > > >locally.
>
> > > > >The best I can gather is that ts:stop doesn't work because sphinx (and
> > > > >searchd) is installed (correctly) in another directory - but then I'm
> > > > >confused why ts:index would work fine.
>
> > > > >Does this ring a bell for anyone?
>
> > > > >Thanks in advance,
> > > > >Mathew
>
> > > > >--
> > > > >You received this message because you are subscribed to the Google 
> > > > >Groups "Thinking Sphinx" group.
> > > > >To post to this group, send email to [email protected].
> > > > >To unsubscribe from this group, send email to 
> > > > >[email protected].
> > > > >For more options, visit this group 
> > > > >athttp://groups.google.com/group/thinking-sphinx?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Thinking Sphinx" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/thinking-sphinx?hl=en.

Reply via email to