[prev in list] [next in list] [prev in thread] [next in thread] 

List:       httpclient-users
Subject:    Re: DefaultHttpClientConnection.isOpen();
From:       sebb <sebbaz () gmail ! com>
Date:       2008-06-20 11:44:52
Message-ID: 25aac9fc0806200444v451d7c75l6364d6f063be4160 () mail ! gmail ! com
[Download RAW message or body]

On 20/06/2008, Quintin Beukes <quintin@last.za.net> wrote:
> Hey,
>
>  Yes. I am however synchronizing. I basically made my own connection
>  manager. Then using synchronization to ensure that only one thread
>  gets a reference to a connection. When it does it calls the my
>  connection objec'ts setActive(true). Other threads would do something
>  like "getActive() == false".
>
>  My only explanation is that I'm not synchronizing properly somewhere.
>

You may already have allowed for this: both writes and reads of shared
variables need to be synch (or the variables could be made volatile),
otherwise the reader thread may not see what the writer has written.

>  Q
>
>
>  On Thu, Jun 19, 2008 at 11:44 PM, Oleg Kalnichevski <olegk@apache.org> wrote:
>  > Quintin Beukes wrote:
>  >>
>  >> I'm not sure why accessing it from different threads would cause this
>  >> to happen? Could you explain this please.
>  >>
>  >
>  > Quintin
>  >
>  > I am only guessing here. All I am saying HTTP connection objects are not
>  > threading safe. The only method one can safely can from a different thread
>  > is #shutdown.
>  >
>  > I would certainly help if you managed to reproduce the problem with a test
>  > case.
>  >
>  > Cheers
>  >
>  > Oleg
>  >
>  >
>  >> It is definitely a concurrency issue. I am still narrowing them all down.
>  >>
>  >> thanks,
>  >> Q
>  >>
>  >> On Thu, Jun 19, 2008 at 12:02 AM, Oleg Kalnichevski <olegk@apache.org>
>  >> wrote:
>  >>>
>  >>> On Wed, 2008-06-18 at 22:58 +0200, Quintin Beukes wrote:
>  >>>>
>  >>>> Hey,
>  >>>>
>  >>>> Is it possible for this method (DefaultHttpClientConnection.isOpen())
>  >>>> to return "true" when the socket is closed.
>  >>>>
>  >>> If you are not accessing the same connection instance from multiple
>  >>> threads, I do not see how this could happen.
>  >>>
>  >>> Please note only HttpConnection#shutdown method is expected to be
>  >>> threading safe.
>  >>>
>  >>> This sounds like a concurrency issue to me
>  >>>
>  >>> Oleg
>  >>>
>  >>>> I have a case where netstat doesn't return ANY open connections to the
>  >>>> target server, but isOpen returns true.
>  >>>>
>  >>>> It's not very easy to reproduce my problem, but I've been able to do
>  >>>> it whenever needed by using high concurrency. I'm not sure if isOpen()
>  >>>> ever returns true when there is no socket when it seems like my
>  >>>> problem isn't there. I've only checked when my problem is occurring,
>  >>>> and this seems very odd.
>  >>>>
>  >>>> Thanks
>  >>>
>  >>> ---------------------------------------------------------------------
>  >>> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
>  >>> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>  >>>
>  >>>
>  >>
>  >>
>  >>
>  >
>  >
>  > ---------------------------------------------------------------------
>  > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
>  > For additional commands, e-mail: httpclient-users-help@hc.apache.org
>  >
>  >
>
>
>
>
> --
>
> Quintin Beukes
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
>  For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic