1

Methodcall error occurs intermittently

asked 2014-04-09 05:37:20 -0700

herodion gravatar image

updated 2014-04-09 05:41:13 -0700

Hi, I need some help for alljoyn framework. below is my alljoyn project scenario.

  1. Environment
    • OS : Win7
    • Language : C++
    • Using two laptops connected via wifi.
    • first laptop : server app(one), second laptop : client apps(many)
  2. many clients(more than 10) connect to the server.
  3. once each client succeed to join the server's session, server creates the thread per each client.
    • this thread function execute while loop that make method call every 0.5sec.
  4. after about 5~10 minutes, ER_BUS_REPLY_IS_ERROR_MESSAGE(0x9032) error occurs randomly in server side.
    • In client side error does not occur.
    • if one client's methodcall() error occurs, then the error occurs all the rest clients.
  5. in this state, if new client try to join server then client succeed to find advertised name but fail to join session.
    • ER_ALLJOYN_JOINSESSION_REPLY_FAILED(0x9088) error occurs.
  6. server seems to be deadlock state and can not recover until restarting server application.

Why above error occurs? and how can I avoid? If need more information, please reply.. and also source code needed, i can share.

Thanks.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2014-04-09 17:57:32 -0700

georgen gravatar image

This error looks like you have run out of threads in the thread pool.

By default Each BusAttachment has four threads available to process in-coming requests. This means that only four method calls or signals can be processed at one time. If your method calls or signal handlers are taking a long time or are sent faster than they can be processed then I think the method call will time out in the clients router node and return an error.

If no threads are available to process requests then even method calls like JoinSession will fail.

Possible fix: Increase the size of the thread pool this can be done when you create the BusAttachment

BusAttachment busAttachment("My Application Name", true, 8);

this will increase the thread pool to eight.

Another possible problem

If the performance does not improve after increasing the thread pool size you may have a different problem

If you call another Alljoyn method inside a method handler without calling the BusAttachment::EnableConcurrentCallbacks() then your code will deadlock and never return taking up one of threads from the thread pool indefinitely. The EnableConcurrentCallbacks tells the code to make the method call on a different thread then the current Alljoyn thread. If EnableConcurrentCallbacks callbacks is used it will deadlock because the router node is already waiting on the method you are in to return its results.

Check you method handlers and the AllJoyn Listeners if you ever call another AllJoyn method inside these handlers then you should call EnableConcurrentCallbacks() before making the call.

Without using EnableConcurrentCallbacks it may eventually time out but without digging into the code I don't know that for sure.

side note:

The ER_BUS_REPLY_IS_ERROR_MESSAGE(0x9032) is given when a method call failed on the on the BusObject side (typically the server) not the ProxyObject side (typically the client).

edit flag offensive delete publish link more
Login/Signup to Answer

Question Tools

Follow
1 follower

Stats

Asked: 2014-04-09 05:37:20 -0700

Seen: 468 times

Last updated: Apr 17 '14