Here's a Threading Question only the Best, Brightest and Most Handsome of you can answer:

How can I possibly debug this?

I don’t have any high hopes of anybody here being able to answer, or even so much as ask for more detail.

It is probably far too advanced of a question to ask here.

What were you doing when this occurred? Were you trying to run a threaded task?

Do you have debugging symbols installed? Not just the source code but the debugging symbols too.

Which build are you using? I see tags for 4.25 and 4.27. Is this a source build or from the launcher?

Hello Jared, my friend!

Thanks so much for taking the time, to inquire!

To answers your inquiries:
Yes, all debugging symbols are installed and running through DebugGame Editor. So I have access to the state when debugging. As you can see, the call stack is at the windows native level. What you see in the image is the full callstack available.

Actually I’m using UE4.24.2, but I am unable to post as such, it appears that tag is unavailable. I apologize for that confusion. I meant to mention it in the post, but my frustration level with this was a little to much at that moment. I would have upgraded, but I am having too much difficulty at this moment to do so, my entire Steam networking code collapses in any version other than 4.24.

What I’m doing is some writes to SQLite database. There are never any DB errors and the file is fully locked and not accessed from anywhere else (single entry, etc). I have gone over every line of code I have for my repository and have confirmed that it all is fine. I never get issues if I take this out of a thread, but the UI locks up for too long and I must do my very best to get this code to run in a thread.

This exception appears to be somewhat random. Occurs at different points at different times. In otherwords, I have a process that does these writes and sometimes it occurs after 1 attempt, others it takes 7-10 attempts before the crash.

I have logged and stepped through all the code where and when this issue occurs, but since I can’t get a callstack for it, I have set up extremely verbose logging - to no avail, this seems to be at the at the Engine or OS (windows) level.

The most interesting thing is that all the data appears to be written to the DB. In the WindowsRunnableThread.cpp, the ExitCode is properly set, and obviously, the Runnable->Run(); completes, but the memory becomes invalid at some time between the actual Run() call and Exit() call - but what confuses me, is that there should be nothing happening during that time.

So maybe there isn’t an actual answer here for the issue, but I’m searching for some way to actually get some kind of debugging result.

Sorry, forgot - yes this is indeed a full source build, NOT through the launcher.

FYI, I’m also doing a full rebuild of the engine and game, to clear out any things related to that…

Ayy, I understand your frustration. I hate threaded work myself. Admittedly, I am no expert with that either, but perhaps you could attract a person more adept with threading with a tweak to your title. I’m sure we have a few smart and handsome people around here with experience with threading errors like this, but they may not know what this topic is about unless they happen to click in.

And also, not to throw advertisement at a person looking for answers, but if you’re open to using Google Sheets as a DB instead of SQL, you might have some success with Runtime DataTable.

If you do give it a shot but it’s not a good solution for your project you can feel free to submit a refund request which I will happily approve.

Thanks very much for your input - while I can’t at this time change into a different set with the repository, I can definitely support your project with a purchase very soon

I’ve taken your advice and changed the title of the post. Hopefully it will garner some attention…

No worries friend, good luck! I like your new title, but what I meant was a mention of threading. On a personal level, I’m attracted to topics I know, like gameplay programming and animation topics. If a person really knows threading well and they see a topic with threading in the title, they may too be attracted to respond.

1 Like

What class is Runnable?

It appears that you ar in a thread with the Run at the top of the picture.
Some other thread could be destroying the Runnable asynchronously.
Is there a delete Runnable somewhere else in your code?
Or the end of a function where Runnable is a local variable such that it is auto deleted at the end of the function?

rkeene,

I have a ThreadManager that creates the thread when needed. The thread is only used for 1 process, then it is deleted. It should be clean with regards to this, but your questions do provide an avenue of checks that I’m looking at now.

I will post here as soon as I have checked these avenues with results. Thanks for this idea, I hadn’t yet considered that another thread might possibly be doing this, since I’m sure this shouldn’t be the case, but, you know how it goes…

Remember that Run returns immediately since it is a thread startup. It dies not wait for Run to end.

@rkeene Congratulations! I award you with the Best, Brightest and Most Handsome Award!

Yes, it turns out the GC is destroying my thread manager object prematurely. This seems to be that the thread actually ends on it’s own accord, not when the thread function actually returns.

I’ve made modification to more appropriately use AsyncTask for these purposes, and use threads specifically and only for those processes that run for an indeterminate period of time, such as listen sockets, etc.

Thanks again, your comment put me on the correct path and the issue seems now resolved. I use ‘seems’ as I only ran tests to up to 10x the maximum previously workable number before getting crashes.

So happy for you @devlyn811 ! Thanks for helping out @rkeene ! MVP! MVP!

1 Like

@JaredTherriault

Thanks for your input as well! It does not go unappreciated!