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 726563 - lua-factory: Assert when overwriting user_data with concurrent resolves
lua-factory: Assert when overwriting user_data with concurrent resolves
Status: RESOLVED FIXED
Product: grilo
Classification: Other
Component: plugins
unspecified
Other All
: Normal normal
: ---
Assigned To: grilo-maint
grilo-maint
Depends on:
Blocks:
 
 
Reported: 2014-03-17 15:58 UTC by Bastien Nocera
Modified: 2014-03-19 11:32 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
lua-factory: Assert when overwriting user_data with concurrent resolves (2.20 KB, patch)
2014-03-17 15:58 UTC, Bastien Nocera
committed Details | Review
lua-factory: Fix concurrent Lua calls to same source (10.25 KB, patch)
2014-03-18 08:33 UTC, Bastien Nocera
committed Details | Review

Description Bastien Nocera 2014-03-17 15:58:22 UTC
.
Comment 1 Bastien Nocera 2014-03-17 15:58:25 UTC
Created attachment 272178 [details] [review]
lua-factory: Assert when overwriting user_data with concurrent resolves

This will assert when multiple resolve calls are launched concurrently
for the same lua source.

We would set the operation spec for that state when calling resolve, but
as it is asynchronous, the state would get assigned multiple operation
specs, with the latter overwriting the earlier one.

This is easily reproduced by browsing in grilo-test-ui and select
different video items quickly, so one of the lua sources that implements
resolve() gets called twice with the same lua state.

The fix might be to have one lua state per call, or have a way to get
the operation spec for that particular resolve call.
Comment 2 Bastien Nocera 2014-03-17 16:00:28 UTC
The reproducer is:
- install the lua sources from https://github.com/grilofw/grilo-lua-sources
- launch grilo-test-ui
- go into a source with multiple videos
- select one media then another quickly

** (grilo-test-ui-0.2:26963): CRITICAL **: grl_lua_factory_source_resolve: assertion 'grl_lua_library_load_operation_data (L) == NULL' failed


  • #0 g_logv
    at gmessages.c line 1038
  • #1 g_log
    at gmessages.c line 1071
  • #2 resolve_idle
    at grl-source.c line 2402
  • #3 g_main_dispatch
    at gmain.c line 3069
  • #4 g_main_context_dispatch
    at gmain.c line 3648
  • #5 g_main_context_iterate
    at gmain.c line 3719
  • #6 g_main_loop_run
    at gmain.c line 3913
  • #7 gtk_main
    at gtkmain.c line 1192
  • #8 main
    at main.c line 2423

Comment 3 Juan A. Suarez Romero 2014-03-17 23:11:29 UTC
Attachment 272178 [details] pushed as 10d7ba8 - lua-factory: Assert when overwriting user_data with concurrent resolves
Comment 4 Bastien Nocera 2014-03-18 00:07:41 UTC
The problem isn't fixed, the patch transforms crashers into assertions/g_warnings.
Comment 5 Bastien Nocera 2014-03-18 08:33:37 UTC
Created attachment 272248 [details] [review]
lua-factory: Fix concurrent Lua calls to same source

This ensures that each fetch callback is called with the correct
OperationSpec as the current one, so that we avoid leaking memory
or crashing when 2 items overwrite the only store for OperationData.

Before each lua_pcall(), set the current operation data,
and unset it after.
Comment 6 Victor Toso 2014-03-19 04:48:43 UTC
Review of attachment 272248 [details] [review]:

This worked well. I created a test trying to resolve several lyrics from grl-metrolyics (up to 500).
It doesn't crash anymore.
Comment 7 Bastien Nocera 2014-03-19 11:32:03 UTC
Attachment 272248 [details] pushed as fa88f91 - lua-factory: Fix concurrent Lua calls to same source