# Backgroundrb stops suddenly

**URL:** <https://www.ruby-forum.com/t/backgroundrb-stops-suddenly/156742>\
**Category:** Rails\
**Created:** [January 2, 2009, 9:15am UTC](https://www.ruby-forum.com/t/backgroundrb-stops-suddenly/156742 "2009-01-02T09:15:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![madhan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/aca169/32.png) [@madhan](https://www.ruby-forum.com/u/madhan)\
**Post date:** [January 2, 2009, 9:15am UTC](https://www.ruby-forum.com/t/backgroundrb-stops-suddenly/156742/1 "2009-01-02T09:15:12Z")

</div>

hi,  
i have used backgroundrb to update the database with the files having  
some useful data, where i am getting files periodically uploaded.  
it works well, but suddenly it stops the worker and stopped the  
updation.  
when i checked the backgroundrb.log file  
it shows  
Mysql::Error: MySQL server has gone away: (Query used for updation)  
LIMIT 1 - (ActiveRecord::StatementInvalid)  
but, the query is working fine in mysql.

i have created one worker to do the updation with job\_key.  
when i checked the job\_key value for the particular worker is shows nil.  
since the worker was stopped.

what would be the problem, how can i make the updation works  
continuously.

ur  
madhan

---

<div class="post-metadata">

**Author:** ![madhan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/aca169/32.png) [@madhan](https://www.ruby-forum.com/u/madhan)\
**Post date:** [January 2, 2009, 12:52pm UTC](https://www.ruby-forum.com/t/backgroundrb-stops-suddenly/156742/2 "2009-01-02T12:52:51Z")

</div>

Madhankumar Nagaraj wrote:

> i have created one worker to do the updation with job\_key.  
> when i checked the job\_key value for the particular worker is shows nil.  
> since the worker was stopped.
> 
> what would be the problem, how can i make the updation works  
> continuously.

Your MySQL session is timing-out after the default 8 hours.

Either increase the timeout by adding the following  
line to the [mysqld] section of the /etc/my.cnf file:

set-variable = wait\_timeout=\<#seconds\>

or you can instead insert a call to

ActiveRecord::Base.verify\_active\_connections!

ahead of any database queries.

The verify\_active\_connections! method is called by  
Rails before every request, but your backgroundrb  
process will not be getting this constant hammering  
to keep its database connection alive.

–  
Rails Wheels - Find Plugins, List & Sell Plugins -  
[http://railswheels.com](http://railswheels.com)

---

<div class="post-metadata">

**Author:** ![madhan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/aca169/32.png) [@madhan](https://www.ruby-forum.com/u/madhan)\
**Post date:** [January 2, 2009, 1:18pm UTC](https://www.ruby-forum.com/t/backgroundrb-stops-suddenly/156742/3 "2009-01-02T13:18:54Z")

</div>

> Your MySQL session is timing-out after the default 8 hours.
> 
> Either increase the timeout by adding the following  
> line to the [mysqld] section of the /etc/my.cnf file:
> 
> set-variable = wait\_timeout=\<#seconds\>
> 
> or you can instead insert a call to
> 
> ActiveRecord::Base.verify\_active\_connections!
> 
> ahead of any database queries.
> 
> The verify\_active\_connections! method is called by  
> Rails before every request, but your backgroundrb  
> process will not be getting this constant hammering  
> to keep its database connection alive.

Dear Mark,

first i want to thank for ur response,

i am not making the mysql to wait, every 15 minutes i am getting the  
files uploaded. it works well for 1 week (avg) then it stops suddenly…

ur  
Madhan

---

<div class="post-metadata">

**Author:** ![madhan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/aca169/32.png) [@madhan](https://www.ruby-forum.com/u/madhan)\
**Post date:** [January 2, 2009, 5:44pm UTC](https://www.ruby-forum.com/t/backgroundrb-stops-suddenly/156742/4 "2009-01-02T17:44:24Z")

</div>

You might want to try the BackgrounDRb mail list also

[http://rubyforge.org/mailman/listinfo/backgroundrb-devel](http://rubyforge.org/mailman/listinfo/backgroundrb-devel)

On Jan 2, 6:18 am, Madhankumar Nagaraj \<rails-mailing-l…@andreas-
