stchang / redis

A redis client for Racket.
17 stars 4 forks source link

repeatedly releasing and leasing from the same thread results in starvation #7

Open stchang opened 9 years ago

stchang commented 9 years ago

Repeatedly releasing and leasing (from the same thread) results in starvation due to hitting the max number of threads because the old conns never finish getting returned (this is assuming #6 is fixed).

For example, the following test fails:

(check-not-exn
  (λ ()
    (let loop ([n 100])
      (unless (zero? n)
        (connection-pool-return p (connection-pool-lease p))
        (loop (sub1 n))))))

I'm guessing it's due to the slowness of unsubscribe because it works if I remove that cmd in release-conn. Maybe we need to treat publish/subscribe cmd as a special case.