[Vala] Need help in debugging async code



Hi all,

I encounter random crashes in my app, which (it's my guess) is triggered
when I call callback in async method.

Such as

public async void something() {
  SourceFunc callback_ref = something.callback;

  do_something_that_calls_another_callback(() => {
    callback_ref(); // here's crash happening. approximately 1/10000 calls
  });

  yield;
}

The chain of async calls is nested.

I get stack traces like this:
https://gist.githubusercontent.com/mspanc/9ca4795f48e56149a9a2/raw/9be534c66409b26820a66d54f8610f2aa6306e1e/gistfile1.txt

It's rather hard to believe that such basic thing as memory allocation is
broken in GLib.

Crash happens totally randomly, once per 1-3 days. You can imagine how hard
is to collect test cases. I am trying to hunt more stack traces in order to
find a pattern, but maybe in the meantime anyone here can share experience
in debugging such issues?

Or maybe there are some well-known bugs or antipatterns related to async
functions that should be avoided?

I use GLib 2.44 & Vala 0.30.0. I will try to upgrade to 2.46 but I see
nothing related in the changelog.

m.


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