makamys / CoreTweaks

A bunch of random bug fixes, optimizations and tweaks (1.7.10)
MIT License
46 stars 5 forks source link

Crash when thread gets interrupted while generating transformer cache diff #19

Closed MagmaBro123 closed 1 year ago

MagmaBro123 commented 1 year ago

Title.

https://pastebin.com/hVTnhvqC

Something about 'com/jcraft/jorbis/StaticCodeBook', whatever this is.

makamys commented 1 year ago

You'll have to post the full log (fml-client-latest.log probably). Also, did you check that it doesn't happen with 0.3.0.4?

MagmaBro123 commented 1 year ago

No crash with 0.3.0.4.

fml-client-latest.log

makamys commented 1 year ago

Not quite sure why this happens and I couldn't reproduce it, but I pushed a commit that might fix it. Can you try it and post a log again (regardless of whether it crashes or not)?

MagmaBro123 commented 1 year ago

Yep, game loads to main menu and doesn't crash.

makamys commented 1 year ago

And the log?

MagmaBro123 commented 1 year ago

Nothing in the log as far as I'm seeing.

makamys commented 1 year ago

Yeah, but can you post it? I need to see it myself to verify that the fix worked.

MagmaBro123 commented 1 year ago

Ah, whoops.

This is in a modpack btw, but the crash report I gave before mentions 'com/jcraft/jorbis/StaticCodeBook', though I have no clue which mod that's from.

But here's the log with the Actions version.

fml-client-latest.log

makamys commented 1 year ago

Dropping cpw.mods.fml.common.asm.transformers.TerminalTransformer from cache because we don't care about it anymore.

That's strange, did you change the transformersToCache config option? Your log implies that caching was turned off for all transformers.

I have no clue which mod that's from

Jorbis is a sound library vanilla comes with, the error happened while loading one of its classes, not sure why though.

MagmaBro123 commented 1 year ago

Dropping cpw.mods.fml.common.asm.transformers.TerminalTransformer from cache because we don't care about it anymore.

That's strange, did you change the transformersToCache config option? Your log implies that caching was turned off for all transformers.

I have no clue which mod that's from

Jorbis is a sound library vanilla comes with, the error happened while loading one of its classes, not sure why though.

No, default config.

image

All I know is the fix you made works somehow.

makamys commented 1 year ago

Oh. Okay, that message is because of a separate bug, that one's on me. It shows up every time, and nothing actually gets dropped when it gets printed.

So there's just one more thing, can you delete your coretweaks/cache/classTransformerLite.cache and re-run the game and post the log of that run? I want to see what happens when the cache first gets constructed.

MagmaBro123 commented 1 year ago

No classTransformerLite.cache exists, only a jarDiscoverer.cache.

fml-client-latest.log

makamys commented 1 year ago

Odd, are you perhaps using the "Kill" button to close the game instead of closing it normally?

MagmaBro123 commented 1 year ago

The game crashes as soon as I get to the main menu, the Back to main menu button in the CoreTweaks crash screen just closes/kills the game.

makamys commented 1 year ago

There's a crash? I thought you said

Yep, game loads to main menu and doesn't crash.

MagmaBro123 commented 1 year ago

3.0.1 causes the crash, the one from the Actions tab (https://github.com/makamys/CoreTweaks/actions/runs/6631189385) doesn't.

The log file (https://github.com/makamys/CoreTweaks/issues/19#issuecomment-1778008474) I gave is the one when using the Actions build. This one (https://github.com/makamys/CoreTweaks/issues/19#issuecomment-1777687619) is with 3.0.1.

makamys commented 1 year ago

Well, what I was asking is if you were closing the game properly while using the Actions build. The cache only gets saved when the game shuts down cleanly, so if you were killing it, that would explain why it's not there.

MagmaBro123 commented 1 year ago

Well, what I was asking is if you were closing the game properly while using the Actions build. The cache only gets saved when the game shuts down cleanly, so if you were killing it, that would explain why it's not there.

Ah, whoops. Since the Actions build doesn't crash I can close the game just fine, I didn't Task Manager kill it or anything. (Probably another bug or something, I have no idea.)

makamys commented 1 year ago

Okay, try clicking the "Quit Game" button on the main menu and see if the cache file appears.

MagmaBro123 commented 1 year ago

Didn't know it only did this upon quitting, I'm dumb then apparently

fml-client-latest.log

image

makamys commented 1 year ago

There we go, I'm guessing you were pressing Prism's "Kill" button without realizing.

Anyway, I looked at your logs again and noticed something... You switched modpacks after the first log! The first one was in an instance called "1.7.10", and the ones after were in "LOTR The Forgotten Ages", with a different set of mods. So the results are inconclusive. The crash most likely disappeared because you switched modpacks, not because you updated CoreTweaks.

I need you to test the Actions build in the "1.7.10" pack, where the crash happened, and send me a log of the run. (And sorry for asking for so many logs, but since I can't reproduce the issue, it's the only way I have of troubleshooting it.) Also I pushed a new commit with some improvements to logging.

MagmaBro123 commented 1 year ago

fml-client-latest.log (1.7.10 instance with the original 0.3.1 jar)

Sorry for being confusing if I am. (Btw, you sure you're doing this outside of a dev env?)

makamys commented 1 year ago

I meant test the Actions build (0.3.1-3-g3f1a035), we already know 0.3.1 crashes.

And yeah, I was testing in production with Dynamic Surroundings + Sound Filters + MAtmos + Aether II, but no dice.

MagmaBro123 commented 1 year ago

Well, the builds you did somehow work. Soooo... Resolved?

makamys commented 1 year ago

Again, I asked you to post a log.

MagmaBro123 commented 1 year ago

Already did, https://github.com/makamys/CoreTweaks/issues/19#issuecomment-1778184867

makamys commented 1 year ago

I mean a log with 0.3.1-3-g3f1a035 in the "1.7.10" instance where the crash in the first post happened.

MagmaBro123 commented 1 year ago

Ah, whoops.

fml-client-latest.log

makamys commented 1 year ago

That looks fine, now I just need a log after deleting classTransformerLite.cache (In the same instance with the same mods)

MagmaBro123 commented 1 year ago

fml-client-latest.log

makamys commented 1 year ago

Thanks, that should be the last one I'll need.

I managed to reproduce it now in dev with no other mods by a stroke of luck, but it's very rare. I also found a way to consistently cause it to happen with development tools.

It's a race condition that happens when the thread gets interrupted while a diff is being generated. In your case this happened on the sound command thread. Since it's a rare issue, simply quietly ignoring the error and trying again on the next run is a valid solution, which I just implemented.

How to reproduce it 0. Disable music 1. Add the following breakpoints: - `Thread#interrupt` - `CommandThread#run`, line 112 (`soundSystem.CommandQueue( null );`) - `Channels$ReadableByteChannelImpl#read`, line 385 (`bytesRead = in.read(buf, 0, bytesToRead);`), with the following condition: `!Thread.currentThread().getName().contains("Client")` 2. Disable all breakpoints and launch the game 3. Once you're on the main menu, enable breakpoints 4. Click a button 5. You will hit the interrupt breakpoint on the main thread, continue that thread 6. You will hit the CommandThread breakpoint on the command thread, continue that thread 7. You will hit the Channels breakpoint on the command thread, continue **the main thread** 8. Disable all breakpoints and continue the game
MagmaBro123 commented 1 year ago

It seems the new version completely breaks rendering.

2023-10-27_11 46 31

makamys commented 1 year ago

I find that highly unlikely, are you sure this only happens with CoreTweaks?

MagmaBro123 commented 1 year ago

Apparently LUMINA (a FalsePattern mod) is the issue. 'fix_heightmap_range' has to be disabled (sometimes it causes this or just crashes).

makamys commented 1 year ago

I see, I also get a crash with it. I'll just make my mixin get disabled if LUMINA is detected, since I assume it's unnecessary anyway, being another lighting fix.

MagmaBro123 commented 1 year ago

Apparently TCLPrject's Particle Distance Increaser mod is what causes the invisible world issue. So that's figured out.

makamys commented 1 year ago

I can't find a mod by that name, do you mean Entity Render Distance Extender?

MagmaBro123 commented 1 year ago

https://www.curseforge.com/minecraft/mc-mods/increase-particle-distance