GNOME Bugzilla – Bug 726563
lua-factory: Assert when overwriting user_data with concurrent resolves
Last modified: 2014-03-19 11:32:07 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.
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
+ Trace 233354
Attachment 272178 [details] pushed as 10d7ba8 - lua-factory: Assert when overwriting user_data with concurrent resolves
The problem isn't fixed, the patch transforms crashers into assertions/g_warnings.
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.
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.
Attachment 272248 [details] pushed as fa88f91 - lua-factory: Fix concurrent Lua calls to same source