dLeyna-server-service and dLeyna-renderer-service crash with coredump
by Spinu, CornelX
Hi,
It seems that if I kill the dbus-session before killing the dLeyna-server-service and dLeyna-renderer-service, these 2 daemon's will generate a coredump.
Steps to reproduce:
- eval `dbus-launch --sh-syntax`
- /usr/local/libexec/dleyna-server-service &
- /usr/local/libexec/dleyna-server-service &
- kill -9 <pid_of_associated_dbus_session>
Here is a quick trace of the crash in dLeyna-server-service:
#0 0xb747f286 in free () from /lib/i386-linux-gnu/libc.so.6
#1 0xb763eccb in ?? () from /lib/i386-linux-gnu/libglib-2.0.so.0
#2 0xb763ef50 in g_free () from /lib/i386-linux-gnu/libglib-2.0.so.0
#3 0xb7705b0b in dleyna_white_list_delete (wl=0x10) at libdleyna/core/white-list.c:74
#4 0xb75dda99 in dls_manager_delete (manager=0x8d2b158) at manager.c:81
#5 0xb75d2501 in prv_control_point_stop_service () at server.c:1351
#6 0xb7703e48 in prv_context_quit_cb (user_data=0x0) at libdleyna/core/main-loop.c:69
#7 0xb7636810 in ?? () from /lib/i386-linux-gnu/libglib-2.0.so.0
#8 0xb7638d46 in g_main_context_dispatch () from /lib/i386-linux-gnu/libglib-2.0.so.0
#9 0xb76390e5 in ?? () from /lib/i386-linux-gnu/libglib-2.0.so.0
#10 0xb763952b in g_main_loop_run () from /lib/i386-linux-gnu/libglib-2.0.so.0
#11 0xb77040f0 in dleyna_main_loop_start (server=0x8048b80 "dleyna-server-service", control_point=0xb75efd60, user_data=0x0) at libdleyna/core/main-loop.c:165
#12 0x0804896e in main (argc=1, argv=0xbfecc404) at daemon.c:93
Looking throu the code, in prv_context_quit_cb from dLeyna-core, the code looks like this:
static gboolean prv_context_quit_cb(gpointer user_data)
{
DLEYNA_LOG_DEBUG("Quitting");
g_context.connector->disconnect();
g_context.control_point->stop_service();
g_timeout_add_seconds(1, prv_context_mainloop_quit_cb, NULL);
return FALSE;
}
Since we kill the dbus-session, we will have no connection available. My suggestion is to perform a check for g_context.connection before performing other calls. The code will look like:
static gboolean prv_context_quit_cb(gpointer user_data)
{
DLEYNA_LOG_DEBUG("Quitting");
if (g_context.connection != NULL)
{
g_context.connector->disconnect();
g_context.control_point->stop_service();
}
g_timeout_add_seconds(1, prv_context_mainloop_quit_cb, NULL);
return FALSE;
}
Is this a proper way to handle the dbus-daemon getting killed before the services exit?
Thank you,
Cornel
Intel GmbH
Dornacher Strasse 1
85622 Feldkirchen/Muenchen, Deutschland
Sitz der Gesellschaft: Feldkirchen bei Muenchen
Geschaeftsfuehrer: Christian Lamprechter, Hannes Schwaderer, Douglas Lusk
Registergericht: Muenchen HRB 47456
Ust.-IdNr./VAT Registration No.: DE129385895
Citibank Frankfurt a.M. (BLZ 502 109 00) 600119052
7 years