ReactiveCouchbase / ReactiveCouchbase-core

Core library for ReactiveCouchbase
Apache License 2.0
64 stars 28 forks source link

New I/O Worker leaks #45

Closed akirillov closed 9 years ago

akirillov commented 9 years ago

Hi there! I've started to have strange application crashes and found strange leaks of new i/o worker threads. Here is thread dump: http://pastebin.com/ue9jRWv3 and here is the way I'm using driver in my application:

trait ReactiveCouchbaseClient {
  implicit val ec = ExecutionContext.Implicits.global
  val timeout = Duration(10, TimeUnit.SECONDS)

  val driver = ReactiveCouchbaseDriver()
  val config = ConfigFactory.load()

  def bucketName: String

  val DesignDocName = "cutesy_mr"
  def bucket: CouchbaseBucket = driver.bucket(bucketName)

  def executeWithBucket[T](function: CouchbaseBucket => T) = {
    function(bucket)
  }
}

By extending it in each bucket's client I provide bucket name. I'm using reactivecouchbase-core 4-SNAPSHOT, Play 2.3.6, Scala 2.11.2.

Any workaround appreciated.

mathieuancelin commented 9 years ago

Hi,

Can you show me your configuration for the client as well please ?

Also, can you reproduce it easily ? If so, can you provide a small app to reproduce it on my mac ?

mathieuancelin commented 9 years ago

Also, is it happening only in dev mode with a lot of restarts of the application ?

Can you try to apply a heavy load on your app in prod mode to see if it happens again ?

akirillov commented 9 years ago

@mathieuancelin it happens during tests and during not so heavy production use. Here is example configuration:

couchbase {
  akka {
    timeout=10000
    execution-context {
      fork-join-executor {
        parallelism-factor = 4.0
        parallelism-max = 10
      }
    }
  }
  buckets = [{
    host="192.168.100.10"
    port="8091"
    base="pools"
    bucket="users"
    user=""
    pass=""
    timeout="0"
  },{
    host="192.168.100.10"
    port="8091"
    base="pools"
    bucket="messages"
    user=""
    pass=""
    timeout="0"
  },{
    host="192.168.100.10"
    port="8091"
    base="pools"
    bucket="services"
    user=""
    pass=""
    timeout="0"
  },{
    host="192.168.100.10"
    port="8091"
    base="pools"
    bucket="reviews"
    user=""
    pass=""
    timeout="0"
  },{
     host="192.168.100.10"
     port="8091"
     base="pools"
     bucket="favourites"
     user=""
     pass=""
     timeout="0"
   },{
      host="192.168.100.10"
      port="8091"
      base="pools"
      bucket="util"
      user=""
      pass=""
      timeout="0"
    }
  ]
}
akirillov commented 9 years ago

Seems that leak was produced by inproper classes unloading in spring-scala + sbt setup. Anyway this is not a bug inside ReactiveCB.