Re: Can I issue a heroku restart from within my app that's running on Heroku?

2011-11-16 Thread John McCaffrey
Again, I would suggest that you try to find the real heart of the issue and
find ways to debug/instrument the code to figure out what is happening that
gets it stuck.

Maybe opening a ticket with the heroku team may help (maybe its something
they've seen, or they have a good suggestion for how to dig in to it). They
read the mailing list, but an actual support ticket may be the way to go
for you.

A solution where you restart your app just doesn't seem like it will scale
to me, unless you are firing it off like a cron/delayed job, that has a
natural restart flow. (would it make sense for the scraping part of the app
to be a background job?)

just throwing in my 2c

On Wed, Nov 16, 2011 at 8:09 AM, Corey Trager ctra...@gmail.com wrote:

 Not working yet.

 Testing on my dev box, heroku.restart resulted in a 404 but
 heroku.ps_restart DID restart my app running at Heroku, so that was
 promising.  That is, my local app A could restart my Heroku app B.
 But, when deployed to Heroku and tried to have B restart itself,
 ps_restart resulted in NoMethodError for Heroku::Client and restart
 resulted in RestClient::ResourceNotFound.
 The NoMethodError, does that mean I'm using an older stack with an
 older Heroku gem?
 The RestClient, I guess heroku needs to know a host?   So, I'm looking
 for docs for the gem.
 Do you think I'm on the right track?


 On Nov 15, 5:04 pm, Neil Middleton neil.middle...@gmail.com wrote:
  You can always use the Heroku gem to talk to the heroku infrastructure
 as the CLI does.
 
  For instance:
 
  @heroku = Heroku::Client.new(ENV[HEROKU_EMAIL], ENV[HEROKU_PASSWORD])
 
  You can then issue commands such as:
 
  @heroku.restart('app_name')
 
  Neil
 

 --
 You received this message because you are subscribed to the Google Groups
 Heroku group.
 To post to this group, send email to heroku@googlegroups.com.
 To unsubscribe from this group, send email to
 heroku+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/heroku?hl=en.




-- 
Thanks,
-John

-- 
You received this message because you are subscribed to the Google Groups 
Heroku group.
To post to this group, send email to heroku@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.



Re: Can I issue a heroku restart from within my app that's running on Heroku?

2011-11-16 Thread Corey Trager
John -  I have been trying to find the real heart of the issue, which
again, is that the app gets into a state.  That an individual request
for a URL fails, no problem.  That requests continue to fail, that
means there's some sort of state change somewhere.   But there is no
state in MY logic.  The failure of one request shouldn't affect the
next one.  So where is that state?  Deep in the Ruby libs that do the
URL fetching?  Some setting I'm not setting?  (I've tried switching
between two different Ruby ways of fetching urls, but both ways seem
to have the same problem.)  Somewhere in Heroku infrastructure - some
sort of caching/proxy thing?  I have no means of debugging those
things, and no means of fixing them and deploying that fix on Heroku.
I'm focusing on a solution where I have power and control: My code.

A google related to the heart of the issue:
http://www.google.com/search?q=http%3A%3Anet+EOFError
Do you have some suggestions for me?

Restarting the app at heroku is totally not elegant, a total hack, but
for my circumstances, your comments about scaling don't apply.

I will follow up on your suggestion to create a Heroku support ticket.

On Nov 16, 8:58 am, John McCaffrey john.mccaff...@gmail.com wrote:
 Again, I would suggest that you try to find the real heart of the issue and
 find ways to debug/instrument the code to figure out what is happening that
 gets it stuck.

 Maybe opening a ticket with the heroku team may help (maybe its something
 they've seen, or they have a good suggestion for how to dig in to it). They
 read the mailing list, but an actual support ticket may be the way to go
 for you.

 A solution where you restart your app just doesn't seem like it will scale
 to me, unless you are firing it off like a cron/delayed job, that has a
 natural restart flow. (would it make sense for the scraping part of the app
 to be a background job?)

 just throwing in my 2c









 On Wed, Nov 16, 2011 at 8:09 AM, Corey Trager ctra...@gmail.com wrote:
  Not working yet.

  Testing on my dev box, heroku.restart resulted in a 404 but
  heroku.ps_restart DID restart my app running at Heroku, so that was
  promising.  That is, my local app A could restart my Heroku app B.
  But, when deployed to Heroku and tried to have B restart itself,
  ps_restart resulted in NoMethodError for Heroku::Client and restart
  resulted in RestClient::ResourceNotFound.
  The NoMethodError, does that mean I'm using an older stack with an
  older Heroku gem?
  The RestClient, I guess heroku needs to know a host?   So, I'm looking
  for docs for the gem.
  Do you think I'm on the right track?

  On Nov 15, 5:04 pm, Neil Middleton neil.middle...@gmail.com wrote:
   You can always use the Heroku gem to talk to the heroku infrastructure
  as the CLI does.

   For instance:

   @heroku = Heroku::Client.new(ENV[HEROKU_EMAIL], ENV[HEROKU_PASSWORD])

   You can then issue commands such as:

   @heroku.restart('app_name')

   Neil

  --
  You received this message because you are subscribed to the Google Groups
  Heroku group.
  To post to this group, send email to heroku@googlegroups.com.
  To unsubscribe from this group, send email to
  heroku+unsubscr...@googlegroups.com.
  For more options, visit this group at
 http://groups.google.com/group/heroku?hl=en.

 --
 Thanks,
 -John

-- 
You received this message because you are subscribed to the Google Groups 
Heroku group.
To post to this group, send email to heroku@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.



Can I issue a heroku restart from within my app that's running on Heroku?

2011-11-15 Thread Corey Trager
My app gets into a bad state for reasons I haven't figured out yet.
So far, the only solution I've found is to issue a heroku restart
command.  The app itself can detect the bad state and so I'd like the
app itself to issue the restart.  Is that possible?   It's a Sinatra
app.

-- 
You received this message because you are subscribed to the Google Groups 
Heroku group.
To post to this group, send email to heroku@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.



Re: Can I issue a heroku restart from within my app that's running on Heroku?

2011-11-15 Thread John McCaffrey
I'm interested in that as well, but if the answer ends up being 'no',
perhaps your app could just capture the current state (eg. what caused it)
and send out an alert.

when I've had problems in the past, I've been helped by
logging (logs --tail and the loggly add on)
new relic
exception notification
google analytics (see traffic patterns and urls)


If you see the pattern and can fix it, you won't need to do the restart
business.



On Mon, Nov 14, 2011 at 11:06 PM, Corey Trager ctra...@gmail.com wrote:

 My app gets into a bad state for reasons I haven't figured out yet.
 So far, the only solution I've found is to issue a heroku restart
 command.  The app itself can detect the bad state and so I'd like the
 app itself to issue the restart.  Is that possible?   It's a Sinatra
 app.

 --
 You received this message because you are subscribed to the Google Groups
 Heroku group.
 To post to this group, send email to heroku@googlegroups.com.
 To unsubscribe from this group, send email to
 heroku+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/heroku?hl=en.




-- 
Thanks,
-John

-- 
You received this message because you are subscribed to the Google Groups 
Heroku group.
To post to this group, send email to heroku@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.



Re: Can I issue a heroku restart from within my app that's running on Heroku?

2011-11-15 Thread Corey Trager
I have been doing the logs --tail.

A little more info.  My Heroku app screen scrapes another website.
For reasons I don't understand, HTTP::Net.get_response sometimes
results in EOFError and once that happens once, it happens always.
It's as if somewhere deep in the ruby libs, there's some state that
gets messed up and I don't know how to clear.   Or maybe it's
something in Heroku's infrastructure that's messed up that restarting
clears.  I don't know.   Googling HTTP::Net and EOFError results in
stories that are similar, but not exactly the same.

I can try/rescue and catch the error, but that doesn't help clear that
messed up state.

I could run a cron job on my dev machine and issue heroku restart
from there, but that's what I'm trying to avoid.

On Nov 15, 2:18 pm, John McCaffrey john.mccaff...@gmail.com wrote:
 I'm interested in that as well, but if the answer ends up being 'no',
 perhaps your app could just capture the current state (eg. what caused it)
 and send out an alert.

 when I've had problems in the past, I've been helped by
 logging (logs --tail and the loggly add on)
 new relic
 exception notification
 google analytics (see traffic patterns and urls)

 If you see the pattern and can fix it, you won't need to do the restart
 business.









 On Mon, Nov 14, 2011 at 11:06 PM, Corey Trager ctra...@gmail.com wrote:
  My app gets into a bad state for reasons I haven't figured out yet.
  So far, the only solution I've found is to issue a heroku restart
  command.  The app itself can detect the bad state and so I'd like the
  app itself to issue the restart.  Is that possible?   It's a Sinatra
  app.

  --
  You received this message because you are subscribed to the Google Groups
  Heroku group.
  To post to this group, send email to heroku@googlegroups.com.
  To unsubscribe from this group, send email to
  heroku+unsubscr...@googlegroups.com.
  For more options, visit this group at
 http://groups.google.com/group/heroku?hl=en.

 --
 Thanks,
 -John

-- 
You received this message because you are subscribed to the Google Groups 
Heroku group.
To post to this group, send email to heroku@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.



Re: Can I issue a heroku restart from within my app that's running on Heroku?

2011-11-15 Thread Neil Middleton
You can always use the Heroku gem to talk to the heroku infrastructure as the 
CLI does.

For instance:

@heroku = Heroku::Client.new(ENV[HEROKU_EMAIL], ENV[HEROKU_PASSWORD])

You can then issue commands such as:

@heroku.restart('app_name')

Neil

On 15 Nov 2011, at 21:56, Corey Trager wrote:

 I have been doing the logs --tail.
 
 A little more info.  My Heroku app screen scrapes another website.
 For reasons I don't understand, HTTP::Net.get_response sometimes
 results in EOFError and once that happens once, it happens always.
 It's as if somewhere deep in the ruby libs, there's some state that
 gets messed up and I don't know how to clear.   Or maybe it's
 something in Heroku's infrastructure that's messed up that restarting
 clears.  I don't know.   Googling HTTP::Net and EOFError results in
 stories that are similar, but not exactly the same.
 
 I can try/rescue and catch the error, but that doesn't help clear that
 messed up state.
 
 I could run a cron job on my dev machine and issue heroku restart
 from there, but that's what I'm trying to avoid.
 
 On Nov 15, 2:18 pm, John McCaffrey john.mccaff...@gmail.com wrote:
 I'm interested in that as well, but if the answer ends up being 'no',
 perhaps your app could just capture the current state (eg. what caused it)
 and send out an alert.
 
 when I've had problems in the past, I've been helped by
 logging (logs --tail and the loggly add on)
 new relic
 exception notification
 google analytics (see traffic patterns and urls)
 
 If you see the pattern and can fix it, you won't need to do the restart
 business.
 
 
 
 
 
 
 
 
 
 On Mon, Nov 14, 2011 at 11:06 PM, Corey Trager ctra...@gmail.com wrote:
 My app gets into a bad state for reasons I haven't figured out yet.
 So far, the only solution I've found is to issue a heroku restart
 command.  The app itself can detect the bad state and so I'd like the
 app itself to issue the restart.  Is that possible?   It's a Sinatra
 app.
 
 --
 You received this message because you are subscribed to the Google Groups
 Heroku group.
 To post to this group, send email to heroku@googlegroups.com.
 To unsubscribe from this group, send email to
 heroku+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/heroku?hl=en.
 
 --
 Thanks,
 -John
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 Heroku group.
 To post to this group, send email to heroku@googlegroups.com.
 To unsubscribe from this group, send email to 
 heroku+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/heroku?hl=en.
 

-- 
You received this message because you are subscribed to the Google Groups 
Heroku group.
To post to this group, send email to heroku@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.