Jeremy, 

Thanks for your comments. The retries were me grasping at straws. I figured 
it wasn't helping.

I think your assumption is correct. These services are using Passenger. 
Where is the best place to disconnect? I have an init.rb file that sets the 
connection and that gets required in the sinatra file. Can i call 
disconnect at the end of that init file?

On Saturday, October 20, 2012 12:52:20 PM UTC-4, Jeremy Evans wrote:
>
> On Saturday, October 20, 2012 8:28:06 AM UTC-7, David Ott wrote:
>>
>> I am experiencing trouble with the connections dropping and not being 
>> re-establised. The air brake error is this: 
>>
>> Sequel::DatabaseDisconnectError: PG::Error: SSL error: sslv3 alert bad 
>> record mac
>>
>> I assume there is some important thread safety stuff here that I am 
>> glossing over due to my inexperience with this kind of setup. What's the 
>> best way to deal with this? Is sharing the connection the wrong approach? 
>> Should I nix the gem and have this logic in each service? Would wrapping it 
>> in a Thread.new block work? Or is there something else I'm missing like 
>> disconnecting/reconnecting properly?
>>
>
> Sequel is thread-safe, so it's unlikely to be thread safety.  If I had to 
> guess, you are using a forking webserver, loading your application code 
> before forking, and not calling Database#disconnect before forking, 
> resulting in multiple processes sharing the connections.  But that's really 
> only a guess based on limited information.
>
> A couple of notes based on the code you posted:
>
> 1) Also note that there is no point in building a URL in your code, just 
> pass an options hash to Sequel.connect.
>
> 2) Your attempts to retry are misguided.  A DatabaseDisconnectError does 
> not mean a problem with the Database object, but an issue with a single 
> connection in the Database's connection pool, which Sequel handles by 
> removing the connection from the pool.  Creating a new Database object is 
> absolutely the wrong approach.
>
> Jeremy
>

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sequel-talk/-/3Wr2WSL3BxoJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.

Reply via email to