Skip to content

Commit

Permalink
Worker::GetString: fix segfault
Browse files Browse the repository at this point in the history
There's a very hard to debug race condition around here. This is not
a proper fix, but with this, we're only "losing" frames instead of
plain segfaulting the tracy profiler.

I've been investigating this bug for a while, something very weird
happens on the client side. As soon as I send the column/line position
in the trace, some "???" frames appear. Hovering those frames
segfaults tracy.

I've been running this in GDB on both sides (client & profiler), and
as soon as we slow down the client, the "???" frames disappear. This
seem to point towards a race condition.

Instead of spending more hours understanding the client internals, I'm
rather going to go for this temporary fix and test this profiler on
Nixpkgs, figuring out if it worth investing more time fixing this race
condition or not.
  • Loading branch information
picnoir committed Feb 16, 2024
1 parent 37aff70 commit c9addab
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions server/TracyWorker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2389,8 +2389,11 @@ const char* Worker::GetString( const StringRef& ref ) const
{
if( ref.isidx )
{
assert( ref.active );
return m_data.stringData[ref.str];
if( ref.active ) {
return m_data.stringData[ref.str];
} else {
return "???";
}
}
else
{
Expand Down

0 comments on commit c9addab

Please sign in to comment.