Opened 8 years ago
Closed 8 years ago
#5908 closed Bug (fixed)
transmission-gtk crashes with segfault on start on arm-uclibcgnueabi system
Reported by: | alllexx | Owned by: | mike.dld |
---|---|---|---|
Priority: | Normal | Milestone: | 2.90 |
Component: | GTK+ Client | Version: | 2.84 |
Severity: | Normal | Keywords: | |
Cc: |
Description
I'm trying to get transmission 2.84 GTK+ client to work on an uClibc ARM system using Optware. transmission-daemon works fine, however starting transmission-gtk results in a Segmentation fault. See gdb log attached. This may be some sort of a build problem, since I have only recently ported GTK+ to Optware, but I have at least confirmed that GTK+ is working (vte-0.36.3 runs fine). GTK+ is 3.14.9
Attachments (2)
Change History (12)
Changed 8 years ago by alllexx
comment:1 follow-up: ↓ 3 Changed 8 years ago by mike.dld
Is there an error which looks like Couldn't read "/root/.config/transmission/stats.json": ... in the log right when the crash occurs? What does it say exactly after the colon?
Do you have the aforementioned stats.json file at that path? Is it a regular file, are you able to read its content?
P.S. Since GTK+ client queues messages instead of writing them out right away, you can patch on_startup function to get them dumped to stderr:
-
gtk/main.c
523 523 g_mkdir_with_parents (str, 0777); 524 524 525 525 /* initialize the libtransmission session */ 526 session = tr_sessionInit ("gtk", cbdata->config_dir, TRUE, gtr_pref_get_all ());526 session = tr_sessionInit ("gtk", cbdata->config_dir, FALSE, gtr_pref_get_all ()); 527 527 528 528 gtr_pref_flag_set (TR_KEY_alt_speed_enabled, tr_sessionUsesAltSpeed (session)); 529 529 gtr_pref_int_set (TR_KEY_peer_port, tr_sessionGetPeerPort (session));
comment:2 Changed 8 years ago by mike.dld
Also, could you try building lastest trunk revision (checkout from svn://svn.transmissionbt.com/Transmission/trunk) to see if that helps?
Changed 8 years ago by alllexx
comment:3 in reply to: ↑ 1 Changed 8 years ago by alllexx
Replying to mike.dld:
Is there an error which looks like Couldn't read "/root/.config/transmission/stats.json": ... in the log right when the crash occurs? What does it say exactly after the colon?
Do you have the aforementioned stats.json file at that path? Is it a regular file, are you able to read its content?
P.S. Since GTK+ client queues messages instead of writing them out right away, you can patch on_startup function to get them dumped to stderr:
gtk/main.c
523 523 g_mkdir_with_parents (str, 0777); 524 524 525 525 /* initialize the libtransmission session */ 526 session = tr_sessionInit ("gtk", cbdata->config_dir, TRUE, gtr_pref_get_all ());526 session = tr_sessionInit ("gtk", cbdata->config_dir, FALSE, gtr_pref_get_all ()); 527 527 528 528 gtr_pref_flag_set (TR_KEY_alt_speed_enabled, tr_sessionUsesAltSpeed (session)); 529 529 gtr_pref_int_set (TR_KEY_peer_port, tr_sessionGetPeerPort (session));
No, there is no /root/.config/transmission/stats.json. Sorry for this stupid questions, but where exactly should I look for the logs? Can't seem to find it in any standard locations. I build from trunk (rev14475), but still get a segfault (see transmission-gtk-bt2). Applying your patch does not seem to give any useful hints:
[root@unknown root]$ transmission-gtk ** (transmission-gtk:15228): WARNING **: Couldn't connect to accessibility bus: Failed to connect to socket /tmp/dbus-U15izXXyus: Connection refused [2015-03-14 20:29:22.166] Transmission 2.84+ (14475) started [2015-03-14 20:29:22.168] RPC Server: Adding address to whitelist: 127.0.0.1 [2015-03-14 20:29:22.241] UDP: Failed to set receive buffer: requested 4194304, got 241664 [2015-03-14 20:29:22.241] UDP: Please add the line "net.core.rmem_max = 4194304" to /etc/sysctl.conf [2015-03-14 20:29:22.241] UDP: Failed to set send buffer: requested 1048576, got 241664 [2015-03-14 20:29:22.241] UDP: Please add the line "net.core.wmem_max = 1048576" to /etc/sysctl.conf Segmentation fault
comment:4 Changed 8 years ago by alllexx
P.S. If you mean gdb logs, no there is no Couldn't read "/root/.config/transmission/stats.json" error there
comment:5 Changed 8 years ago by mike.dld
Could you please apply one more patch to increase log verbosity and try again?
-
libtransmission/log.c
19 19 #include "platform.h" /* tr_lock */ 20 20 #include "utils.h" 21 21 22 tr_log_level __tr_message_level = TR_LOG_ ERROR;22 tr_log_level __tr_message_level = TR_LOG_DEBUG; 23 23 24 24 static bool myQueueEnabled = false; 25 25 static tr_log_message * myQueue = NULL;
This will hopefully reveal the Couldn't read ... message. And no, it wasn't about GDB logs, but those appeared on strerr when you run transmission-gtk (Transmission 2.84+ (14475) started etc.)
From what I see right now the only way this could happen it seems is if stat(2) call reports an error (file not found) but doesn't set errno appropriately. The code which does error checking is actually flawed and I'll fix it as soon as I hear back from you. It's just really interesting how this could've happened in the first place (bug in uClibc?..)
comment:6 Changed 8 years ago by alllexx
Patch applied:
[root@unknown root]$ transmission-gtk ** (transmission-gtk:15456): WARNING **: Couldn't connect to accessibility bus: Failed to connect to socket /tmp/dbus-U15izXXyus: Connection refused [2015-03-14 22:02:19.090] Couldn't read "/root/.config/user-dirs.dirs": No such file or directory [2015-03-14 22:02:19.091] Couldn't read "/root/.config/transmission/settings.json": No such file or directory [2015-03-14 22:02:19.194] Transmission 2.84+ (14475) started [2015-03-14 22:02:19.196] RPC Server: Adding address to whitelist: 127.0.0.1 [2015-03-14 22:02:19.273] UDP: Failed to set receive buffer: requested 4194304, got 241664 [2015-03-14 22:02:19.273] UDP: Please add the line "net.core.rmem_max = 4194304" to /etc/sysctl.conf [2015-03-14 22:02:19.273] UDP: Failed to set send buffer: requested 1048576, got 241664 [2015-03-14 22:02:19.273] UDP: Please add the line "net.core.wmem_max = 1048576" to /etc/sysctl.conf Segmentation fault
Hope this helps
comment:7 Changed 8 years ago by mike.dld
Not what I expected, but still interesting. Could it be that you are using some old uClibc version, specifically 0.9.31 and below? I see they have a bug registered at https://bugs.uclibc.org/2089, which I found looking at http://lists.busybox.net/pipermail/uclibc/2010-July/044196.html (describing stat call specifically). There's also a bunch of other related results if you google for "uclibc" "errno" thread. I know those pages date back to 2010, but since the bug was closed as WONTFIX maybe it's still actual and one of patches will work for you.
comment:8 Changed 8 years ago by alllexx
I'm using the latest 0.9.33.2 uClibc, but still you were 100% right/ After partially applying this patch https://github.com/mat-c/uClibc/commit/328d392c54aa5dc2b8e7f398a419087de497de2b (file libc/sysdeps/linux/common/bits/uClibc_errno.h does not exist in uClibc 0.9.33.2 and __uClibc_main.c is missing the relevent portion), transmission-gtk starts perfectly fine. Here's the patch I used:
-
include/netdb.h
diff --git a/include/netdb.h b/include/netdb.h index 9d3807d..aeda977 100644
a b __BEGIN_DECLS 59 59 60 60 /* Function to get address of global `h_errno' variable. */ 61 61 extern int *__h_errno_location (void) __THROW __attribute__ ((__const__)); 62 libc_hidden_proto(__h_errno_location)62 //libc_hidden_proto(__h_errno_location) 63 63 64 64 /* Macros for accessing h_errno from inside libc. */ 65 65 #ifdef _LIBC -
libc/misc/internals/__errno_location.c
diff --git a/libc/misc/internals/__errno_location.c b/libc/misc/internals/__errno_location.c index 487a9c2..514c4c8 100644
a b int * weak_const_function __errno_location (void) 12 12 return &errno; 13 13 } 14 14 #ifdef IS_IN_libc /* not really need, only to keep in sync w/ libc_hidden_proto */ 15 libc_hidden_weak(__errno_location)15 //libc_hidden_weak(__errno_location) 16 16 #endif -
libc/misc/internals/__h_errno_location.c
diff --git a/libc/misc/internals/__h_errno_location.c b/libc/misc/internals/__h_errno_location.c index 213d398..b0e87d3 100644
a b int * weak_const_function __h_errno_location (void) 10 10 { 11 11 return &h_errno; 12 12 } 13 libc_hidden_weak(__h_errno_location)13 //libc_hidden_weak(__h_errno_location) -
libc/sysdeps/linux/common/bits/errno.h
diff --git a/libc/sysdeps/linux/common/bits/errno.h b/libc/sysdeps/linux/common/bits/errno.h index 0bf6354..ba57a6e 100644
a b 43 43 # ifndef __ASSEMBLER__ 44 44 /* Function to get address of global `errno' variable. */ 45 45 extern int *__errno_location (void) __THROW __attribute__ ((__const__)); 46 libc_hidden_proto(__errno_location)46 //libc_hidden_proto(__errno_location) 47 47 48 48 # ifdef __UCLIBC_HAS_THREADS__ 49 49 /* When using threads, errno is a per-thread value. */
So it is a uClibc bug after all. Thanks!
P.S. Now I have to figure out how to make transmission-gtk search for gschemas.compiled in /opt/share/glib-2.0/schemas/ rather than /usr/share/glib-2.0/schemas/. transmission-gtk crashes when I press File->Open. Not sure what needs to be patched, though: transmission or glib...
comment:9 Changed 8 years ago by mike.dld
- Owner changed from jordan to mike.dld
- Status changed from new to assigned
comment:10 Changed 8 years ago by mike.dld
- Milestone changed from None Set to 2.90
- Resolution set to fixed
- Status changed from assigned to closed
transmission-gtk crash gdb log