On Friday, November 29, 2013 5:51:29 PM UTC-8, Joseph Shin wrote: > Hi, > > I'm trying to deploy an app into production and hung up in the qa/dev env. > My sinatra app first sets up the db connection using sintra/sequel and we > load up the models and routes at the end of the App class. > > We are using the connection validator extension with a timeout of 60 > seconds. Also worth noting it's mysql and we are using the mysql2 adapter. > > When we deployed to our dev & qa env, we noticed that long running > processes would hang and eventually hit a 60 second timeout where unicorn > would reap the process and start another one. Doing an strace revealed > that it was hanging on a 'SELECT NULL' to the database. Our unicorn config > was pretty vanilla, meaning we just set the number of workers and nothing > else. > > Has anyone experienced this behavior? > > Digging around, it seems like I should be using preload_app true and > disconnect sequel connections before fork, and then reconnect them after > the fork ( not actually sure if this will solve my problem but trying out > anything at this point ). It seems that even if I disconnect the sequel > connection and then reconnect the models hang on to the original > connection.... Should i somehow be reloading the models after I reconnect? > I'm testing this by connecting to a different database with the same > schema in the after hook. > > It's pretty hard to find sample configurations for this setup for some > reason. I'm new to ruby in general so any help whatsoever would be > appreciated. >
>From the description of the issue, it sounds like is preload_app is already enabled (it would explain why the problem occurs after unicorn spawns a new process). Either don't use preload_app, or use preload_app and disconnect before fork. You don't need to do any manual reconnection after fork, Sequel will reconnect automatically. Thanks, Jeremy -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sequel-talk. For more options, visit https://groups.google.com/groups/opt_out.
