Stopping corosync service spends long time

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 

Hi All,

Accroding to coroipcs_ipc_service_exit(), one token round is needed for a service to release its one IPC connection. One token round needs 200ms when there is not any messages to send(no one triggers token_hold_cancel_send()). So if there are a lot of IPC connections belongs to a service, it will spends quite a long time to  unload this service.

In my test environment, CLM service have 100 IPC connections, so it spends about 20 seconds to release all of them.

The solution is let token_callbacks_execute() to call token_hold_cancel_send() under this circumstances. The following is the patch:

diff -ruNp corosync-1.4.5-orig/exec/service.c corosync-1.4.5/exec/service.c
--- corosync-1.4.5-orig/exec/service.c  2012-12-12 18:47:52.000000000 +0800
+++ corosync-1.4.5/exec/service.c       2013-05-20 22:53:04.496467600 +0800
@@ -568,10 +568,11 @@ static int service_unlink_schedwrk_handl
        struct corosync_api_v1 *api = (struct corosync_api_v1 *)cb_data->api;

        /*
-        * Exit all ipc connections dependent on this service
+        * Exit all ipc connections dependent on this service.
+        * Return -2 will triggers token_hold_cancel_send() to make unloading much faster.
         */
        if (coroipcs_ipc_service_exit (cb_data->service_engine) == -1)
-               return -1;
+               return -2;

        log_printf(LOGSYS_LEVEL_NOTICE,
                "Service engine unloaded: %s\n",
diff -ruNp corosync-1.4.5-orig/exec/totemsrp.c corosync-1.4.5/exec/totemsrp.c
--- corosync-1.4.5-orig/exec/totemsrp.c 2012-12-12 18:47:52.000000000 +0800
+++ corosync-1.4.5/exec/totemsrp.c      2013-05-20 22:44:51.673387100 +0800
@@ -3349,8 +3349,11 @@ static void token_callbacks_execute (
                /*
                 * This callback failed to execute, try it again on the next token
                 */
-               if (res == -1 && del == 1) {
+               if (res < 0 && del == 1) {
                        list_add (list, callback_listhead);
+                       if (res < -1) {
+                               token_hold_cancel_send (instance);
+                       }
                } else  if (del) {
                        free (token_callback_instance);
                }

--
Yours,
Jason

_______________________________________________
discuss mailing list
discuss@xxxxxxxxxxxx
http://lists.corosync.org/mailman/listinfo/discuss

[Index of Archives]     [Linux Clusters]     [Corosync Project]     [Linux USB Devel]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Linux Kernel]     [Linux SCSI]     [X.Org]

  Powered by Linux