[jira] Created: (POOL-146) Thread deadlock issue in GenericKeyedObjectPool borrowObject()

View: New views
13 Messages — Rating Filter:   Alert me  

[jira] Created: (POOL-146) Thread deadlock issue in GenericKeyedObjectPool borrowObject()

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thread deadlock issue in GenericKeyedObjectPool borrowObject()
--------------------------------------------------------------

                 Key: POOL-146
                 URL: https://issues.apache.org/jira/browse/POOL-146
             Project: Commons Pool
          Issue Type: Bug
    Affects Versions: 1.5.1
            Reporter: bhupesh bansal


I am a new user of common-pools and I was having some weird behavior with GenericKeyedObjectPool

GenericKeyedObjectPool: 1074:1077

     public Object borrowObject(Object key) throws Exception {
        long starttime = System.currentTimeMillis();
        Latch latch = new Latch(key);     ---> This object is tried to be used for managing pool size by calling wait()/notify()

My thinking is this should be a shared/global object and not created new for each call ??



--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (POOL-146) Thread deadlock issue in GenericKeyedObjectPool borrowObject()

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/POOL-146?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12725396#action_12725396 ]

Phil Steitz commented on POOL-146:
----------------------------------

Can you be more specific on the "weird behavior" you are observing?

> Thread deadlock issue in GenericKeyedObjectPool borrowObject()
> --------------------------------------------------------------
>
>                 Key: POOL-146
>                 URL: https://issues.apache.org/jira/browse/POOL-146
>             Project: Commons Pool
>          Issue Type: Bug
>    Affects Versions: 1.5.1
>            Reporter: bhupesh bansal
>
> I am a new user of common-pools and I was having some weird behavior with GenericKeyedObjectPool
> GenericKeyedObjectPool: 1074:1077
>      public Object borrowObject(Object key) throws Exception {
>         long starttime = System.currentTimeMillis();
>         Latch latch = new Latch(key);     ---> This object is tried to be used for managing pool size by calling wait()/notify()
> My thinking is this should be a shared/global object and not created new for each call ??

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (POOL-146) Thread deadlock issue in GenericKeyedObjectPool borrowObject()

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/POOL-146?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12725400#action_12725400 ]

bhupesh bansal commented on POOL-146:
-------------------------------------

sure,

I am using it as a Socket pool with the KeyedPoolableObjectFactory as a  socketFactory which returns a socket for each makeObject() call
and close the socket in destroyObject()

The Test scenario which causes issue is this:
  Client --> socket call to server A and B (B is slow in freeing up resource where  A is fast to free)

  Common-Pools-1.5.1 : both A and B start throwing NoSuchElementException
  Common-Pools-1.4 :  only A throws NoSuchElementException and B keeps allocating resource.

I am trying to write a test case for the same will attach it once m done.

Best
Bhupesh



> Thread deadlock issue in GenericKeyedObjectPool borrowObject()
> --------------------------------------------------------------
>
>                 Key: POOL-146
>                 URL: https://issues.apache.org/jira/browse/POOL-146
>             Project: Commons Pool
>          Issue Type: Bug
>    Affects Versions: 1.5.1
>            Reporter: bhupesh bansal
>
> I am a new user of common-pools and I was having some weird behavior with GenericKeyedObjectPool
> GenericKeyedObjectPool: 1074:1077
>      public Object borrowObject(Object key) throws Exception {
>         long starttime = System.currentTimeMillis();
>         Latch latch = new Latch(key);     ---> This object is tried to be used for managing pool size by calling wait()/notify()
> My thinking is this should be a shared/global object and not created new for each call ??

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (POOL-146) Thread deadlock issue in GenericKeyedObjectPool borrowObject()

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/POOL-146?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12725401#action_12725401 ]

bhupesh bansal commented on POOL-146:
-------------------------------------

Correction : A is slow in freeing up resource where B is  fast  (not vice-versa as mentioned last time)

> Thread deadlock issue in GenericKeyedObjectPool borrowObject()
> --------------------------------------------------------------
>
>                 Key: POOL-146
>                 URL: https://issues.apache.org/jira/browse/POOL-146
>             Project: Commons Pool
>          Issue Type: Bug
>    Affects Versions: 1.5.1
>            Reporter: bhupesh bansal
>
> I am a new user of common-pools and I was having some weird behavior with GenericKeyedObjectPool
> GenericKeyedObjectPool: 1074:1077
>      public Object borrowObject(Object key) throws Exception {
>         long starttime = System.currentTimeMillis();
>         Latch latch = new Latch(key);     ---> This object is tried to be used for managing pool size by calling wait()/notify()
> My thinking is this should be a shared/global object and not created new for each call ??

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (POOL-146) Thread deadlock issue in GenericKeyedObjectPool borrowObject()

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/POOL-146?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12726465#action_12726465 ]

Mark Thomas commented on POOL-146:
----------------------------------

Am I correct in thinking that your have a single pool of sockets that clients use to connect to either Server A or Server B?

> Thread deadlock issue in GenericKeyedObjectPool borrowObject()
> --------------------------------------------------------------
>
>                 Key: POOL-146
>                 URL: https://issues.apache.org/jira/browse/POOL-146
>             Project: Commons Pool
>          Issue Type: Bug
>    Affects Versions: 1.5.1
>            Reporter: bhupesh bansal
>
> I am a new user of common-pools and I was having some weird behavior with GenericKeyedObjectPool
> GenericKeyedObjectPool: 1074:1077
>      public Object borrowObject(Object key) throws Exception {
>         long starttime = System.currentTimeMillis();
>         Latch latch = new Latch(key);     ---> This object is tried to be used for managing pool size by calling wait()/notify()
> My thinking is this should be a shared/global object and not created new for each call ??

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (POOL-146) Thread deadlock issue in GenericKeyedObjectPool borrowObject()

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/POOL-146?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12727109#action_12727109 ]

bhupesh bansal commented on POOL-146:
-------------------------------------

Yes...

they share the same socket pool (GenericKeyedObjectPool) keyed on nodeId for server A /B.

 my understanding is threads blocked on Key A (slow server) should not cause thread blocking for Key B ?? Is this assumption correct.


> Thread deadlock issue in GenericKeyedObjectPool borrowObject()
> --------------------------------------------------------------
>
>                 Key: POOL-146
>                 URL: https://issues.apache.org/jira/browse/POOL-146
>             Project: Commons Pool
>          Issue Type: Bug
>    Affects Versions: 1.5.1
>            Reporter: bhupesh bansal
>
> I am a new user of common-pools and I was having some weird behavior with GenericKeyedObjectPool
> GenericKeyedObjectPool: 1074:1077
>      public Object borrowObject(Object key) throws Exception {
>         long starttime = System.currentTimeMillis();
>         Latch latch = new Latch(key);     ---> This object is tried to be used for managing pool size by calling wait()/notify()
> My thinking is this should be a shared/global object and not created new for each call ??

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (POOL-146) Thread deadlock issue in GenericKeyedObjectPool borrowObject()

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/POOL-146?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12727351#action_12727351 ]

Mark Thomas commented on POOL-146:
----------------------------------

OK, now I understand.

That is a bug although making the Latch object global is not the way to address this. I have added a test case and am working on a patch.

> Thread deadlock issue in GenericKeyedObjectPool borrowObject()
> --------------------------------------------------------------
>
>                 Key: POOL-146
>                 URL: https://issues.apache.org/jira/browse/POOL-146
>             Project: Commons Pool
>          Issue Type: Bug
>    Affects Versions: 1.5.1
>            Reporter: bhupesh bansal
>
> I am a new user of common-pools and I was having some weird behavior with GenericKeyedObjectPool
> GenericKeyedObjectPool: 1074:1077
>      public Object borrowObject(Object key) throws Exception {
>         long starttime = System.currentTimeMillis();
>         Latch latch = new Latch(key);     ---> This object is tried to be used for managing pool size by calling wait()/notify()
> My thinking is this should be a shared/global object and not created new for each call ??

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (POOL-146) Thread deadlock issue in GenericKeyedObjectPool borrowObject()

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


     [ https://issues.apache.org/jira/browse/POOL-146?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mark Thomas resolved POOL-146.
------------------------------

       Resolution: Fixed
    Fix Version/s: 1.5.2

This has now been fixed. Many thanks for the report.

> Thread deadlock issue in GenericKeyedObjectPool borrowObject()
> --------------------------------------------------------------
>
>                 Key: POOL-146
>                 URL: https://issues.apache.org/jira/browse/POOL-146
>             Project: Commons Pool
>          Issue Type: Bug
>    Affects Versions: 1.5.1
>            Reporter: bhupesh bansal
>             Fix For: 1.5.2
>
>
> I am a new user of common-pools and I was having some weird behavior with GenericKeyedObjectPool
> GenericKeyedObjectPool: 1074:1077
>      public Object borrowObject(Object key) throws Exception {
>         long starttime = System.currentTimeMillis();
>         Latch latch = new Latch(key);     ---> This object is tried to be used for managing pool size by calling wait()/notify()
> My thinking is this should be a shared/global object and not created new for each call ??

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (POOL-146) Thread deadlock issue in GenericKeyedObjectPool borrowObject()

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/POOL-146?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12727363#action_12727363 ]

bhupesh bansal commented on POOL-146:
-------------------------------------

Many Thanks Mark,

Can you attach the patch to this bug ?? I would like to see the fix I spent considerable time looking into the commons-pools code base and couldn't find the issue and yes global Latch was not a solution I understood after looking into the code later.

BTW have you looked into ArrayBlockingQueue from java 1.5.0 onwards in their concurrent package ?? I was thinking using that would clean up the code a lot ?

> Thread deadlock issue in GenericKeyedObjectPool borrowObject()
> --------------------------------------------------------------
>
>                 Key: POOL-146
>                 URL: https://issues.apache.org/jira/browse/POOL-146
>             Project: Commons Pool
>          Issue Type: Bug
>    Affects Versions: 1.5.1
>            Reporter: bhupesh bansal
>             Fix For: 1.5.2
>
>
> I am a new user of common-pools and I was having some weird behavior with GenericKeyedObjectPool
> GenericKeyedObjectPool: 1074:1077
>      public Object borrowObject(Object key) throws Exception {
>         long starttime = System.currentTimeMillis();
>         Latch latch = new Latch(key);     ---> This object is tried to be used for managing pool size by calling wait()/notify()
> My thinking is this should be a shared/global object and not created new for each call ??

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (POOL-146) Thread deadlock issue in GenericKeyedObjectPool borrowObject()

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/POOL-146?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12727365#action_12727365 ]

Mark Thomas commented on POOL-146:
----------------------------------

Use the "Subversion commits" tab to see the changes related to this bug.

Utilising JDK 1.5 features is one of the considerations for the Pool 2.x series. There was a thread on the commons dev list about this not that long ago.

> Thread deadlock issue in GenericKeyedObjectPool borrowObject()
> --------------------------------------------------------------
>
>                 Key: POOL-146
>                 URL: https://issues.apache.org/jira/browse/POOL-146
>             Project: Commons Pool
>          Issue Type: Bug
>    Affects Versions: 1.5.1
>            Reporter: bhupesh bansal
>             Fix For: 1.5.2
>
>
> I am a new user of common-pools and I was having some weird behavior with GenericKeyedObjectPool
> GenericKeyedObjectPool: 1074:1077
>      public Object borrowObject(Object key) throws Exception {
>         long starttime = System.currentTimeMillis();
>         Latch latch = new Latch(key);     ---> This object is tried to be used for managing pool size by calling wait()/notify()
> My thinking is this should be a shared/global object and not created new for each call ??

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (POOL-146) Thread deadlock issue in GenericKeyedObjectPool borrowObject()

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


     [ https://issues.apache.org/jira/browse/POOL-146?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Phil Steitz updated POOL-146:
-----------------------------

    Affects Version/s: 1.5

> Thread deadlock issue in GenericKeyedObjectPool borrowObject()
> --------------------------------------------------------------
>
>                 Key: POOL-146
>                 URL: https://issues.apache.org/jira/browse/POOL-146
>             Project: Commons Pool
>          Issue Type: Bug
>    Affects Versions: 1.5, 1.5.1
>            Reporter: bhupesh bansal
>             Fix For: 1.5.2
>
>
> I am a new user of common-pools and I was having some weird behavior with GenericKeyedObjectPool
> GenericKeyedObjectPool: 1074:1077
>      public Object borrowObject(Object key) throws Exception {
>         long starttime = System.currentTimeMillis();
>         Latch latch = new Latch(key);     ---> This object is tried to be used for managing pool size by calling wait()/notify()
> My thinking is this should be a shared/global object and not created new for each call ??

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (POOL-146) Thread deadlock issue in GenericKeyedObjectPool borrowObject()

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/POOL-146?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12727388#action_12727388 ]

Paul Lindner commented on POOL-146:
-----------------------------------

Regarding ArrayBlockingQueue there is always backport-util-concurrent, seems like a logical step to me if 1.4 compatibility is desired..


> Thread deadlock issue in GenericKeyedObjectPool borrowObject()
> --------------------------------------------------------------
>
>                 Key: POOL-146
>                 URL: https://issues.apache.org/jira/browse/POOL-146
>             Project: Commons Pool
>          Issue Type: Bug
>    Affects Versions: 1.5, 1.5.1
>            Reporter: bhupesh bansal
>             Fix For: 1.5.2
>
>
> I am a new user of common-pools and I was having some weird behavior with GenericKeyedObjectPool
> GenericKeyedObjectPool: 1074:1077
>      public Object borrowObject(Object key) throws Exception {
>         long starttime = System.currentTimeMillis();
>         Latch latch = new Latch(key);     ---> This object is tried to be used for managing pool size by calling wait()/notify()
> My thinking is this should be a shared/global object and not created new for each call ??

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (POOL-146) Thread deadlock issue in GenericKeyedObjectPool borrowObject()

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


     [ https://issues.apache.org/jira/browse/POOL-146?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Phil Steitz closed POOL-146.
----------------------------


> Thread deadlock issue in GenericKeyedObjectPool borrowObject()
> --------------------------------------------------------------
>
>                 Key: POOL-146
>                 URL: https://issues.apache.org/jira/browse/POOL-146
>             Project: Commons Pool
>          Issue Type: Bug
>    Affects Versions: 1.5, 1.5.1
>            Reporter: bhupesh bansal
>             Fix For: 1.5.2
>
>
> I am a new user of common-pools and I was having some weird behavior with GenericKeyedObjectPool
> GenericKeyedObjectPool: 1074:1077
>      public Object borrowObject(Object key) throws Exception {
>         long starttime = System.currentTimeMillis();
>         Latch latch = new Latch(key);     ---> This object is tried to be used for managing pool size by calling wait()/notify()
> My thinking is this should be a shared/global object and not created new for each call ??

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.