JRedisPipeline exception

2 views
Skip to first unread message

cjb

unread,
May 25, 2010, 4:13:25 PM5/25/10
to JRedis
When there is an exception thrown from the constructor of
JRedisPipeline it results in a thread leak. The constructor never
returns an object, however, a new thread is started. This thread
should be shutdown if the constructor fails. There is no way to do
it from the application, since there is no object.

Joubin Houshyar

unread,
May 25, 2010, 5:29:40 PM5/25/10
to jre...@googlegroups.com
Hi,

Please let me know what codebase you are using.  RC1 release, or from repo branches 1.2.n, master?

/R


--
You received this message because you are subscribed to the Google Groups "JRedis" group.
To post to this group, send email to jre...@googlegroups.com.
To unsubscribe from this group, send email to jredis+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/jredis?hl=en.


Message has been deleted

carl bruecken

unread,
May 26, 2010, 11:17:43 AM5/26/10
to jre...@googlegroups.com
I am using RC1.

initializeComponents will create the response-handle thread, but if connect fails the thread is leaked.


protected ConnectionBase (ConnectionSpec spec, boolean connectImmediately)
        throws ClientRuntimeException
    {
        try {
            this.spec = notNull(spec, "ConnectionSpec init parameter", ClientRuntimeException.class);
            socketAddress = new InetSocketAddress(spec.getAddress(), spec.getPort());
            initializeComponents();
            if(connectImmediately) {
                connect ();

Joubin Houshyar

unread,
May 26, 2010, 10:29:32 PM5/26/10
to JRedis
Hi,

Did you see this: http://groups.google.com/group/jredis/browse_thread/thread/9b242ffbcc1ced49
Build from the 1.2.n branch (the likely RC2). Please let me know if
it is still an issue. It

/R

On May 26, 11:17 am, carl bruecken <brueck...@gmail.com> wrote:
> I am using RC1.
>
> initializeComponents will create the response-handle thread, but if connect
> fails the thread is leaked.
>
> protected ConnectionBase (ConnectionSpec spec, boolean connectImmediately)
>         throws ClientRuntimeException
>     {
>         try {
>             this.spec = notNull(spec, "ConnectionSpec init parameter",
> ClientRuntimeException.class);
>             socketAddress = new InetSocketAddress(spec.getAddress(),
> spec.getPort());
>             initializeComponents();
>             if(connectImmediately) {
>                 connect ();
>             }
>         }
>
>
>
> On Tue, May 25, 2010 at 5:29 PM, Joubin Houshyar <suno...@gmail.com> wrote:
> > Hi,
>
> > Please let me know what codebase you are using.  RC1 release, or from repo
> > branches 1.2.n, master?
>
> > /R
>

> > On Tue, May 25, 2010 at 4:13 PM, cjb <brueck...@gmail.com> wrote:
>
> >> When there is an exception thrown from the constructor of
> >> JRedisPipeline it results in a thread leak.   The constructor never
> >> returns an object, however, a new thread is started.   This thread
> >> should be shutdown if the constructor fails.   There is no way to do
> >> it from the application, since there is no object.
>
> >> --
> >> You received this message because you are subscribed to the Google Groups
> >> "JRedis" group.
> >> To post to this group, send email to jre...@googlegroups.com.
> >> To unsubscribe from this group, send email to

> >> jredis+un...@googlegroups.com<jredis%2Bunsu...@googlegroups.com>


> >> .
> >> For more options, visit this group at
> >>http://groups.google.com/group/jredis?hl=en.
>
> >  --
> > You received this message because you are subscribed to the Google Groups
> > "JRedis" group.
> > To post to this group, send email to jre...@googlegroups.com.
> > To unsubscribe from this group, send email to

> > jredis+un...@googlegroups.com<jredis%2Bunsu...@googlegroups.com>

carl bruecken

unread,
Jun 3, 2010, 2:32:14 PM6/3/10
to jre...@googlegroups.com
This is still an issue using Git 1.2.n branch.    The 'response-handler threads are still stuck on LinkedBlockingQueue.take().   I see there is an event listener, but it doesn't do anything in the case of a FAULT, even though it gets the FAULT event when the connection can't be established.

This is extremely easily to duplicate - by calling JRedisPipeline(connectionSpec) and passing connectionSpec that points to a server that isn't running.  Do this in a loop and you'll see that the threads are leaked and the constructor returns null;

Stack trace:  for 'response-handler' thread

sun.misc.Unsafe.park(Native Method)
java.util.concurrent.locks.LockSupport.park(LockSupport.java:158)
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1925)
java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:399)
org.jredis.ri.alphazero.connection.PipelineConnectionBase$ResponseHandler.run(PipelineConnectionBase.java:287)
java.lang.Thread.run(Thread.java:637)


  public void onEvent (Event event) {
            if(event.getSource() != PipelineConnectionBase.this) {
                // BUG: what to do about it?
            }
            switch (event.getType()){
                case CONNECTED:
                    break;
                case DISCONNECTED:
                    break;
                case FAULTED:            
                    break;
           
            }


To unsubscribe from this group, send email to jredis+un...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages