You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@synapse.apache.org by XuHongBo <xu...@tongtech.com> on 2008/03/07 11:24:39 UTC
http-transport-bug fixed
Hi:
I have just post a patch for 2 http-transport-bugs founded. but the patch code style is just work outside the http-core-nio to fixe problem.
Oh.... some of the fixing code I think , should be the responsibility of http-core-nio library, so the fixed code will look like more structurable.
Is there anyone who are familiar with http-core-nio give some advise about if we should waiting for http-core-nio library to be corrected to catch all all network failed in sessionCallback ( now only some exception catched by sessionCallback)?
Or just like the patch code, work outside http-core-nio library?
Re: http-transport-bug fixed
Posted by Oleg Kalnichevski <ol...@apache.org>.
On Sun, 2008-03-09 at 01:12 +0800, xuhongbo wrote:
> Hi, Oleg:
> I feels sorry that I have not expressed clearly.
> >
> > (1) Status of what request are you checking? Client to synapse?
>
> No , not client to synapse, but the request synapse relayed to axisServer
> axisClient--->synapse--->axisServer
>
> I just add code to check the status of http-request relayed from synapse to axisServer .
>
> More details about how to do this is :
> In NHttpClientHandler error report callback, I check if the request sent from synapse to axisServer has finished.Here "finish" means received response back from axisServer;
>
> If finished , synapse will ommit the exception, and just simply close connection. But if not finish , we will not only close http connection, but also we should send back a error-message-context to axisClient.
>
Ok. I see.
>
> Yes, httpCore is and should be a generic http protocol library. And NHttpClientHandler should generally indicate event of protocol level . and it does works very well.
>
> But my matter is while exception occured, I must make sure if the request relayed to axisServer has finished.
> If it's not finished, synapse should send a failure-message-context back to axisClient to indicate the failure.
> ---------------------------------------------------------------------------------------------------------------------
>
> and after I writted the patch, I found that all the patch code's work is just detecting if a http-request send to http-server has received a response , when http connection cannot be used any more (due to exception or time-out).
>
> and the patch code looks very awkward ... ...; so I think if http-core could support Callback to detecting http-request status(yet, I think maybe SessionRequestCallback could do this. (I am not sure about this). but in my test, SessionRequestCallback can only report limited error).
>
>
SessionRequestCall is certainly the wrong place as it has absolutely
nothing to do with HTTP requests.
I suggested an improvement to the Synapse's non-blocking HTTP transport
a while ago, which would make it easier to maintain a conversational
state between client bound and server bound connections:
https://issues.apache.org/jira/browse/SYNAPSE-156
Anyways, feel free to submit a patch with the changes you propose to be
incorporated into HttpCore NIO.
Oleg
>
> >
> > (3) You can use the state of the encoder / decoder passed in the
> > NHttpClientHandler#outputReady() / NHttpServiceHandler#inputReady()
> > events to determine whether a request has been fully sent / received.
> >
> > Hope this helps somewhat
> >
> > Oleg
> >>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@synapse.apache.org
For additional commands, e-mail: dev-help@synapse.apache.org
Re: http-transport-bug fixed
Posted by xuhongbo <xu...@tongtech.com>.
Hi, Oleg:
I feels sorry that I have not expressed clearly.
>
> (1) Status of what request are you checking? Client to synapse?
No , not client to synapse, but the request synapse relayed to axisServer
axisClient--->synapse--->axisServer
I just add code to check the status of http-request relayed from synapse to axisServer .
More details about how to do this is :
In NHttpClientHandler error report callback, I check if the request sent from synapse to axisServer has finished.Here "finish" means received response back from axisServer;
If finished , synapse will ommit the exception, and just simply close connection. But if not finish , we will not only close http connection, but also we should send back a error-message-context to axisClient.
Synapse
> to target server? Do not forget Synapse is a proxy, whereas HttpCore is
> meant to be a generic transport library. It is not meant to provide
> functions applicable to HTTP proxies only.
> (2) NHttpClientConnection handles requests and responses completely
> asynchronously. It can receive several pipelined requests before sending
> out the first response. So, for instance, if an I/O exception occurs
> while sending out a response, there is no point passing the status of
> the _current_ request because there is no guarantee this request
Yes the NHttpClientHandler itself cannot identify which is the _current_request. so I must save the http-request in connection's context( conn.getContext().setAttribute(AXIS2_HTTP_REQUEST, axis2Req),
> corresponds to the failed response. This decision can be made at the
> protocol handler level only.
Yes, httpCore is and should be a generic http protocol library. And NHttpClientHandler should generally indicate event of protocol level . and it does works very well.
But my matter is while exception occured, I must make sure if the request relayed to axisServer has finished.
If it's not finished, synapse should send a failure-message-context back to axisClient to indicate the failure.
---------------------------------------------------------------------------------------------------------------------
and after I writted the patch, I found that all the patch code's work is just detecting if a http-request send to http-server has received a response , when http connection cannot be used any more (due to exception or time-out).
and the patch code looks very awkward ... ...; so I think if http-core could support Callback to detecting http-request status(yet, I think maybe SessionRequestCallback could do this. (I am not sure about this). but in my test, SessionRequestCallback can only report limited error).
>
> (3) You can use the state of the encoder / decoder passed in the
> NHttpClientHandler#outputReady() / NHttpServiceHandler#inputReady()
> events to determine whether a request has been fully sent / received.
>
> Hope this helps somewhat
>
> Oleg
>>
Re: http-transport-bug fixed
Posted by Oleg Kalnichevski <ol...@apache.org>.
On Sat, 2008-03-08 at 10:31 +0800, xuhongbo wrote:
> Hi, Oleg:
> While using synapse-http-transport, I find out that there are two place of code will catched the exception:
> 1) SessionRequestCallback
> 2) ClientHandler( it implements NHttpClientHandler)
> But some exception SessionRequestCallback will catched, for example( Connection Refuse), while some others will be catched by ClientHandler for example: IO-Exception (after socket connected, while sending or receiving data)
>
> As synapse-http-transport original code process the SessionRequestCallback exception correctely. but not correctly process ClientHandler yet. So cannot immediately notify the client some-thing wrong with net-work.
>
> And in the patch for synapse-http-transport, I add code in the ClientHandler's callback (exception, closed, timeout, responseReceived...) to check if the request completed, or set the request to complete status( "complete" means received response from server).
>
> the code looks like :
> void exception(final NHttpClientConnection conn, final IOException e)
> {
> checkAxisRequestComplete(...);//check if completed, if not send a failure message-context back to synapse client
> }
> ....other callback
>
> void responseReceived(..)
> {
> //set Request to complete status ;
> }
>
> The request status check code repeated too much.
> So I think if http-core-nio provided one callback to detect and report http-request's status will be better.
>
> maybe SessionRequestCallback will be a better choice for this, but I am not very sure if SessionRequestCallback's design purpose (in http-core-nio) conflict with this;
>
> xuhongbo
>
Xuhongbo,
(1) Status of what request are you checking? Client to synapse? Synapse
to target server? Do not forget Synapse is a proxy, whereas HttpCore is
meant to be a generic transport library. It is not meant to provide
functions applicable to HTTP proxies only.
(2) NHttpClientConnection handles requests and responses completely
asynchronously. It can receive several pipelined requests before sending
out the first response. So, for instance, if an I/O exception occurs
while sending out a response, there is no point passing the status of
the _current_ request because there is no guarantee this request
corresponds to the failed response. This decision can be made at the
protocol handler level only.
(3) You can use the state of the encoder / decoder passed in the
NHttpClientHandler#outputReady() / NHttpServiceHandler#inputReady()
events to determine whether a request has been fully sent / received.
Hope this helps somewhat
Oleg
>
>
> ----- Original Message -----
> From: "Oleg Kalnichevski" <ol...@apache.org>
> To: <de...@synapse.apache.org>
> Sent: Saturday, March 08, 2008 3:49 AM
> Subject: Re: http-transport-bug fixed
>
>
> >
> > On Fri, 2008-03-07 at 18:24 +0800, XuHongBo wrote:
> >> Hi:
> >> I have just post a patch for 2 http-transport-bugs founded. but the patch code style is just work outside the http-core-nio to fixe problem.
> >>
> >> Oh.... some of the fixing code I think , should be the responsibility of http-core-nio library, so the fixed code will look like more structurable.
> >>
> >> Is there anyone who are familiar with http-core-nio give some advise about if we should waiting for http-core-nio library to be corrected to catch all all network failed in sessionCallback ( now only some exception catched by sessionCallback)?
> >>
> >
> > Hi Xuhongbo
> >
> > I guess I qualify as someone familiar. I am not sure I fully understand
> > the problem. Could you please give me a little more details as to what
> > kind of exceptions you think should be handled by HttpCore
> > automatically?
> >
> > Oleg
> >
> >> Or just like the patch code, work outside http-core-nio library?
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@synapse.apache.org
> > For additional commands, e-mail: dev-help@synapse.apache.org
> >
> >
> >
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@synapse.apache.org
For additional commands, e-mail: dev-help@synapse.apache.org
Re: http-transport-bug fixed
Posted by xuhongbo <xu...@tongtech.com>.
Hi, Oleg:
While using synapse-http-transport, I find out that there are two place of code will catched the exception:
1) SessionRequestCallback
2) ClientHandler( it implements NHttpClientHandler)
But some exception SessionRequestCallback will catched, for example( Connection Refuse), while some others will be catched by ClientHandler for example: IO-Exception (after socket connected, while sending or receiving data)
As synapse-http-transport original code process the SessionRequestCallback exception correctely. but not correctly process ClientHandler yet. So cannot immediately notify the client some-thing wrong with net-work.
And in the patch for synapse-http-transport, I add code in the ClientHandler's callback (exception, closed, timeout, responseReceived...) to check if the request completed, or set the request to complete status( "complete" means received response from server).
the code looks like :
void exception(final NHttpClientConnection conn, final IOException e)
{
checkAxisRequestComplete(...);//check if completed, if not send a failure message-context back to synapse client
}
....other callback
void responseReceived(..)
{
//set Request to complete status ;
}
The request status check code repeated too much.
So I think if http-core-nio provided one callback to detect and report http-request's status will be better.
maybe SessionRequestCallback will be a better choice for this, but I am not very sure if SessionRequestCallback's design purpose (in http-core-nio) conflict with this;
xuhongbo
----- Original Message -----
From: "Oleg Kalnichevski" <ol...@apache.org>
To: <de...@synapse.apache.org>
Sent: Saturday, March 08, 2008 3:49 AM
Subject: Re: http-transport-bug fixed
>
> On Fri, 2008-03-07 at 18:24 +0800, XuHongBo wrote:
>> Hi:
>> I have just post a patch for 2 http-transport-bugs founded. but the patch code style is just work outside the http-core-nio to fixe problem.
>>
>> Oh.... some of the fixing code I think , should be the responsibility of http-core-nio library, so the fixed code will look like more structurable.
>>
>> Is there anyone who are familiar with http-core-nio give some advise about if we should waiting for http-core-nio library to be corrected to catch all all network failed in sessionCallback ( now only some exception catched by sessionCallback)?
>>
>
> Hi Xuhongbo
>
> I guess I qualify as someone familiar. I am not sure I fully understand
> the problem. Could you please give me a little more details as to what
> kind of exceptions you think should be handled by HttpCore
> automatically?
>
> Oleg
>
>> Or just like the patch code, work outside http-core-nio library?
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@synapse.apache.org
> For additional commands, e-mail: dev-help@synapse.apache.org
>
>
>
Re: http-transport-bug fixed
Posted by Oleg Kalnichevski <ol...@apache.org>.
On Fri, 2008-03-07 at 18:24 +0800, XuHongBo wrote:
> Hi:
> I have just post a patch for 2 http-transport-bugs founded. but the patch code style is just work outside the http-core-nio to fixe problem.
>
> Oh.... some of the fixing code I think , should be the responsibility of http-core-nio library, so the fixed code will look like more structurable.
>
> Is there anyone who are familiar with http-core-nio give some advise about if we should waiting for http-core-nio library to be corrected to catch all all network failed in sessionCallback ( now only some exception catched by sessionCallback)?
>
Hi Xuhongbo
I guess I qualify as someone familiar. I am not sure I fully understand
the problem. Could you please give me a little more details as to what
kind of exceptions you think should be handled by HttpCore
automatically?
Oleg
> Or just like the patch code, work outside http-core-nio library?
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@synapse.apache.org
For additional commands, e-mail: dev-help@synapse.apache.org
Re: http-transport-bug fixed
Posted by xuhongbo <xu...@tongtech.com>.
Thansk asankha
previously I am not very care about my name while using xuhongbo in mail, HongBo Xu in JIRA ... :( .
and I will unify the name as "xuhongbo", both in mail and JIRA
----- Original Message -----
From: "Asankha C. Perera" <as...@wso2.com>
To: <de...@synapse.apache.org>
Sent: Friday, March 07, 2008 7:22 PM
Subject: Re: http-transport-bug fixed
> Hi XuHongBo
>
> I hope I got your name correctly and my apologies if I didn't..
>
>> I have just post a patch for 2 http-transport-bugs founded. but the patch code style is just work outside the http-core-nio to fixe problem.
>>
>> Oh.... some of the fixing code I think , should be the responsibility of http-core-nio library, so the fixed code will look like more structurable.
>>
> Cool, and thanks.. I will have a look at this and get back to you..
>> Is there anyone who are familiar with http-core-nio give some advise about if we should waiting for http-core-nio library to be corrected to catch all all network failed in sessionCallback ( now only some exception catched by sessionCallback)?
>>
>> Or just like the patch code, work outside http-core-nio library?
>>
> Well Oleg who is a committer of Synapse leads the Apache HttpComponents
> development and I am a commiter of HttpComponents as well. So between
> the two of us we should be able to get the right balance. Anyway, I will
> first go through your patch and get back by early next week..
>
> asankha
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@synapse.apache.org
> For additional commands, e-mail: dev-help@synapse.apache.org
>
>
>
Re: http-transport-bug fixed
Posted by "Asankha C. Perera" <as...@wso2.com>.
Hi XuHongBo
I hope I got your name correctly and my apologies if I didn't..
> I have just post a patch for 2 http-transport-bugs founded. but the patch code style is just work outside the http-core-nio to fixe problem.
>
> Oh.... some of the fixing code I think , should be the responsibility of http-core-nio library, so the fixed code will look like more structurable.
>
Cool, and thanks.. I will have a look at this and get back to you..
> Is there anyone who are familiar with http-core-nio give some advise about if we should waiting for http-core-nio library to be corrected to catch all all network failed in sessionCallback ( now only some exception catched by sessionCallback)?
>
> Or just like the patch code, work outside http-core-nio library?
>
Well Oleg who is a committer of Synapse leads the Apache HttpComponents
development and I am a commiter of HttpComponents as well. So between
the two of us we should be able to get the right balance. Anyway, I will
first go through your patch and get back by early next week..
asankha
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@synapse.apache.org
For additional commands, e-mail: dev-help@synapse.apache.org