You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Giorgio Zoppi <gi...@gmail.com> on 2007/09/21 23:46:36 UTC

Asynchronous Invocation Bug.

Hi,
i've found the bug that it doens't permit myself to use SCA Binding over 
WebService modifying the distributed-calculator. I found it (on Tuscany 
1.0 rc3) following the chain towards the wire, and i discovered that 
it's an Axis Fault. If you modify in your distributed calculator sample 
the SubtractionService in the following way:
@Remotable
public interface SubtractService {
    @OneWay
    void subtract(double n1, double n2);

}
public class SubtractServiceImpl implements SubtractService {

    public void subtract(double n1, double n2) {
        System.out.println("SubtractService - subtract " + n1 + " and " 
+ n2);
        //return n1 - n2;
    }

}
I know that it doesn't nothing...but it's a proof of concept.
And in the calculator node:

 for (int k = 0; k < 10; ++k)
                    calculatorService.subtract(2*k+3, k);


The nodeC with current Axis2OneWayBindingInvoker, even if it's called 10 
times..the receiver gets two messages..
So in the nodeC terminal you can see only for example:

[java] SubtractService - subtract 15.0 and 6.0
[java] SubtractService - subtract 17.0 and 7.0

The reason is due to the Axis HTTP REUSE:
If you change in Axis2OneWayBindingInvoker

 requestMC.getOptions().setProperty(HTTPConstants.REUSE_HTTP_CLIENT, 
Boolean.TRUE);

to:
 requestMC.getOptions().setProperty(HTTPConstants.REUSE_HTTP_CLIENT, 
Boolean.FALSE);

It works! I suspect that there's a bug or a queue full in Axis because 
it seems that if you send something too fast it doesn't work (I'll see 
it tomorrow, because I don't know how the http client reuse works in Axis).

The next test, I'll do it :
for (int k = 0; k < 50; ++k)
                    calculatorService.subtract(2*k+3, k);
It seems to work, but in a strange way.

During the debugging i discovered your nice structure in order to invoke 
methods over ws.
Mainly for the Remote SCA over Web Services your structure has the 
following stages (correct me if i'm wrong):

1) JDKInvocationHandler, where you proxies the method call, create the 
message, set the source, the target and the operation. Here still you do 
some sort of initialization for handling callback.
2) DataTrasformationInterceptor, where you create the soap body of the 
message given the operation and parameters, for example:
<_ns_:add 
xmlns:_ns_="http://calculator/xsd"><_ns_:param0>3.0</_ns_:param0><_ns_:p
aram1>2.0</_ns_:param1></_ns_:add>
3) NonblockingInterceptor, where Tuscany schedules invocation in a 
workpool (here with jdk 1.5 , you could remove dependency from commonj 
package)
4) At time of scheduling, the next invoker is Axis2SCABindingInvoker, 
which it's a wrapper for Axis2BindingInvoker if the invocation is 
Request-response or for the Axis2BindingInvoker's child 
(Axis2OneWayBindingInvoker) if the invocation is OneWay. In 
Axis2*BindingInvoker you create the soap envelope,  the Axis's 
OperationClient, set the axis invocation options and Axis's 
MessageContext and the you send all the stuff on the wire.
Just to know, Can i use the same callback between a client component and 
k service components?
Cheers,
Jo



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


Re: Asynchronous Invocation Bug.

Posted by Simon Laws <si...@googlemail.com>.
On 9/24/07, Simon Laws <si...@googlemail.com> wrote:
>
>
>
> On 9/21/07, Giorgio Zoppi <gi...@gmail.com> wrote:
> >
> > Hi,
> > i've found the bug that it doens't permit myself to use SCA Binding over
> > WebService modifying the distributed-calculator. I found it (on Tuscany
> > 1.0 rc3) following the chain towards the wire, and i discovered that
> > it's an Axis Fault. If you modify in your distributed calculator sample
> > the SubtractionService in the following way:
> > @Remotable
> > public interface SubtractService {
> >     @OneWay
> >     void subtract(double n1, double n2);
> >
> > }
> > public class SubtractServiceImpl implements SubtractService {
> >
> >     public void subtract(double n1, double n2) {
> >         System.out.println("SubtractService - subtract " + n1 + " and "
> > + n2);
> >         //return n1 - n2;
> >     }
> >
> > }
> > I know that it doesn't nothing...but it's a proof of concept.
> > And in the calculator node:
> >
> > for (int k = 0; k < 10; ++k)
> >                      calculatorService.subtract(2*k+3, k);
> >
> >
> > The nodeC with current Axis2OneWayBindingInvoker, even if it's called 10
> > times..the receiver gets two messages..
> > So in the nodeC terminal you can see only for example:
> >
> > [java] SubtractService - subtract 15.0 and 6.0
> > [java] SubtractService - subtract 17.0 and 7.0
> >
> > The reason is due to the Axis HTTP REUSE:
> > If you change in Axis2OneWayBindingInvoker
> >
> > requestMC.getOptions ().setProperty(HTTPConstants.REUSE_HTTP_CLIENT,
> > Boolean.TRUE);
> >
> > to:
> > requestMC.getOptions().setProperty(HTTPConstants.REUSE_HTTP_CLIENT,
> > Boolean.FALSE);
> >
> > It works! I suspect that there's a bug or a queue full in Axis because
> > it seems that if you send something too fast it doesn't work (I'll see
> > it tomorrow, because I don't know how the http client reuse works in
> > Axis).
> >
> > The next test, I'll do it :
> > for (int k = 0; k < 50; ++k)
> >                     calculatorService.subtract(2*k+3, k);
> > It seems to work, but in a strange way.
> >
> > During the debugging i discovered your nice structure in order to invoke
> > methods over ws.
> > Mainly for the Remote SCA over Web Services your structure has the
> > following stages (correct me if i'm wrong):
> >
> > 1) JDKInvocationHandler, where you proxies the method call, create the
> > message, set the source, the target and the operation. Here still you do
> > some sort of initialization for handling callback.
> > 2) DataTrasformationInterceptor, where you create the soap body of the
> > message given the operation and parameters, for example:
> > <_ns_:add
> > xmlns:_ns_="http://calculator/xsd "><_ns_:param0>3.0
> > </_ns_:param0><_ns_:p
> > aram1>2.0</_ns_:param1></_ns_:add>
> > 3) NonblockingInterceptor, where Tuscany schedules invocation in a
> > workpool (here with jdk 1.5 , you could remove dependency from commonj
> > package)
> > 4) At time of scheduling, the next invoker is Axis2SCABindingInvoker,
> > which it's a wrapper for Axis2BindingInvoker if the invocation is
> > Request-response or for the Axis2BindingInvoker's child
> > (Axis2OneWayBindingInvoker) if the invocation is OneWay. In
> > Axis2*BindingInvoker you create the soap envelope,  the Axis's
> > OperationClient, set the axis invocation options and Axis's
> > MessageContext and the you send all the stuff on the wire.
> > Just to know, Can i use the same callback between a client component and
> > k service components?
> > Cheers,
> > Jo
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
> > For additional commands, e-mail: tuscany-dev-help@ws.apache.org
> >
> > Good work Jo. It looks like there is a bug in there. Can you raise a
> Tuscany JIRA so that it can be tracked.
>
> While you're looking into some of the things you mention I'll see if I can
> create a simple itest to replicate it following your instructions. Looking
> at you mail it looks like this problem should happen any time a @OneWay
> operation is called repeatedly across the web service binding.
>
> Looking at the end of you mail, you seem to have the sequence of invokers
> right. I don't understand your question though. "Can i use the same callback
> between a client component and service components?" Is the question
> specifically about callbacks in the SCA sense or something else? This
> process of creating an invocation chains with appropriate invokers is used
> for all SCA service references.
>
> Regards
>
> Simon
>
>
> I just checked in an itest (
http://svn.apache.org/repos/asf/incubator/tuscany/java/sca/itest/oneway/)
where I have been able to reproduce the problem you are reporting. It's not
part of the main build yet as, of course, the test fails.

Simon

Re: Asynchronous Invocation Bug.

Posted by Giorgio Zoppi <gi...@gmail.com>.
> >
> > Good work Jo. It looks like there is a bug in there. Can you raise a
> Tuscany JIRA so that it can be tracked.
Done as JIRA 1804.

> Looking at the end of you mail, you seem to have the sequence of invokers
> right. I don't understand your question though. "Can i use the same callback
> between a client component and service components?" Is the question
> specifically about callbacks in the SCA sense or something else? This
> process of creating an invocation chains with appropriate invokers is used
> for all SCA service references.
Ok, now i have to discover how the callback works inside and creating
a data binding for
jobs (as you know i'm trying to do some distrubuted computation over SCA).
The question is what happens if the callback calls some blocking code as i.e.
q.take() or if there are races if multiple components call the same
callback in order to fetch items to process. I'll see it tomorrow.
Cheers,
Jo.

---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


Re: Asynchronous Invocation Bug.

Posted by Simon Laws <si...@googlemail.com>.
On 9/21/07, Giorgio Zoppi <gi...@gmail.com> wrote:
>
> Hi,
> i've found the bug that it doens't permit myself to use SCA Binding over
> WebService modifying the distributed-calculator. I found it (on Tuscany
> 1.0 rc3) following the chain towards the wire, and i discovered that
> it's an Axis Fault. If you modify in your distributed calculator sample
> the SubtractionService in the following way:
> @Remotable
> public interface SubtractService {
>     @OneWay
>     void subtract(double n1, double n2);
>
> }
> public class SubtractServiceImpl implements SubtractService {
>
>     public void subtract(double n1, double n2) {
>         System.out.println("SubtractService - subtract " + n1 + " and "
> + n2);
>         //return n1 - n2;
>     }
>
> }
> I know that it doesn't nothing...but it's a proof of concept.
> And in the calculator node:
>
> for (int k = 0; k < 10; ++k)
>                     calculatorService.subtract(2*k+3, k);
>
>
> The nodeC with current Axis2OneWayBindingInvoker, even if it's called 10
> times..the receiver gets two messages..
> So in the nodeC terminal you can see only for example:
>
> [java] SubtractService - subtract 15.0 and 6.0
> [java] SubtractService - subtract 17.0 and 7.0
>
> The reason is due to the Axis HTTP REUSE:
> If you change in Axis2OneWayBindingInvoker
>
> requestMC.getOptions().setProperty(HTTPConstants.REUSE_HTTP_CLIENT,
> Boolean.TRUE);
>
> to:
> requestMC.getOptions().setProperty(HTTPConstants.REUSE_HTTP_CLIENT,
> Boolean.FALSE);
>
> It works! I suspect that there's a bug or a queue full in Axis because
> it seems that if you send something too fast it doesn't work (I'll see
> it tomorrow, because I don't know how the http client reuse works in
> Axis).
>
> The next test, I'll do it :
> for (int k = 0; k < 50; ++k)
>                     calculatorService.subtract(2*k+3, k);
> It seems to work, but in a strange way.
>
> During the debugging i discovered your nice structure in order to invoke
> methods over ws.
> Mainly for the Remote SCA over Web Services your structure has the
> following stages (correct me if i'm wrong):
>
> 1) JDKInvocationHandler, where you proxies the method call, create the
> message, set the source, the target and the operation. Here still you do
> some sort of initialization for handling callback.
> 2) DataTrasformationInterceptor, where you create the soap body of the
> message given the operation and parameters, for example:
> <_ns_:add
> xmlns:_ns_="http://calculator/xsd"><_ns_:param0>3.0</_ns_:param0><_ns_:p
> aram1>2.0</_ns_:param1></_ns_:add>
> 3) NonblockingInterceptor, where Tuscany schedules invocation in a
> workpool (here with jdk 1.5 , you could remove dependency from commonj
> package)
> 4) At time of scheduling, the next invoker is Axis2SCABindingInvoker,
> which it's a wrapper for Axis2BindingInvoker if the invocation is
> Request-response or for the Axis2BindingInvoker's child
> (Axis2OneWayBindingInvoker) if the invocation is OneWay. In
> Axis2*BindingInvoker you create the soap envelope,  the Axis's
> OperationClient, set the axis invocation options and Axis's
> MessageContext and the you send all the stuff on the wire.
> Just to know, Can i use the same callback between a client component and
> k service components?
> Cheers,
> Jo
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-dev-help@ws.apache.org
>
> Good work Jo. It looks like there is a bug in there. Can you raise a
Tuscany JIRA so that it can be tracked.

While you're looking into some of the things you mention I'll see if I can
create a simple itest to replicate it following your instructions. Looking
at you mail it looks like this problem should happen any time a @OneWay
operation is called repeatedly across the web service binding.

Looking at the end of you mail, you seem to have the sequence of invokers
right. I don't understand your question though. "Can i use the same callback
between a client component and service components?" Is the question
specifically about callbacks in the SCA sense or something else? This
process of creating an invocation chains with appropriate invokers is used
for all SCA service references.

Regards

Simon