Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rufus Scheduler doesn't run with daemonized puma 2.0.0.b4 #183

Closed
concept47 opened this issue Jan 21, 2013 · 17 comments
Closed

Rufus Scheduler doesn't run with daemonized puma 2.0.0.b4 #183

concept47 opened this issue Jan 21, 2013 · 17 comments

Comments

@concept47
Copy link

I'm new to puma and I love it!
(Went from 500-600M of memory usage to 150M ... that's hard to beat)

I got 1.6.3 working using an Apache proxy yesterday and it seemed to run just fine with this gem https://github.com/jmettraux/rufus-scheduler. My rufus scheduler tasks got scheduled and run just fine.

To take advantage of the daemonize option in the new version, I switched to 2.0.0.b4, but in that instance, Rufus scheduler doesn't seem to run at all, it starts up but then does nothing. Does just fine when I run it from ssh in the fore-ground.

Any ideas why it would work this way.
Thanks!

@evanphx
Copy link
Member

evanphx commented Feb 5, 2013

Do the workers start up? What config did you use to test it?

@concept47
Copy link
Author

Here is the schedule.rb I'm running from my config/initializers directory (I've snipped out most of the jobs except a printout of "I"VE Started" that I'm using to test this. Its the same one I've used for years, and it works just fine when puma isn't daemonized.

I also think it might be related to this mongrel bug with rufus scheduler https://groups.google.com/forum/?fromgroups=#!topic/rufus-ruby/8ToQAH8-Rv0

require 'rufus/scheduler'
##check for console or rake before proceding, this stops all of the scheduling from running when we're at the console or running a rake task
if !defined?(IRB) && !defined?(Rake)
   #setup ---------------------------------------------------------------
    scheduler = Rufus::Scheduler::PlainScheduler.start_new

    logfile = File.open(Rails.root.join('log', 'scheduler.log'), 'a')
    logfile.sync = true
    $schedule_logger = Logger.new(logfile, 2, 1024000)
    $schedule_logger.info "------------------------------------------------------------------------"
    $schedule_logger.info "------------------------------------------------------------------------"
    $schedule_logger.info "[Scheduler] started at #{Time.now.strftime('%B %d, %Y at %I:%M %p')}\n\n"

    def scheduler.handle_exception (job, exception)
        $schedule_logger.error "------------------------------------------------------------------------"
        $schedule_logger.error "[Scheduler] Exception at #{Time.now.strftime('%B %d, %Y at %I:%M %p')}"
        $schedule_logger.error "job #{job.job_id} running every #{job.t} caught exception"
        $schedule_logger.error "'#{exception}'"
        $schedule_logger.error "#{exception.backtrace.join("\n")}\n\n"
   end

#schedules ------------------------------------------------------------
## FOR DEBUGGING STUFF
    scheduler.in '5s' do ## same logic here, put it as far away from start as we can
        $schedule_logger.info "I STARTED!!! #{Time.now.strftime('%B %d, %Y at %I:%M %p')}"
    end

"[Scheduler] started at ... " never prints out to the log

@evanphx evanphx closed this as completed in eddb9e2 Feb 5, 2013
@concept47
Copy link
Author

Hey Evan, is there a way I can try this out?

@evanphx
Copy link
Member

evanphx commented Feb 5, 2013

Use puma from git in your Gemfile, then you can try it out.

@concept47
Copy link
Author

IT WORKS!!!! WOOHOOOO!!!!

@evanphx
Copy link
Member

evanphx commented Feb 6, 2013

WOOO!

@concept47
Copy link
Author

Hi Evan,
Somehow this stopped working in 2.2.1+ :\

@evanphx
Copy link
Member

evanphx commented Jul 11, 2013

@concept47 please open a new ticket.

@concept47
Copy link
Author

Sorry about that. it was fixed in 2.3.2 so not need.
Thanks Evan!

@gamead
Copy link

gamead commented May 13, 2014

It looks like Rufus Scheduler doesn't run with daemonized puma again,I'm in version 2.8.1,any help?

@djoos
Copy link

djoos commented Aug 1, 2014

FYI: same issue thing on 2.9.0.

Temp workaround: omit the --daemon flag and use nohup instead? #sneaky

HTH!

@puzanov
Copy link

puzanov commented Oct 15, 2014

Still not working with Puma 2.9.1
Rufus version is 3.0.7

@puzanov
Copy link

puzanov commented Oct 15, 2014

Rufus 3.0.9 is also not working with Puma 2.9.1
Please help!

@puzanov
Copy link

puzanov commented Oct 16, 2014

Anyone?

@evanphx
Copy link
Member

evanphx commented Oct 16, 2014

@puzanov What configuration are you running puma in? Are you using workers and preload?

@evanphx
Copy link
Member

evanphx commented Oct 16, 2014

The problem is, mostly, that Rufus scheduler starts up threads at booted and they don't carry over properly.

@puzanov
Copy link

puzanov commented Oct 20, 2014

How to fix that?

On Thu, Oct 16, 2014 at 10:03 PM, Evan Phoenix notifications@github.com
wrote:

The problem is, mostly, that Rufus scheduler starts up threads at booted
and they don't carry over properly.


Reply to this email directly or view it on GitHub
#183 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants