Monday, September 28, 2009

Axis2/C Dual Channel Problem

We got some dual channel problems in Axis2/C yesterday. First problem is, it crashes time to time. Second problem is we could not be able to get RelatesTo, MessageID, etc. from the resulting message context.

The crash is due to a scenario as follows; create a service client, consume a service using dual channel, then free service client. Note that the application is still running. When deleting the service client, it frees all of the allocated structures, but not the thread created by listener manager to listen for the dual channel case. That thread is still running and using some of the deleted structures and resulting a crash. The fix is, in axis2_svc_client_finalize_invoke, we have to get the thread ID and terminate that thread. This will stop the listener manager thread. However, the worker thread created by listener manager thread might be still running. So before deleting service client, we should "sleep" for a while, giving enough CPU to worker thread to exit. Then call axis2_svc_client_free.

Reason for second problem is, in the dual channel case, a new message context was created in the in-path. It is not populated with any of the details normally available in single channel case. However, when listener manager receives the reply, it creates a message context and populates all those details and it is not used in in-path. Using that message context instead of creating a new one solved the issue.

0 comments: