Archived

This forum has been archived. Please start a new discussion on GitHub.

In AMI ,why did not foo_async return ?

I use AMI in my programs. Simply ,my clients firstly "foo_async(cb,arg)" and then wait for response or exceptions from cb. I start multiple clients,However,some clients stop at foo_async. i.e. ,this function did not return sometimes.

Then I added some "cout" in source code,make,and started some new clients.To my surprise, some old clients and some new clients stopped at same time.Certainly,all of them stopped at foo_async.

I attach some stopped clients to gdb. Output is following :

(gdb) where
#0 0x0000003d5c7bebe6 in __select_nocancel () from /lib64/tls/libc.so.6
#1 0x0000002a95a7674f in IceInternal::TcpTransceiver::write (this=0x51d8e0, buf=@0x5c5780,
timeout=-1) at TcpTransceiver.cpp:136
#2 0x0000002a959ce559 in Ice::ConnectionI::sendAsyncRequest (this=0x51da20, os=0x5c5780,
out=@0x7fbff7fca0, compress=false) at ConnectionI.cpp:719
#3 0x0000002a95a37c9b in IceInternal::OutgoingAsync::__send (this=0x5c99f0)
at OutgoingAsync.cpp:363
#4 0x0000002a955f2523 in DBroker::AMI_(***)_sendData::__invoke ()
from (***)
#5 0x0000002a955f2eef in IceProxy::(***)::sendData_async ()
from (***)
#6 0x0000002a955f2e47 in IceProxy::(***)::sendData ()
from (***)
#7 0x0000002a955e1c51 in (***)::sendData ()
from (***)
#8 (***)
#9 (***)
#10 (***)
(***).cpp:746
(gdb)

I found "timeout=-1" in #1

Then
1.why foo_async does not return sometimes ?
2.why some clients(with different code) stop at same time

My env : RedHat AS4,gcc 3.4.4, c++ ,icepack mode

Comments

  • matthew
    matthew NL, Canada
    By return you mean the application blocks on the foo_async call? If this is the case you should see the FAQ http://www.zeroc.com/faq/onewaysBlock.html.
  • Thank you for the FAQ information,and another question

    I have seen the FAQ information given by you . and it really helps me a lot.
    "oneway requests block" reminds me about the "timeout" problem.
    Here I want to modify the timeout configure from "-1" to some other number such as 10 etc., how could I do?
    I find a way to change it ,that is:
    checkedCast(...ice_timeout(10)...);
    Is the above way right?

    Thank you very much!
  • benoit
    benoit Rennes, France
    Hi,

    Yes, you need to call ice_timeout on the proxy to create a new proxy with the right timeout and use uncheckedCast to cast the proxy to the right type. For example (from the demo/Ice/hello demo):
    twoway = HelloPrx::uncheckedCast(twoway->ice_timeout(timeout));
    

    See the Ice manual from the more information on the ice_timeout proxy method.

    Cheers,
    Benoit.