Details
-
Bug
-
Status: Open
-
Critical
-
Resolution: Unresolved
-
1.6.0
-
windows
Description
I have an issue when I try using non-blocking axis2/c call to access a web service. Please help me.
The pseudo code is as follow,
Firstly, start a web request as follow,
axis2_callback_t *callback = axis2_callback_create(env);
axis2_callback_set_on_complete(callback, callback_on_complete);
axis2_callback_set_on_error(callback, callback_on_error);
axis2_svc_client_send_receive_non_blocking(svc_client, env, the_1st_request, callback);
In callback_on_complete, I try let the same svc_client to send out the 2nd request,
axis2_callback_t *callback = axis2_callback_create(env);
axis2_callback_set_on_complete(callback, callback_on_complete);
axis2_callback_set_on_error(callback, callback_on_error);
axis2_svc_client_send_receive_non_blocking(svc_client, env, the_2nd_request, callback);
The problem is, the 2nd non-blocking call makes the process crash.
I debugged into the code; It seems send_receive_non_blocking puts the corresponding blocking method to thread pool, and the thread sent the request and get the response, the callback_on_complete get executed. Unfortunately, the thread doesn't exit immediately, it try to free something;
if (args_list->callback)
{
axis2_callback_invoke_on_complete(args_list->callback,
th_env,
args_list->op_client->async_result);
axis2_callback_set_complete(args_list->callback, th_env, AXIS2_TRUE);
}
/* Clean up memory */
axis2_async_result_free(args_list->op_client->async_result, th_env);
But the 2nd thread, started by axis2_svc_client_send_receive_non_blocking in callback_on_complete, has freed the op_client before the 1st thread tries freeing op_client->async_result.
Please tell me how to check if one non-blocking call is completely done. I mean, the svc_client is ready for reusing or deleting. It seems callback_on_complete is not the answer.
BTW, Why my program works this way, is because it need upload some huge data to server with SOAP/MTOM, the data has to be split into multiple packages; otherwise one failure could make the resending data cost too much.