You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@chemistry.apache.org by "Inouye, Brian" <Br...@xerox.com> on 2014/06/12 02:47:14 UTC
Odd behavior when Android OpenCMIS Client reuses a connection that
server tried to close
In our Android Client, using OpenCMIS 0.10.0 and AtomPub binding, we see OpenCMIS attempt to reuse a TCP connection that the server has tried to close. In response to the Client trying to reuse a connection that it tried to close, the server correctly replies with a TCP RST. We then see the Android Client respond in different ways depending on what type of request it was attempting to send on the TCP connection.
Case 1: If the Client was trying to do a getChildren, OpenCMIS closes the connection that the server was trying to close, opens a new connection and uses that connection for the GetChildren request. The request succeeds and everyone is happy.
Case 2: If the Client was trying to do a createDocument, OpenCMIS does NOT close the connection that the server was trying to close. It opens a new connection, but then unexpectedly closes it immediately after opening it. Is it confused and closing the wrong connection? At this point, there's no connection available for it to use. Eventually, OpenCMIS throws a "CmisConstraintException: Conflict". The request fails and nobody is happy.
I have Wireshark captures that clearly show the above behaviors which I can make available.
Is this a known issue? I didn't see anything in Jira that resembles it. Please let me know how I should proceed in getting this resolved. Thanks!
... Brian ...
Xerox Corporation
Palo Alto, California
RE: Odd behavior when Android OpenCMIS Client reuses a connection that server tried to close
Posted by Florian Müller <fm...@apache.org>.
Thanks!
I'll change the OpenCMIS code accordingly.
- Florian
> Hi Florian,
>
> Here is what the engineer investigating the issue discovered
> regarding the different versions.
>
> > If you mean the
>
> org.apache.chemistry.opencmis.client.bindings.spi.http.ApacheClientHttpInvoker
> > (uses the org.apache.http.impl.client.DefaultHttpClient under the
> hood), then since this class
> > is a CMIS library class - we would see the issue on every Android
> version. To fix the CMIS
> > library they need to set the
> HttpConnectionParams.setStaleCheckingEnabled(params, true).
> >
> > And if you mean our custom HttpInvoker (uses the
> android.net.http.AndroidHttpClient), then
> > I looked at Android sources starting from 4.0.1 and up to current
> 4.4.2
> >
>
> (http://grepcode.com/search?query=android.net.http.AndroidHttpClient&start=0&entity=type&n=)
> > - all the checked versions have
> HttpConnectionParams.setStaleCheckingEnabled(params, false).
>
> ... Brian ...
>
> -----Original Message-----
> From: Florian Müller [mailto:fmui@apache.org]
> Sent: Friday, June 13, 2014 1:42 PM
> To: dev@chemistry.apache.org
> Cc: Inouye, Brian; Vitaliy Khudenko
> Subject: Re: Odd behavior when Android OpenCMIS Client reuses a
> connection that server tried to close
>
> Thanks for the update. Which Android version are you using?
> If that solves the problem, we might also be defensive in OpenCMIS
> and enable the stale connection check by default.
>
> - Florian
>
>
>> Hi Florian,
>>
>> Just for the record, I wanted to let you know how we resolved the
>> problem with the Android OpenCMIS Client reusing a stale connection.
>> We created a custom HttpInvoker that uses
>> android.net.http.AndroidHttpClient under the hood. We enabled the
>> "stale checking" connection setting via:
>>
>> HttpConnectionParams.setStaleCheckingEnabled(params, true);
>>
>> This resolved the problem. The API for this setting says:
>>
>> This setting defines whether stale connection check is to be used.
>> Disabling stale connection check may result in slight performance
>> improvement at the risk of getting an I/O error when executing a
>> request over a connection that has been closed at the server side.
>>
>> ... Brian ...
>> Xerox Corporation
>> Palo Alto, California
>>
>> -----Original Message-----
>> From: Inouye, Brian
>> Sent: Thursday, June 12, 2014 9:52 AM
>> To: 'Florian Müller'; dev@chemistry.apache.org
>> Cc: Vitaliy Khudenko
>> Subject: RE: Odd behavior when Android OpenCMIS Client reuses a
>> connection that server tried to close
>>
>> Hi Florian,
>>
>> Thank you very much for the advice! We will consult with Android
>> developer support on how we can resolve this issue.
>>
>> I know in one case we are definitely using a proxy server. I'll see
>> if we can try without a proxy server.
>>
>> ... Brian ...
>>
>> -----Original Message-----
>> From: Florian Müller [mailto:fmui@apache.org]
>> Sent: Thursday, June 12, 2014 1:35 AM
>> To: dev@chemistry.apache.org
>> Cc: Inouye, Brian; Vitaliy Khudenko
>> Subject: Re: Odd behavior when Android OpenCMIS Client reuses a
>> connection that server tried to close
>>
>> Hi Brian,
>>
>> OpenCMIS uses the Android HTTP client library and doesn't control
>> the TCP connections directly. What you described happens a level
>> below OpenCMIS.
>> The Android HTTP client has known issues and those issues vary with
>> the Android version. To find a solution to this specific problem,
>> please refer to the Android documentation.
>> There seems to be an issue with HTTP POST (-> createDocument)
>> somewhere. Are you using a proxy server? If so, can you retry without
>> it?
>>
>> There are actually two HTTP client libraries in Android. OpenCMIS
>> uses by default the library recommended for Gingerbread and better.
>> You can switch to the older library by setting the session
>> parameter HTTP_INVOKER_CLASS to
>> "org.apache.chemistry.opencmis.client.bindings.spi.http.ApacheClientHttpInvoker".
>> That may solve this issue ... and create others.
>>
>>
>> - Florian
>>
>>
>>> In our Android Client, using OpenCMIS 0.10.0 and AtomPub binding,
>>> we
>>> see OpenCMIS attempt to reuse a TCP connection that the server has
>>> tried to close. In response to the Client trying to reuse a
>>> connection that it tried to close, the server correctly replies
>>> with
>>> a TCP RST. We then see the Android Client respond in different
>>> ways
>>> depending on what type of request it was attempting to send on the
>>> TCP connection.
>>>
>>> Case 1: If the Client was trying to do a getChildren, OpenCMIS
>>> closes
>>> the connection that the server was trying to close, opens a new
>>> connection and uses that connection for the GetChildren request.
>>> The
>>> request succeeds and everyone is happy.
>>>
>>> Case 2: If the Client was trying to do a createDocument, OpenCMIS
>>> does NOT close the connection that the server was trying to close.
>>> It
>>> opens a new connection, but then unexpectedly closes it immediately
>>> after opening it. Is it confused and closing the wrong connection?
>>> At this point, there's no connection available for it to use.
>>> Eventually, OpenCMIS throws a "CmisConstraintException: Conflict".
>>> The request fails and nobody is happy.
>>>
>>> I have Wireshark captures that clearly show the above behaviors
>>> which
>>> I can make available.
>>>
>>> Is this a known issue? I didn't see anything in Jira that
>>> resembles
>>> it. Please let me know how I should proceed in getting this
>>> resolved.
>>> Thanks!
>>>
>>> ... Brian ...
>>> Xerox Corporation
>>> Palo Alto, California
>>
RE: Odd behavior when Android OpenCMIS Client reuses a connection
that server tried to close
Posted by "Inouye, Brian" <Br...@xerox.com>.
Hi Florian,
Here is what the engineer investigating the issue discovered regarding the different versions.
> If you mean the org.apache.chemistry.opencmis.client.bindings.spi.http.ApacheClientHttpInvoker
> (uses the org.apache.http.impl.client.DefaultHttpClient under the hood), then since this class
> is a CMIS library class - we would see the issue on every Android version. To fix the CMIS
> library they need to set the HttpConnectionParams.setStaleCheckingEnabled(params, true).
>
> And if you mean our custom HttpInvoker (uses the android.net.http.AndroidHttpClient), then
> I looked at Android sources starting from 4.0.1 and up to current 4.4.2
> (http://grepcode.com/search?query=android.net.http.AndroidHttpClient&start=0&entity=type&n=)
> - all the checked versions have HttpConnectionParams.setStaleCheckingEnabled(params, false).
... Brian ...
-----Original Message-----
From: Florian Müller [mailto:fmui@apache.org]
Sent: Friday, June 13, 2014 1:42 PM
To: dev@chemistry.apache.org
Cc: Inouye, Brian; Vitaliy Khudenko
Subject: Re: Odd behavior when Android OpenCMIS Client reuses a connection that server tried to close
Thanks for the update. Which Android version are you using?
If that solves the problem, we might also be defensive in OpenCMIS and enable the stale connection check by default.
- Florian
> Hi Florian,
>
> Just for the record, I wanted to let you know how we resolved the problem with the Android OpenCMIS Client reusing a stale connection. We created a custom HttpInvoker that uses android.net.http.AndroidHttpClient under the hood. We enabled the "stale checking" connection setting via:
>
> HttpConnectionParams.setStaleCheckingEnabled(params, true);
>
> This resolved the problem. The API for this setting says:
>
> This setting defines whether stale connection check is to be used. Disabling stale connection check may result in slight performance improvement at the risk of getting an I/O error when executing a request over a connection that has been closed at the server side.
>
> ... Brian ...
> Xerox Corporation
> Palo Alto, California
>
> -----Original Message-----
> From: Inouye, Brian
> Sent: Thursday, June 12, 2014 9:52 AM
> To: 'Florian Müller'; dev@chemistry.apache.org
> Cc: Vitaliy Khudenko
> Subject: RE: Odd behavior when Android OpenCMIS Client reuses a
> connection that server tried to close
>
> Hi Florian,
>
> Thank you very much for the advice! We will consult with Android developer support on how we can resolve this issue.
>
> I know in one case we are definitely using a proxy server. I'll see if we can try without a proxy server.
>
> ... Brian ...
>
> -----Original Message-----
> From: Florian Müller [mailto:fmui@apache.org]
> Sent: Thursday, June 12, 2014 1:35 AM
> To: dev@chemistry.apache.org
> Cc: Inouye, Brian; Vitaliy Khudenko
> Subject: Re: Odd behavior when Android OpenCMIS Client reuses a
> connection that server tried to close
>
> Hi Brian,
>
> OpenCMIS uses the Android HTTP client library and doesn't control the TCP connections directly. What you described happens a level below OpenCMIS.
> The Android HTTP client has known issues and those issues vary with the Android version. To find a solution to this specific problem, please refer to the Android documentation.
> There seems to be an issue with HTTP POST (-> createDocument) somewhere. Are you using a proxy server? If so, can you retry without it?
>
> There are actually two HTTP client libraries in Android. OpenCMIS uses by default the library recommended for Gingerbread and better.
> You can switch to the older library by setting the session parameter HTTP_INVOKER_CLASS to "org.apache.chemistry.opencmis.client.bindings.spi.http.ApacheClientHttpInvoker".
> That may solve this issue ... and create others.
>
>
> - Florian
>
>
>> In our Android Client, using OpenCMIS 0.10.0 and AtomPub binding, we
>> see OpenCMIS attempt to reuse a TCP connection that the server has
>> tried to close. In response to the Client trying to reuse a
>> connection that it tried to close, the server correctly replies with
>> a TCP RST. We then see the Android Client respond in different ways
>> depending on what type of request it was attempting to send on the
>> TCP connection.
>>
>> Case 1: If the Client was trying to do a getChildren, OpenCMIS closes
>> the connection that the server was trying to close, opens a new
>> connection and uses that connection for the GetChildren request. The
>> request succeeds and everyone is happy.
>>
>> Case 2: If the Client was trying to do a createDocument, OpenCMIS
>> does NOT close the connection that the server was trying to close.
>> It
>> opens a new connection, but then unexpectedly closes it immediately
>> after opening it. Is it confused and closing the wrong connection?
>> At this point, there's no connection available for it to use.
>> Eventually, OpenCMIS throws a "CmisConstraintException: Conflict".
>> The request fails and nobody is happy.
>>
>> I have Wireshark captures that clearly show the above behaviors which
>> I can make available.
>>
>> Is this a known issue? I didn't see anything in Jira that resembles
>> it. Please let me know how I should proceed in getting this resolved.
>> Thanks!
>>
>> ... Brian ...
>> Xerox Corporation
>> Palo Alto, California
>
Re: Odd behavior when Android OpenCMIS Client reuses a connection
that server tried to close
Posted by Florian Müller <fm...@apache.org>.
Thanks for the update. Which Android version are you using?
If that solves the problem, we might also be defensive in OpenCMIS and
enable the stale connection check by default.
- Florian
> Hi Florian,
>
> Just for the record, I wanted to let you know how we resolved the problem with the Android OpenCMIS Client reusing a stale connection. We created a custom HttpInvoker that uses android.net.http.AndroidHttpClient under the hood. We enabled the "stale checking" connection setting via:
>
> HttpConnectionParams.setStaleCheckingEnabled(params, true);
>
> This resolved the problem. The API for this setting says:
>
> This setting defines whether stale connection check is to be used. Disabling stale connection check may result in slight performance improvement at the risk of getting an I/O error when executing a request over a connection that has been closed at the server side.
>
> ... Brian ...
> Xerox Corporation
> Palo Alto, California
>
> -----Original Message-----
> From: Inouye, Brian
> Sent: Thursday, June 12, 2014 9:52 AM
> To: 'Florian Müller'; dev@chemistry.apache.org
> Cc: Vitaliy Khudenko
> Subject: RE: Odd behavior when Android OpenCMIS Client reuses a connection that server tried to close
>
> Hi Florian,
>
> Thank you very much for the advice! We will consult with Android developer support on how we can resolve this issue.
>
> I know in one case we are definitely using a proxy server. I'll see if we can try without a proxy server.
>
> ... Brian ...
>
> -----Original Message-----
> From: Florian Müller [mailto:fmui@apache.org]
> Sent: Thursday, June 12, 2014 1:35 AM
> To: dev@chemistry.apache.org
> Cc: Inouye, Brian; Vitaliy Khudenko
> Subject: Re: Odd behavior when Android OpenCMIS Client reuses a connection that server tried to close
>
> Hi Brian,
>
> OpenCMIS uses the Android HTTP client library and doesn't control the TCP connections directly. What you described happens a level below OpenCMIS.
> The Android HTTP client has known issues and those issues vary with the Android version. To find a solution to this specific problem, please refer to the Android documentation.
> There seems to be an issue with HTTP POST (-> createDocument) somewhere. Are you using a proxy server? If so, can you retry without it?
>
> There are actually two HTTP client libraries in Android. OpenCMIS uses by default the library recommended for Gingerbread and better.
> You can switch to the older library by setting the session parameter HTTP_INVOKER_CLASS to "org.apache.chemistry.opencmis.client.bindings.spi.http.ApacheClientHttpInvoker".
> That may solve this issue ... and create others.
>
>
> - Florian
>
>
>> In our Android Client, using OpenCMIS 0.10.0 and AtomPub binding, we
>> see OpenCMIS attempt to reuse a TCP connection that the server has
>> tried to close. In response to the Client trying to reuse a
>> connection that it tried to close, the server correctly replies with a
>> TCP RST. We then see the Android Client respond in different ways
>> depending on what type of request it was attempting to send on the TCP
>> connection.
>>
>> Case 1: If the Client was trying to do a getChildren, OpenCMIS closes
>> the connection that the server was trying to close, opens a new
>> connection and uses that connection for the GetChildren request. The
>> request succeeds and everyone is happy.
>>
>> Case 2: If the Client was trying to do a createDocument, OpenCMIS does
>> NOT close the connection that the server was trying to close.
>> It
>> opens a new connection, but then unexpectedly closes it immediately
>> after opening it. Is it confused and closing the wrong connection?
>> At this point, there's no connection available for it to use.
>> Eventually, OpenCMIS throws a "CmisConstraintException: Conflict".
>> The request fails and nobody is happy.
>>
>> I have Wireshark captures that clearly show the above behaviors which
>> I can make available.
>>
>> Is this a known issue? I didn't see anything in Jira that resembles
>> it. Please let me know how I should proceed in getting this resolved.
>> Thanks!
>>
>> ... Brian ...
>> Xerox Corporation
>> Palo Alto, California
>
RE: Odd behavior when Android OpenCMIS Client reuses a connection
that server tried to close
Posted by "Inouye, Brian" <Br...@xerox.com>.
Hi Florian,
Just for the record, I wanted to let you know how we resolved the problem with the Android OpenCMIS Client reusing a stale connection. We created a custom HttpInvoker that uses android.net.http.AndroidHttpClient under the hood. We enabled the "stale checking" connection setting via:
HttpConnectionParams.setStaleCheckingEnabled(params, true);
This resolved the problem. The API for this setting says:
This setting defines whether stale connection check is to be used. Disabling stale connection check may result in slight performance improvement at the risk of getting an I/O error when executing a request over a connection that has been closed at the server side.
... Brian ...
Xerox Corporation
Palo Alto, California
-----Original Message-----
From: Inouye, Brian
Sent: Thursday, June 12, 2014 9:52 AM
To: 'Florian Müller'; dev@chemistry.apache.org
Cc: Vitaliy Khudenko
Subject: RE: Odd behavior when Android OpenCMIS Client reuses a connection that server tried to close
Hi Florian,
Thank you very much for the advice! We will consult with Android developer support on how we can resolve this issue.
I know in one case we are definitely using a proxy server. I'll see if we can try without a proxy server.
... Brian ...
-----Original Message-----
From: Florian Müller [mailto:fmui@apache.org]
Sent: Thursday, June 12, 2014 1:35 AM
To: dev@chemistry.apache.org
Cc: Inouye, Brian; Vitaliy Khudenko
Subject: Re: Odd behavior when Android OpenCMIS Client reuses a connection that server tried to close
Hi Brian,
OpenCMIS uses the Android HTTP client library and doesn't control the TCP connections directly. What you described happens a level below OpenCMIS.
The Android HTTP client has known issues and those issues vary with the Android version. To find a solution to this specific problem, please refer to the Android documentation.
There seems to be an issue with HTTP POST (-> createDocument) somewhere. Are you using a proxy server? If so, can you retry without it?
There are actually two HTTP client libraries in Android. OpenCMIS uses by default the library recommended for Gingerbread and better.
You can switch to the older library by setting the session parameter HTTP_INVOKER_CLASS to "org.apache.chemistry.opencmis.client.bindings.spi.http.ApacheClientHttpInvoker".
That may solve this issue ... and create others.
- Florian
> In our Android Client, using OpenCMIS 0.10.0 and AtomPub binding, we
> see OpenCMIS attempt to reuse a TCP connection that the server has
> tried to close. In response to the Client trying to reuse a
> connection that it tried to close, the server correctly replies with a
> TCP RST. We then see the Android Client respond in different ways
> depending on what type of request it was attempting to send on the TCP
> connection.
>
> Case 1: If the Client was trying to do a getChildren, OpenCMIS closes
> the connection that the server was trying to close, opens a new
> connection and uses that connection for the GetChildren request. The
> request succeeds and everyone is happy.
>
> Case 2: If the Client was trying to do a createDocument, OpenCMIS does
> NOT close the connection that the server was trying to close.
> It
> opens a new connection, but then unexpectedly closes it immediately
> after opening it. Is it confused and closing the wrong connection?
> At this point, there's no connection available for it to use.
> Eventually, OpenCMIS throws a "CmisConstraintException: Conflict".
> The request fails and nobody is happy.
>
> I have Wireshark captures that clearly show the above behaviors which
> I can make available.
>
> Is this a known issue? I didn't see anything in Jira that resembles
> it. Please let me know how I should proceed in getting this resolved.
> Thanks!
>
> ... Brian ...
> Xerox Corporation
> Palo Alto, California
RE: Odd behavior when Android OpenCMIS Client reuses a connection
that server tried to close
Posted by "Inouye, Brian" <Br...@xerox.com>.
Hi Florian,
Thank you very much for the advice! We will consult with Android developer support on how we can resolve this issue.
I know in one case we are definitely using a proxy server. I'll see if we can try without a proxy server.
... Brian ...
-----Original Message-----
From: Florian Müller [mailto:fmui@apache.org]
Sent: Thursday, June 12, 2014 1:35 AM
To: dev@chemistry.apache.org
Cc: Inouye, Brian; Vitaliy Khudenko
Subject: Re: Odd behavior when Android OpenCMIS Client reuses a connection that server tried to close
Hi Brian,
OpenCMIS uses the Android HTTP client library and doesn't control the TCP connections directly. What you described happens a level below OpenCMIS.
The Android HTTP client has known issues and those issues vary with the Android version. To find a solution to this specific problem, please refer to the Android documentation.
There seems to be an issue with HTTP POST (-> createDocument) somewhere. Are you using a proxy server? If so, can you retry without it?
There are actually two HTTP client libraries in Android. OpenCMIS uses by default the library recommended for Gingerbread and better.
You can switch to the older library by setting the session parameter HTTP_INVOKER_CLASS to "org.apache.chemistry.opencmis.client.bindings.spi.http.ApacheClientHttpInvoker".
That may solve this issue ... and create others.
- Florian
> In our Android Client, using OpenCMIS 0.10.0 and AtomPub binding, we
> see OpenCMIS attempt to reuse a TCP connection that the server has
> tried to close. In response to the Client trying to reuse a
> connection that it tried to close, the server correctly replies with a
> TCP RST. We then see the Android Client respond in different ways
> depending on what type of request it was attempting to send on the TCP
> connection.
>
> Case 1: If the Client was trying to do a getChildren, OpenCMIS closes
> the connection that the server was trying to close, opens a new
> connection and uses that connection for the GetChildren request. The
> request succeeds and everyone is happy.
>
> Case 2: If the Client was trying to do a createDocument, OpenCMIS does
> NOT close the connection that the server was trying to close.
> It
> opens a new connection, but then unexpectedly closes it immediately
> after opening it. Is it confused and closing the wrong connection?
> At this point, there's no connection available for it to use.
> Eventually, OpenCMIS throws a "CmisConstraintException: Conflict".
> The request fails and nobody is happy.
>
> I have Wireshark captures that clearly show the above behaviors which
> I can make available.
>
> Is this a known issue? I didn't see anything in Jira that resembles
> it. Please let me know how I should proceed in getting this resolved.
> Thanks!
>
> ... Brian ...
> Xerox Corporation
> Palo Alto, California
Re: Odd behavior when Android OpenCMIS Client reuses a connection that server tried to close
Posted by Florian Müller <fm...@apache.org>.
Hi Brian,
OpenCMIS uses the Android HTTP client library and doesn't control the
TCP connections directly. What you described happens a level below
OpenCMIS.
The Android HTTP client has known issues and those issues vary with the
Android version. To find a solution to this specific problem, please
refer to the Android documentation.
There seems to be an issue with HTTP POST (-> createDocument)
somewhere. Are you using a proxy server? If so, can you retry without
it?
There are actually two HTTP client libraries in Android. OpenCMIS uses
by default the library recommended for Gingerbread and better.
You can switch to the older library by setting the session parameter
HTTP_INVOKER_CLASS to
"org.apache.chemistry.opencmis.client.bindings.spi.http.ApacheClientHttpInvoker".
That may solve this issue ... and create others.
- Florian
> In our Android Client, using OpenCMIS 0.10.0 and AtomPub binding, we
> see OpenCMIS attempt to reuse a TCP connection that the server has
> tried to close. In response to the Client trying to reuse a
> connection that it tried to close, the server correctly replies with
> a
> TCP RST. We then see the Android Client respond in different ways
> depending on what type of request it was attempting to send on the
> TCP
> connection.
>
> Case 1: If the Client was trying to do a getChildren, OpenCMIS closes
> the connection that the server was trying to close, opens a new
> connection and uses that connection for the GetChildren request. The
> request succeeds and everyone is happy.
>
> Case 2: If the Client was trying to do a createDocument, OpenCMIS
> does NOT close the connection that the server was trying to close.
> It
> opens a new connection, but then unexpectedly closes it immediately
> after opening it. Is it confused and closing the wrong connection?
> At this point, there's no connection available for it to use.
> Eventually, OpenCMIS throws a "CmisConstraintException: Conflict".
> The request fails and nobody is happy.
>
> I have Wireshark captures that clearly show the above behaviors which
> I can make available.
>
> Is this a known issue? I didn't see anything in Jira that resembles
> it. Please let me know how I should proceed in getting this
> resolved.
> Thanks!
>
> ... Brian ...
> Xerox Corporation
> Palo Alto, California