-
Notifications
You must be signed in to change notification settings - Fork 832
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error handling improvements in chunk build threads #1794
Error handling improvements in chunk build threads #1794
Conversation
Can you rebase this against the |
Added a queue to store chunk build failures in `ChunkBuilder` Modified `scheduleDeferred` to add `CompletableFuture` exceptions to this queue Created `handlePendingFailures` in `RenderSectionManager` to drain the failure queue and throw any found exception Modified `WorkStealingFutureDrain.findNext` to unwrap `CompletionException`s that contain `CrashException` so that the crash report context is preserved Wrapped the `ChunkRenderRebuildTask.performBuild` outer loop in a try-catch block to handle exceptions from chunk building and add chunk section / render context information Improved `RenderSection.toString` to provide more useful information Changed `ChunkBuilder.processJob` to use the Sodium logger rather than `printStackTrace` Rebased atop 7aba7c7 on 01/08/23: Modified `ChunkJobResult.unwrap` to unwrap `CompletionException`s that contain `CrashException` so that the crash report context is preserved Wrapped the `ChunkRenderMeshingTask.performBuild` outer loop in a try-catch block to handle exceptions from chunk building and add chunk section / render context information Improved `RenderSection.toString` to provide more useful information Updated `ChunkJobTyped.execute` to use the Sodium logger (there may be multiple chunk build errors before the main thread gets the results and aborts, so it's useful to log everything)
9c7447e
to
03668ab
Compare
Updated list of changes after rebase:
|
...main/java/me/jellysquid/mods/sodium/client/render/chunk/compile/executor/ChunkJobResult.java
Outdated
Show resolved
Hide resolved
src/main/java/me/jellysquid/mods/sodium/client/render/chunk/compile/executor/ChunkJobTyped.java
Outdated
Show resolved
Hide resolved
...ava/me/jellysquid/mods/sodium/client/render/chunk/compile/tasks/ChunkBuilderMeshingTask.java
Outdated
Show resolved
Hide resolved
Changes look good to me outside of minor nitpicks; will merge when resolved. |
I noticed in some recent issue reports that chunk build exceptions weren't being propagated to the main thread as intended in #615. This is because deferred (non-important) chunk builds aren't polled from the main thread using
join()
unlike important chunk rebuilds, and since 696da3c Sodium always treats initial chunk builds as deferred, so if a particular error makes a chunk never successfully build,join()
will never be called on it!This PR therefore correctly propagates these exceptions, along with extra handling for crash reporting that adds Sodium rendering context, with the following changes:
ChunkBuilder
scheduleDeferred
to addCompletableFuture
exceptions to this queuehandlePendingFailures
inRenderSectionManager
to drain the failure queue and throw any found exceptionWorkStealingFutureDrain.findNext
to unwrapCompletionException
s that containCrashException
so that the crash report context is preservedChunkRenderRebuildTask.performBuild
outer loop in a try-catch block to handle exceptions from chunk building and add chunk section / render context informationRenderSection.toString
to provide more useful informationChunkBuilder.processJob
to use the Sodium logger rather thanprintStackTrace
For
scheduleDeferred
I changed it to usewhenComplete
as it doesn't wrap the exception inCompletionException
(so anyCrashException
can be propagated directly) and it allows us to returnCompletableFuture<ChunkBuildResult>
matching the return type ofschedule
.This is what the crash report context looks like: