On Wed, Jan 7, 2015 at 2:50 AM, Lin Jen-Shin (godfat) <[email protected]> wrote:
[...]
> Here's some code snippets to show the context, and note that this is not the
> exact code on production because it's simplified.
>
>     aid = 1
>     # This is fine:
>     ids = B.where(aid => Sequel.pg_array_op(:a_ids).any).select_map(:id)
>     # Then we disconnect on:
>     C.where(:id => ids).eager(:d).all
>
> This might not be the only query which would disconnect, I did see some other
> would fail before, but this time it all happened on that line. I'll
> keep monitoring
> and report if I have further information.
>
> At least I could restart the server without too much fear now :P
>
> Cheers,

Umm... I just checked the trace for sequel, and I am not sure why it's the case.
The disconnection happened on:
sequel-4.18.0/lib/sequel/connection_pool/threaded.rb:88

      def hold(server=nil)
        t = Thread.current
        if conn = owned_connection(t)
          return yield(conn)
        end
        begin
    =>    unless conn = acquire(t)

I thought since I already have the middleware doing DB.synchronize,
the underlying query should simply get the connection from
`owned_connection(t)`? We do have threads making queries, but
I think in this case it should be the same thread doing DB.synchronize.

Cheers,

-- 
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/d/optout.

Reply via email to