Add a debugging code for blocked dpms_get_power() 10/181210/1 accepted/tizen/unified/20180619.110320 submit/tizen/20180614.110151
authorHyotaek Shim <hyotaek.shim@samsung.com>
Mon, 11 Jun 2018 05:16:27 +0000 (14:16 +0900)
committerHyotaek Shim <hyotaek.shim@samsung.com>
Mon, 11 Jun 2018 05:16:30 +0000 (14:16 +0900)
Program terminated with signal SIGABRT, Aborted.
 #0  0xb68c1964 in poll () at ../sysdeps/unix/syscall-template.S:84
 84 ../sysdeps/unix/syscall-template.S: No such file or directory.
 [Current thread is 1 (Thread 0xb6f4a180 (LWP 7281))]
 (gdb) bt
 #0  0xb68c1964 in poll () at ../sysdeps/unix/syscall-template.S:84
 #1  0xb6b7fc18 in g_main_context_poll (priority=<optimized out>, n_fds=1, fds=0xb8c177a8,
     timeout=<optimized out>, context=0xb8c10cf0) at gmain.c:4259
 #2  g_main_context_iterate (context=0xb8c10cf0, block=block@entry=1, dispatch=dispatch@entry=1,
     self=<optimized out>) at gmain.c:3955
 #3  0xb6b7ffd8 in g_main_loop_run (loop=0xb8c10800) at gmain.c:4156
 #4  0xb6e3f5c0 in g_dbus_connection_send_message_with_reply_sync (
     connection=connection@entry=0xb8bd0868, message=message@entry=0xb51d8630,
     flags=G_DBUS_SEND_MESSAGE_FLAGS_NONE, timeout_msec=10000, timeout_msec@entry=-1225985936,
     out_serial=out_serial@entry=0x0, cancellable=0x0, error=0xbeb38994, error@entry=0xbeb3898c)
     at gdbusconnection.c:2844
 #5  0xb6e3fb70 in g_dbus_connection_call_sync_internal (connection=0xb8bd0868,
     bus_name=<optimized out>, object_path=object_path@entry=0xb6f9f0f4 "/org/enlightenment/wm",
     interface_name=0xb6f9f0d8 "org.enlightenment.wm.dpms", method_name=<optimized out>,
     method_name@entry=0xb6f9f0f4 "/org/enlightenment/wm", parameters=0x0,
     parameters@entry=0xb6c9bce1 <dbus_handle_method_sync+104>,
     reply_type=reply_type@entry=0xb6fa02a8, flags=flags@entry=G_DBUS_CALL_FLAGS_NONE,
     timeout_msec=timeout_msec@entry=10000, fd_list=fd_list@entry=0x0,
     out_fd_list=out_fd_list@entry=0x0, cancellable=cancellable@entry=0x0, error=0xbeb38a24,
     error@entry=0x2710) at gdbusconnection.c:6901
 #6  0xb6e42294 in g_dbus_connection_call_sync (connection=<optimized out>, bus_name=<optimized out>,
     object_path=object_path@entry=0xb6f9f0f4 "/org/enlightenment/wm",
     interface_name=<optimized out>, method_name=method_name@entry=0xb6fa02a8 "get",
     parameters=parameters@entry=0x0, reply_type=reply_type@entry=0x0,
     flags=flags@entry=G_DBUS_CALL_FLAGS_NONE, timeout_msec=timeout_msec@entry=10000,
     cancellable=cancellable@entry=0x0, error=error@entry=0xbeb38a24) at gdbusconnection.c:7128
 #7  0xb6c9bce0 in dbus_handle_method_sync (dest=<optimized out>,
     path=0xb6f9f0f4 "/org/enlightenment/wm", iface=<optimized out>, method=0xb6fa02a8 "get",
     signature=signature@entry=0x0, param=param@entry=0x0)
     at /usr/src/debug/libsyscommon-4.1/src/libgdbus/dbus-system.c:1994
 #8  0xb6f87100 in dpms_get_power (state=0xbeb38a6c)
     at /usr/src/debug/deviced-5.0.0/src/display/dpms-wayland-none.c:90

Change-Id: Ia53fb83140509b9ed4db213df2ef09af1ae2f649
Signed-off-by: Hyotaek Shim <hyotaek.shim@samsung.com>
src/display/dpms-wayland-none.c

index cf1db2e..4e3edbc 100644 (file)
@@ -80,20 +80,29 @@ int dpms_set_power(enum dpms_state state)
        return 0;
 }
 
+#define DPMS_TIMEOUT           5000
+#define DPMS_GET_MAX_RETRY     3
 int dpms_get_power(enum dpms_state *state)
 {
+       int try = 0;
        int ret;
 
        if (!state)
                return -EINVAL;
 
-       ret = dbus_handle_method_sync(ENLIGHTENMENT_BUS_NAME,
-                       ENLIGHTENMENT_OBJECT_PATH,
-                       ENLIGHTENMENT_INTERFACE_NAME,
-                       "get",
-                       NULL, NULL);
-       if (ret < 0)
-               return ret;
+       do {
+               try++;
+               if (try > DPMS_GET_MAX_RETRY) {
+                       _E("Dbus Timeout occurred %d times in a row.", DPMS_GET_MAX_RETRY);
+                       assert(0);
+               }
+
+               ret = dbus_handle_method_sync_timeout(ENLIGHTENMENT_BUS_NAME,
+                               ENLIGHTENMENT_OBJECT_PATH,
+                               ENLIGHTENMENT_INTERFACE_NAME,
+                               "get",
+                               NULL, NULL, DPMS_TIMEOUT);
+       } while (ret < 0);
 
        *state = ret;
        return 0;