After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 750955 - CRITICAL **: grl_l_callback: assertion 'os != NULL' failed
CRITICAL **: grl_l_callback: assertion 'os != NULL' failed
Status: RESOLVED FIXED
Product: grilo
Classification: Other
Component: lua
git master
Other Linux
: Normal normal
: ---
Assigned To: grilo-maint
grilo-maint
Depends on:
Blocks:
 
 
Reported: 2015-06-14 21:35 UTC by Bastien Nocera
Modified: 2015-07-08 08:27 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
lua-factory: throw error on bad grl.callback (1.11 KB, patch)
2015-07-07 16:26 UTC, Victor Toso
committed Details | Review
lua-factory: throw error on bad grl.callback (1.10 KB, patch)
2015-07-08 08:27 UTC, Victor Toso
committed Details | Review

Description Bastien Nocera 2015-06-14 21:35:44 UTC
It's possible to throw this error when doing something like:

count = grl.get_options("count")
for i, item in pairs(json) do
  count = count - 1
  grl.callback(media, count)
end
grl.callback()

The last grl.callback will throw a "system" error, instead of telling the developer about the broken script.

  • #0 _g_log_abort
    at gmessages.c line 315
  • #1 g_logv
    at gmessages.c line 1041
  • #2 g_log
    at gmessages.c line 1079
  • #3 g_return_if_fail_warning
    at gmessages.c line 1088
  • #4 grl_l_callback
    at grl-lua-library.c line 966
  • #5 luaD_precall
    from /lib64/liblua-5.3.so
  • #6 luaV_execute
    from /lib64/liblua-5.3.so
  • #7 luaD_call
    from /lib64/liblua-5.3.so
  • #8 luaD_rawrunprotected
    from /lib64/liblua-5.3.so
  • #9 luaD_pcall
    from /lib64/liblua-5.3.so
  • #10 lua_pcallk
    from /lib64/liblua-5.3.so
  • #11 grl_util_fetch_done
    at grl-lua-library.c line 400
  • #12 g_simple_async_result_complete
    at gsimpleasyncresult.c line 801
  • #13 read_async_cb
    at grl-net-wc.c line 641
  • #14 async_ready_callback_wrapper
    at ginputstream.c line 529
  • #15 g_task_return_now
    at gtask.c line 1106
  • #16 complete_in_idle_cb
    at gtask.c line 1120
  • #17 g_main_dispatch
    at gmain.c line 3125
  • #18 g_main_context_dispatch
    at gmain.c line 3750
  • #19 g_main_context_iterate
    at gmain.c line 3821
  • #20 g_main_loop_run
    at gmain.c line 4015
  • #21 gtk_main
    at gtkmain.c line 1219
  • #22 main
    at main.c line 2415

Should we keep track of recent completed operations, and throw an error if the last item was already sent?
Comment 1 Victor Toso 2015-06-15 20:58:49 UTC
On grl_lua_library_set_current_operation we throw a warning with good information about the problem that just happened: "Source '%s' is broken, as there are no pending operations and grl.callback() was not called"

I think a good warning should be enough in this case, pointing to where in Lua source code the grl.callback was trigger which luaL_error provides

http://www.lua.org/manual/5.3/manual.html#luaL_error

If not good enough, we can improve in the future.
Comment 2 Victor Toso 2015-07-07 16:26:12 UTC
Created attachment 307025 [details] [review]
lua-factory: throw error on bad grl.callback

Throw luaL_error instead of system error on broken sources. This
facilitate the developer to find bad usage of grl.callback on lua
sources.
Comment 3 Victor Toso 2015-07-07 16:27:42 UTC
Example of error from last patch by breaking grl-metrolyrics when including another grl.callback() in fetch_page_cb function:

/lua_factory/sources/metrolyrics: 
(test_lua_metrolyrics:5080): Grilo-WARNING **: [lua-library] grl-lua-library.c:423: calling source callback function fail (fetch_page_cb) '/home/vtosodec/jhbuild/src/grilo-plugins/src/lua-factory/sources/grl-metrolyrics.lua:86: Source is broken as grl.callback() was called after last operation has been finalized'
Trace/breakpoint trap (core dumped)
Comment 4 Bastien Nocera 2015-07-07 16:32:10 UTC
Review of attachment 307025 [details] [review]:

Looks good.
Comment 5 Victor Toso 2015-07-08 08:27:22 UTC
The following fix has been pushed:
fe1a534 lua-factory: throw error on bad grl.callback
Comment 6 Victor Toso 2015-07-08 08:27:27 UTC
Created attachment 307054 [details] [review]
lua-factory: throw error on bad grl.callback

Throw luaL_error instead of system error on broken sources. This
facilitate the developer to find bad usage of grl.callback on lua
sources.