Results 1 to 5 of 5

Thread: server's method get called twice while client received a TimeoutException

  1. #1
    suds is offline Registered User
    Name: Hongquan.Zhang
    Organization: HUST
    Project: StreamOut is a distribute streaming service
    Join Date
    Jun 2006
    Posts
    14

    server's method get called twice while client received a TimeoutException

    Hi :
    I have modified the demo project hello's source code , and after some test I found a wierd problem.
    In function sayHello of HelloI.cpp in server side
    Code:
    int HelloI::sayHello(int index, const Ice::Current&) const
    {
      
    
    	cout<<"call's index = "<<index<<endl;//display index passed from client
    	IceUtil::ThreadControl::sleep(
    		IceUtil::Time::milliSeconds( _delay ));//_delay is a pre-set value 
    	
    
        return 1;
    }
    at the client side:
    Code:
    	int iCount = 0;
    	while(!bQuit)
    	{
    		try
    		{
    			cout<<"call's index = "<<iCount <<endl;
    			hPrx->sayHello(iCount);//call server's hello and tell it current index
    		}
    		catch( const Ice::Exception& ex)
    		{
    			cout<<ex.ice_name()<<endl;
    		}
    		iCount ++;
    	}
    If I set _delay in server side to 5000 ms , and in my client's code, I set the hello proxy's timeout to 2000. we'll see that the same index will appear twice on server side's console.
    That is , if client detected server timed out , it'll invoke the routine again.
    attached is a screen shot and the zip of source code.
    Attached Images Attached Images
    Attached Files Attached Files

  2. #2
    michi's Avatar
    michi is offline Registered User
    Name: Michi Henning
    Organization: Triodia Technologies
    Project: I have a passing interest in Ice :-)
    Join Date
    Feb 2003
    Location
    Brisbane, Australia
    Posts
    1,055
    This shouldn't be happening because it violates at-most-once semantics. We'll have a look at this, thanks!

    Michi.

  3. #3
    benoit's Avatar
    benoit is offline ZeroC Staff
    Name: Benoit Foucher
    Organization: ZeroC, Inc.
    Project: Ice
    Join Date
    Feb 2003
    Location
    Rennes, France
    Posts
    2,196
    Actually, this is the expected behavior for idempotent operations. If you remove the idempotent keyword from the Slice, the retry won't occur to ensure at-most-once semantics are not violated.

    See the section "Idempotent Operations" here in the Ice manual for more information.

    Cheers,
    Benoit.

  4. #4
    michi's Avatar
    michi is offline Registered User
    Name: Michi Henning
    Organization: Triodia Technologies
    Project: I have a passing interest in Ice :-)
    Join Date
    Feb 2003
    Location
    Brisbane, Australia
    Posts
    1,055
    Ah, yes, I should have looked at the Slice definition. Benoit is right, of course. If you mark the operation as idempotent, the retry is just what should happen.

    Cheers,

    Michi.

  5. #5
    suds is offline Registered User
    Name: Hongquan.Zhang
    Organization: HUST
    Project: StreamOut is a distribute streaming service
    Join Date
    Jun 2006
    Posts
    14
    Oh ! It's my mistake .
    Thank you very much for your explanation

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 7
    Last Post: 11-03-2010, 01:27 PM
  2. Ice.Application run method never called
    By lafayej in forum Help Center
    Replies: 0
    Last Post: 10-25-2010, 08:43 AM
  3. Replies: 6
    Last Post: 08-15-2007, 02:08 AM
  4. Replies: 7
    Last Post: 07-05-2006, 03:46 AM
  5. Replies: 4
    Last Post: 12-09-2005, 04:09 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •