John -

The problem is that when you create a new IRiakClient ... the previous one
doesn't shut down its threads when it goes out of scope, thus leading to
your problem.

We've already fixed this is master by adding a 'shutdown()' method to the
IRiakClient interface, but the latest release cut of the client (1.0.3)
does not include it.

Thanks,
Brian Roach

On Tue, Feb 14, 2012 at 2:53 PM, John DeTreville <[email protected]>wrote:

> I have a simple single-threaded Java client for Riak that consistently
> runs out of memory creating threads.
>
> java.lang.OutOfMemoryError: unable to create new native thread
>        at java.lang.Thread.start0(Native Method)
>        at java.lang.Thread.start(Thread.java:658)
>        at
> java.util.concurrent.ThreadPoolExecutor.addIfUnderCorePoolSize(ThreadPoolExecutor.java:703)
>        at
> java.util.concurrent.ThreadPoolExecutor.prestartCoreThread(ThreadPoolExecutor.java:1381)
>        at
> java.util.concurrent.ScheduledThreadPoolExecutor.delayedExecute(ScheduledThreadPoolExecutor.java:222)
>        at
> java.util.concurrent.ScheduledThreadPoolExecutor.scheduleWithFixedDelay(ScheduledThreadPoolExecutor.java:443)
>        at
> com.basho.riak.pbc.RiakConnectionPool.doStart(RiakConnectionPool.java:232)
>        at
> com.basho.riak.pbc.RiakConnectionPool.access$100(RiakConnectionPool.java:41)
>        at
> com.basho.riak.pbc.RiakConnectionPool$State$1.start(RiakConnectionPool.java:58)
>        at
> com.basho.riak.pbc.RiakConnectionPool.start(RiakConnectionPool.java:227)
>        at com.basho.riak.pbc.RiakClient.<init>(RiakClient.java:90)
>        at com.basho.riak.pbc.RiakClient.<init>(RiakClient.java:81)
>        at
> com.basho.riak.client.raw.pbc.PBClientAdapter.<init>(PBClientAdapter.java:91)
>        at com.basho.riak.client.RiakFactory.pbcClient(RiakFactory.java:107)
>
> The client is a JUnit test for some data structures I'm storing in Riak.
> When I run it, my Java client process starts about 2028 native threads
> before it collapses.
>
> This JUnit test creates a moderately large number of IRiakClient objects,
> but only one at a time. It does not close them, as there is no method for
> doing so.
>
> This happens with Riak 1.0.2 and with Riak 1.1.0RC2. As I've said, the
> client is single-theaded.
>
> Any ideas?
>
> Cheers,
> John
>
> _______________________________________________
> riak-users mailing list
> [email protected]
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>
_______________________________________________
riak-users mailing list
[email protected]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to