lua-users home
lua-l archive

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


TL;DR: Gio's g_file_query_info_async hangs Lua under FreeBSD; this
breaks Gtk as well. Help.

Hi, folks. I've run into a problem while writing a Gtk3 application
using LGI bindings (i.e. [1]). Here's a short example:

    $ lua-5.1
    Lua 5.1.5  Copyright (C) 1994-2012 Lua.org, PUC-Rio
    > lgi = require 'lgi'
    > gtk = lgi.Gtk
    > gtk.FileChooserDialog {}

At this point the interpreter hangs, the only option is to kill it with
two ^C. This is under FreeBSD/amd64 9.1 with Gtk 3.6.4, GLib 2.34.3 and
LGI 0.7.1. I'm seeing the same thing with lua-5.1, lua-5.2 and luajit.

(I will attach a backtrace I get in GDB after the hang).

Now, I've managed to trace the problem to 'g_file_query_info_async'
call inside Gtk; here's an equivalent Lua example:

    $ lua-5.1
    Lua 5.1.5  Copyright (C) 1994-2012 Lua.org, PUC-Rio
    > lgi = require 'lgi'
    > gio = lgi.Gio
    > f = gio.File.new_for_path("/tmp")
    > gio.File.query_info_async(f, "", 0, 0)

This hangs as well.

Note that this problem is not specific to LGI: translating the
above example to C and making it a loadable module for Lua also
results in a hang. Running it as a standalone C program works
fine though (I can provide these programs on request).

Also note that the examples above work fine under Linux (at least
on x86_64 with Gtk 3.4.2 and GLib 2.33.12).

So, any ideas on what's causing the hang, and how to fix it?

[1] http://github.com/pavouk/lgi
#0  0x00000008025a187a in pthread_kill () from /lib/libthr.so.3
#1  0x000000080259ba6c in pthread_getschedparam () from /lib/libthr.so.3
#2  0x000000080259fe6a in pthread_mutex_getprioceiling () from /lib/libthr.so.3
#3  0x00000008025a052e in pthread_mutex_trylock () from /lib/libthr.so.3
#4  0x0000000800d2da18 in posix_memalign () from /lib/libc.so.7
#5  0x0000000800d2cf4a in _malloc_prefork () from /lib/libc.so.7
#6  0x0000000800d2edf2 in calloc () from /lib/libc.so.7
#7  0x000000080259fc44 in pthread_mutexattr_init () from /lib/libthr.so.3
#8  0x000000080259ff14 in pthread_mutex_getprioceiling () from /lib/libthr.so.3
#9  0x00000008025a052e in pthread_mutex_trylock () from /lib/libthr.so.3
#10 0x0000000800d2da18 in posix_memalign () from /lib/libc.so.7
#11 0x0000000800d2cf4a in _malloc_prefork () from /lib/libc.so.7
#12 0x0000000800d2edf2 in calloc () from /lib/libc.so.7
#13 0x00000008025a24bd in pthread_kill () from /lib/libthr.so.3
#14 0x000000080259a12d in pthread_create () from /lib/libthr.so.3
#15 0x0000000802120054 in g_system_thread_new () from /usr/local/lib/libglib-2.0.so.0
#16 0x0000000802106583 in g_thread_new_internal () from /usr/local/lib/libglib-2.0.so.0
#17 0x00000008021070a6 in g_thread_pool_free () from /usr/local/lib/libglib-2.0.so.0
#18 0x000000080210728c in g_thread_pool_push () from /usr/local/lib/libglib-2.0.so.0
#19 0x0000000802800c7c in g_file_is_native () from /usr/local/lib/libgio-2.0.so.0
#20 0x00000008090c1d60 in _gtk_file_system_get_info (file_system=0x807908680, file=0x80164a580, attributes=0x80934ec08 "standard::is-hidden,standard::is-backup,standard::display-name,standard::icon", callback=0x8090ac560 <get_file_info_finished>, data=0x807942e40) at gtkfilesystem.c:715
#21 0x00000008090acb69 in shortcuts_insert_file (impl=0x807940100, pos=-1, shortcut_type=SHORTCUT_TYPE_FILE, volume=0x0, file=0x80164a580, label=0x0, removable=0, type=SHORTCUTS_HOME) at gtkfilechooserdefault.c:1660
#22 0x00000008090acf8d in shortcuts_append_home (impl=0x807940100) at gtkfilechooserdefault.c:1791
#23 0x00000008090ad9de in shortcuts_model_create (impl=0x807940100) at gtkfilechooserdefault.c:2190
#24 0x00000008090b30f8 in gtk_file_chooser_default_constructor (type=34486729216, n_construct_properties=0, construct_params=0x0) at gtkfilechooserdefault.c:5092
#25 0x0000000801c6825f in g_object_newv () from /usr/local/lib/libgobject-2.0.so.0
#26 0x0000000801c68d9c in g_object_new () from /usr/local/lib/libgobject-2.0.so.0
#27 0x00000008090bc32b in _gtk_file_chooser_default_new () at gtkfilechooserdefault.c:10263
#28 0x00000008090bfb75 in gtk_file_chooser_widget_constructor (type=34486729088, n_construct_properties=0, construct_params=0x0) at gtkfilechooserwidget.c:122
#29 0x0000000801c6825f in g_object_newv () from /usr/local/lib/libgobject-2.0.so.0
#30 0x0000000801c68d9c in g_object_new () from /usr/local/lib/libgobject-2.0.so.0
#31 0x00000008090bce77 in gtk_file_chooser_dialog_constructor (type=34383033984, n_construct_properties=3, construct_params=0x807929670) at gtkfilechooserdialog.c:451
#32 0x0000000801c6862e in g_object_newv () from /usr/local/lib/libgobject-2.0.so.0
#33 0x00000008023901e4 in ffi_call_unix64 () from /usr/local/lib/libffi.so.6
#34 0x0000000802390035 in ffi_call () from /usr/local/lib/libffi.so.6
#35 0x000000080180a1fe in callable_call (L=0x801407300) at callable.c:876
#36 0x000000000040a67a in luaD_precall (L=0x801407300, func=0x8014f0130, nresults=1) at ldo.c:320
#37 0x00000000004186fc in luaV_execute (L=0x801407300, nexeccalls=3) at lvm.c:591
#38 0x000000000040a927 in luaD_call (L=0x801407300, func=0x8014f0030, nResults=-1) at ldo.c:378
#39 0x0000000000406d8f in f_call (L=0x801407300, ud=0x7fffffffd320) at lapi.c:800
#40 0x00000000004098a1 in luaD_rawrunprotected (L=0x801407300, f=0x406d60 <f_call>, ud=0x7fffffffd320) at ldo.c:116
#41 0x000000000040ad32 in luaD_pcall (L=0x801407300, func=0x406d60 <f_call>, u=0x7fffffffd320, old_top=48, ef=32) at ldo.c:464
#42 0x0000000000406e46 in lua_pcall (L=0x801407300, nargs=0, nresults=-1, errfunc=1) at lapi.c:821
#43 0x0000000000403f5b in docall (L=0x801407300, narg=0, clear=0) at lua.c:102
#44 0x0000000000404570 in dotty (L=0x801407300) at lua.c:221
#45 0x0000000000404cdc in pmain (L=0x801407300) at lua.c:369
#46 0x000000000040a67a in luaD_precall (L=0x801407300, func=0x801407610, nresults=0) at ldo.c:320
#47 0x000000000040a915 in luaD_call (L=0x801407300, func=0x801407610, nResults=0) at ldo.c:377
#48 0x0000000000406f5f in f_Ccall (L=0x801407300, ud=0x7fffffffd650) at lapi.c:846
#49 0x00000000004098a1 in luaD_rawrunprotected (L=0x801407300, f=0x406e90 <f_Ccall>, ud=0x7fffffffd650) at ldo.c:116
#50 0x000000000040ad32 in luaD_pcall (L=0x801407300, func=0x406e90 <f_Ccall>, u=0x7fffffffd650, old_top=16, ef=0) at ldo.c:464
#51 0x0000000000406fc7 in lua_cpcall (L=0x801407300, func=0x404b10 <pmain>, ud=0x7fffffffd6a0) at lapi.c:856
#52 0x0000000000404d5d in main (argc=1, argv=0x7fffffffd728) at lua.c:387