britzl / defold-richtext

Defold-RichText is a system to create styled text based on an HTML inspired markup language
MIT License
75 stars 12 forks source link

Weird, hard to repro bug #37

Closed dapetcu21 closed 3 years ago

dapetcu21 commented 5 years ago

I don't know if RichText is at fault, but we've been having this bug happen once or twice a day on one of our expo machines at Gamescom. RichText is the main shared codepath between all the occurence points of this bug, so I said I'd share.

We haven't had it ever happen on any other PC.

The machine is a MacBookPro10,1, 8GB RAM, Mojave 10.14.5, NVIDIA GT650M, connected to an external display.

Nothing in the console.

IMG_20190822_144805282 IMG_20190822_144910659 IMG_20190822_144751540

britzl commented 5 years ago

So one word is repeated?

dapetcu21 commented 5 years ago

Yeah. Always last one. And it's not in the right place. Also the metrics for the whole line are incorrect (the line seems to be larger than it should be). What was kinda weird is that the game would go into a "mode" where this bug would happen consistently for some percentage of the rich text being created on the screen, then after a while, it would go back to normal.

dapetcu21 commented 5 years ago

Maybe you're inserting/deleting things from the words array while iterating it? I don't remember something like that, though (except for combine_words, which I was not using in the build above).

britzl commented 5 years ago

Maybe there's a rare crash somewhere that stops the flow of execution somehow. Do you have a Lua crash handler set?

dapetcu21 commented 5 years ago

Fair point. I just realised that in that particular build, the google analytics extension calls sys.set_error_handler() and doesn't print out the error, so it could have happened that GA swallowed the error. I'll put a print in that and hope it happens again.

I do have the calls to richtext.create() wrapped in a xpcall, so if anything happens there, the stack trace should get printed out regardless, but I've seen nothing of that.

dapetcu21 commented 5 years ago

Though it seems like the errors are printed anyway by the engine before the error handler set with sys.set_error_handler() is called... So that shouldn't be a problem.

britzl commented 5 years ago

Any luck reproducing this issue?

dapetcu21 commented 5 years ago

Not really. We haven't had direct access to the machine on which this was happening and we didn't get the chance to investigate further since Gamescom. But it's surely something we need to look into.

dapetcu21 commented 4 years ago

I have this happening again to a user:

B13BE884-C7C4-4AB9-AA11-88321325ACB5

https://steamcommunity.com/app/1016770/discussions/0/1753520327890252593/#c1753520327891986196

britzl commented 4 years ago

This is different issue from when some characters get lost though isn't it?

What's the string that gets passed to RichText for the choice "Let's go back to talking about yourself, Darryl"? Is there anything special with how you treat the returned result from RichText?

dapetcu21 commented 4 years ago

I'm not sure. In the original issue the last word got duplicated, which is the case here as well. The only difference is that now I'm using combine_words (and also the code for that changed quite a bit since I first spotted the issue). It also seems like it manifests intermittently and only on particular machines (this user's for now).

The only operations that I do on the words are the following:

britzl commented 4 years ago

Oh yeah, sorry, I seem to recall that there was an issue with some characters getting lost, but I think that was a different thing.

I wonder why it only happens for some users? It doesn't really feel like a rendering issue, more like a bug in RichText with a duplicate text node that gets places incorrectly. Could it be that the text is created more than once and that some cleanup code you have somewhere doesn't delete all nodes? It would not really explain why the text isn't in exactly the same place though... unless you modify the text afterwards and reposition words.

britzl commented 3 years ago

No updates to this issue in a long time and no clear steps to reproduce. Closing.