After some experimenting, what worked was putting @DB.disconnect at the end
of config.ru. I see a slightly different solution over on the "concurrency
issue" thread. Not sure if they amount to the same thing.
On Sunday, February 24, 2013 3:22:52 PM UTC-5, Jeremy Evans wrote:
>
> On Sunday, February 24, 2013 9:29:28 AM UTC-8, Sean Redmond wrote:
>>
>> On Friday, February 22, 2013 6:12:10 PM UTC-5, Jeremy Evans wrote:
>>
>>>
>>> This smells like you have a forking webserver and you aren't
>>> disconnecting before fork, so your database connections are being shared by
>>> multiple processes. That's the first thing I'd check.
>>>
>>>
>> Looks like you're right.
>>
>> Sequel::Error - model object #<Gugg::WebApi::Collection::Db::Acquisition
>> @values={:displayed=>1, :roleid=>1, :updated_at=>Wed Feb 20 16:04:45 -0500
>> 2013, :conxrefid=>127645, :active=>1, :displayorder=>1, :id=>31243,
>> :constituentid=>11635}> does not have a primary key:
>>
>> /usr/lib/ruby/gems/1.8/gems/sequel-3.42.0/lib/sequel/model/associations.rb
>> :1470:in `_dataset'
>>
>> /usr/lib/ruby/gems/1.8/gems/sequel-3.42.0/lib/sequel/model/associations.rb
>> :1103:in `objects_dataset'
>>
>> /usr/lib/ruby/gems/1.8/gems/gugg-web_api-collection-db-1.2.0/lib/gugg-web_
>> api-collection-db/acquisition.rb:60:in `as_resource'
>>
>> /usr/lib/ruby/gems/1.8/gems/gugg-web_api-collection-server-1.1.0/lib/gugg-
>> web_api-collection-server.rb:123:in `GET (?-mix:\/acquisitions\/(\d+))'
>>
>> /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.3/lib/sinatra/base.rb:1264:in
>> `call'
>>
>> ... many, many lines going up through Sinatra, Rack, and Passenger until
>> we get to:
>>
>>
>> /var/lib/gems/1.8/gems/passenger-3.0.18/lib/phusion_passenger/abstract_ser
>> ver.rb:206:in `start_synchronously'
>>
>> /var/lib/gems/1.8/gems/passenger-3.0.18/helper-scripts/passenger-spawn-ser
>> ver:99
>>
>> In the initial error, it's the same model,
>> Gugg::WebApi::Collection::Db::Acquisition, because that's the one that's
>> getting loaded most often but this time with the values from yet another
>> wrong table. There's another post in this group ("concurrency issue...")
>> with the same problem right now and searching Google with this clue I see
>> the same advice, "call #disconnect before forking" and the same confusion
>> about the right way to that. Base on one of your answers elsewhere (
>> http://stackoverflow.com/questions/8869526/right-place-for-sequel-db-connection-while-working-on-phusion-passenger-with-ngi#comment11128488_8869526),
>>
>> if my config.ru sets up the variable @DB and then calls
>>
>> run MyApp
>>
>> I should just add
>>
>> @DB.disconnect
>>
>> after that?
>>
>
> I think that will work, but you might need to do it before that line
> instead of after.
>
> It's a shame Passenger doesn't offer a before-fork hook like unicorn.
>
> 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.