guycalledfrank / bakery-issues

Bug tracker for Bakery
4 stars 0 forks source link

latest github release crashes on 2021.23 #121

Closed laurentopia closed 2 years ago

laurentopia commented 2 years ago

a few seconds after I press bake 100% repro no error message vram is 5GB free used to work in 2020.1.17 (version unavailable in the ui) image image

guycalledfrank commented 2 years ago

I can't repro it with pictured settings on Unity 2021.1.23f1 (if this is the one you mean) and sponza scene. Probably there is something scene-related or Unity-probe-system related. Check if disabling occlusion probes work?

image

Just out of the hospital, still not feeling really well, I apologize for not answering anything for the past 2 weeks

laurentopia commented 2 years ago

what happened to you? turning off occlusion probe does nothing

guycalledfrank commented 2 years ago

Infectious mononucleosis happened to me. But I'm better now. Can you send me any repro package/project?

laurentopia commented 2 years ago

Good you're better!

So I tested this: same project, unity 2020.1.17 before the patch = bakes fine after the patch = quits silently

I'll roll back to the old version. Since you cannot repro that'll be a doozy. Tell me where i can find the version number so you can do a delta.

tomaae commented 2 years ago

crashing unity LTS 2019.4.31 too on all projects I tried, 100% of the time. No error at all. 1.9 works fine.

guycalledfrank commented 2 years ago

о_О Can you describe what happens exactly when you render? You click Render and... editor crashes? Can you check Editor.log then?

tomaae commented 2 years ago

It crashes on "Rendering lightmaps - preparing..." 55% progress I cant find a file named editor.log

Only thing I found is this: shadercompiler-UnityShaderCompiler.exe0.log

Base path: 'C:/Program Files/Unity/Hub/Editor/2019.4.31f1/Editor/Data', plugins path 'C:/Program Files/Unity/Hub/Editor/2019.4.31f1/Editor/Data/PlaybackEngines'
Cmd: initializeCompiler
Cmd: preprocess
  insize=1886 outsize=654 ok=1
Cmd: preprocess
  insize=2669 outsize=721 ok=1
Cmd: preprocess
  insize=15674 outsize=7195 ok=1
Cmd: preprocess
  insize=3149 outsize=381 ok=1
Cmd: preprocess
  insize=13218 outsize=6313 ok=1
Cmd: preprocess
  insize=2498 outsize=1008 ok=1
Unhandled exception: Read from shader compiler process failed: error -2147483644, 0/4 bytes read

Quitting shader compiler process
guycalledfrank commented 2 years ago

Can you check C:/Users/You/AppData/Local/Unity/Editor/Editor.log right after the crash?

tomaae commented 2 years ago
Unloading scenes - done.
UnityEngine.StackTraceUtility:ExtractStackTrace ()
UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
UnityEngine.Logger:Log (UnityEngine.LogType,object)
UnityEngine.Debug:Log (object)
ftRenderLightmap:DebugLogInfo (string) (at Assets/Editor/x64/Bakery/scripts/ftRenderLightmap.cs:3112)
ftRenderLightmap/<RenderLightmapFunc>d__286:MoveNext () (at Assets/Editor/x64/Bakery/scripts/ftRenderLightmap.cs:6616)
ftRenderLightmap:RenderLightmapUpdate () (at Assets/Editor/x64/Bakery/scripts/ftRenderLightmap.cs:4652)
System.Reflection.MonoMethod:Invoke (object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo)
System.Reflection.MethodBase:Invoke (object,object[])
System.Delegate:DynamicInvokeImpl (object[])
System.MulticastDelegate:DynamicInvokeImpl (object[])
System.Delegate:DynamicInvoke (object[])
UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()

(Filename: Assets/Editor/x64/Bakery/scripts/ftRenderLightmap.cs Line: 3112)

ftRenderLightmap.cs 6616 is the last line number. thats where editor log ends

guycalledfrank commented 2 years ago

I don't see any crash data here, usually Unity logs it. Are you sure you didn't open Unity and do something else before reading the log? Also what happens if you disable "unload scenes before render"?

tomaae commented 2 years ago

I did touch anything once it crashed, just opened the log right away. Also, I have scene unloading unchecked.

Here is my full configuration: image image

guycalledfrank commented 2 years ago

Hmmm. Right, it logs "unloading scenes" even when the checkbox is off. What happens next is the launch of the actual baking jobs. OK, maybe it happens because of my executable launching mechanism? Please try following:

tomaae commented 2 years ago

Crashed at same spot, same info in debug

guycalledfrank commented 2 years ago

OK, I can't explain it then. I tested 2019.4 many times. Personally working in 2019.3 (which is not that different) for the whole year. Unity crashes without even logging the error which is extremely strange. Corrupt editor installation? Viruses?

guycalledfrank commented 2 years ago

What happens when it crashes? Typical Window crash window? If so what details are there? It should at least show the crashed module (exe/dll). Driver crash (screen blinks)? Unity just silently disappears?

tomaae commented 2 years ago

No flickering, just window closes. I have latest nvidia drivers, just installed them earlier today.

Right, forgot to check windows events.

Faulting application name: Unity.exe, version: 2019.4.31.23231, time stamp: 0x6152debf
Faulting module name: ucrtbase.dll, version: 10.0.22000.1, time stamp: 0x00e78ce9
Exception code: 0xc0000409
Fault offset: 0x000000000007c648
Faulting process ID: 0x4538
Faulting application start time: 0x01d7dcc4663ae72a
Faulting application path: C:\Program Files\Unity\Hub\Editor\2019.4.31f1\Editor\Unity.exe
Faulting module path: C:\WINDOWS\System32\ucrtbase.dll
Report ID: 29d873a3-5cf0-41a4-8447-bf9bdc583c6b
Faulting package full name: 
Faulting package-relative application ID: 
Fault bucket 1543552944054683640, type 5
Event Name: BEX64
Response: Not available
Cab Id: 0

Problem signature:
P1: Unity.exe
P2: 2019.4.31.23231
P3: 6152debf
P4: ucrtbase.dll
P5: 10.0.22000.1
P6: 00e78ce9
P7: 000000000007c648
P8: c0000409
P9: 0000000000000005
P10: 

I'm, using Kaspersky Internet Security. I dont think I have a virus, but running scan now, that wont hurt. Also updating visual studio and reinstalling unity right now, to get possible corruption out of the way. Will check my windows install integrity afterwards. ucrtbase.dll is visual c++ ide

guycalledfrank commented 2 years ago

Given the buffer overflow error, it kinda sounds like there might be some third-party interfering software (virus, antivirus, any app that injects itself into other apps), so maybe check that.

tomaae commented 2 years ago

what is your ucrtbase.dll version?

tomaae commented 2 years ago

Nope, still not working. I even uninstalled visual studio and all redistributable and installed newest ones after restart. sfc and dsim went through fine too. Still, its just github master that is not working. Regular release works fine even now.

Btw, I'm using Windows 11, so there may be something different if you are using 10.

guycalledfrank commented 2 years ago

Windows 11 doesn't seem to be very stable at the moment, so it may be related. Did you update using the patcher or manually? If manually, are you sure that you updated from BOTH bakery-csharp and bakery-compiled? Script/binary incompatibility could cause some crash (although these are usually logged).

tomaae commented 2 years ago

I used updater as usual. W11 is stable for me. it may be something different or compatibility issues for somethign new you are doing in github version. Doesnt even have to be related to W11. Unfortunately, I dont have W10 to test the same thing. Isnt there a way to debug bakery or editor? It could tell us more.

guycalledfrank commented 2 years ago

Well, debugging is the only way. I guess the first thing to try is to disable the progress bar, in case it does something that W11 doesn't like.

Try commenting out or removing all lines containing simpleProgressBarShow and simpleProgressBarEnd from ftRenderLightmap.cs and ftBuildGraphics.cs, like these:

image

image

tomaae commented 2 years ago

No change, crashes in the same way at same time according to whats being written in unity console. right after probe 2/2 message.

laurentopia commented 2 years ago

It's not a w11 thing, I am on w10

guycalledfrank commented 2 years ago

after probe 2/2 message.

Important bit, didn't hear it before. So my DLLs seem unrelated. Did you try baking any scenes with no light probes or with light probes set to Legacy (so they're not immediately prepared for baking)?

tomaae commented 2 years ago

Now it gets to "Preparing light AreaLight Bar..." May have before too, its difficult to catch since it just instantly closes the window.

Legacy fails too, last message in console is "Preparing (direct) lightmap ... (1/1)

So I tried to bake just probes: image

Detect optimal settings gives this: image

Afterwards I reimported store version to bake lights using legacy mode. Switched back to github version and tried to bake just probes. Same error.

Last message in console:

Running ftrace cookielight "C:\Users\Tomaae\AppData\Local\Temp\frender" probes.dds 4 0 0
UnityEngine.Debug:Log (object)
ftRenderLightmap:DebugLogInfo (string) (at Assets/Editor/x64/Bakery/scripts/ftRenderLightmap.cs:3112)
ftRenderLightmap/<RenderLightProbesFunc>d__279:MoveNext () (at Assets/Editor/x64/Bakery/scripts/ftRenderLightmap.cs:4364)
ftRenderLightmap:RenderLightProbesUpdate () (at Assets/Editor/x64/Bakery/scripts/ftRenderLightmap.cs:2543)
UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()

Only interesting thing I found in logs was in .denoiserlog.txt

2021-11-23
Init...
Tiles: 1
Error (-1): Unknown error (Details: Function "_rtBufferCreate" caught exception: Encountered a rtcore error: m_exports->rtcDeviceContextCreateForCUDA( context, devctx ) returned (2): Invalid device context)

I have RTX3070 with 496.76 drivers. I also tried to reset all my nvidia settings to default and even clean reinstall. Nothing helped there.

guycalledfrank commented 2 years ago

unity LTS 2019.4.31

So I can't see this version in the download archive, but there is .32, and I've just realized that it's a new (October 2021) release, so it must actually share something with 2021.23 (which I can't test as it just immediately crashes on launch).

I downloaded 2019.4.32f1 and tested it, Luckily this version launched without a problem. Imported Bakery, baked example_lights: baked fine. Also tried Sponza and enabled L1 light probes: baked fine.

Do you have RTPreview? Does it work? It does less things with Unity, so perhaps it's easier to debug.

Running ftrace

You should be using RTX mode on 3070, non-RTX won't work there (3xxx deprecated older OptiX support).

Now it gets to "Preparing light AreaLight Bar..."

Does this Area Light have any texture? Does it work without it?

Additionally: is your Editor running in DX11 or DX12 mode (should be in the window header)?

guycalledfrank commented 2 years ago

If you can, please also test this version, this is between Store and the latest patch (June 4). Archive password is your invoice (IN**): tomaae: https://drive.google.com/file/d/1reu9aQiuDfGC8Kk663Nf7FsN2pVhMSTV/view?usp=sharing laurentopia: https://drive.google.com/file/d/1rSgaz9ead3qnJG5oO_3-3qJ212eMsWbR/view?usp=sharing

(Temporarily remove RTPreview files if they'll show any compilation errors)

tomaae commented 2 years ago

You can download all version here: https://unity3d.com/get-unity/download/archive Direct unityhub link: unityhub://2019.4.31f1/bd5abf232a62

I have RTPreview. It just opens command line for a bit and closes. Preview wont start.

No texture on Area Light, Just a material with standard shader using color and emission.

Editor is running in DX11 mode.

Above version works fine, even with L1. I just had to remove RTPreview as you said.

guycalledfrank commented 2 years ago

You can download all version here

Thanks, sorry, I missed it. Tested it, still works here.

Above version works fine, even with L1.

Very useful info, thanks. Can you check these then (July 15, a lot of changes)?

tomaae: https://drive.google.com/file/d/1Xdcj1a5Rx_DdncZDzBLd4hH0H2sGL3hH/view?usp=sharing laurentopia: https://drive.google.com/file/d/1FsrjX5Raj-DgJpxBGdVCS0wBMLttUe2f/view?usp=sharing

tomaae commented 2 years ago

July 15 version works fine for me.

guycalledfrank commented 2 years ago

Can you check the August 10 version please? tomaae: https://drive.google.com/file/d/1GdRaf_uqQ7nRH_Z2wt_3ZlPjiddPcwnk/view?usp=sharing laurentopia: https://drive.google.com/file/d/1cKaFzlWuZ4VDc48khhZ8tJq8s5kF1hwB/view?usp=sharing

tomaae commented 2 years ago

This one crashed unity right away even on just light probe render. nothing useful in any log. legacy lightmap render too. logs not being helpful as well. both showing "preparing" in console, didnt got as far as in master version.

detect optimal settings fails at this point already. I went back to july 15 version to check detect optimal settings, since I didnt do that. It works there.

behavior seems different as it seems to crash much sooner then in master. but it may just crash too fast and not let console to update as it happened at the very beginning. light probe render did not crashed unity in master tho.

btw, you can give me multiple versions at once, I dont mind testing many to help pinpoint closest point of failure.

guycalledfrank commented 2 years ago

Hmmm... in the binaries, the only difference between Jul15 and Aug10 is logging changes. Most DLLs/EXEs were patched to stop their log files from exceeding certain size (no more infinitely growing logs). Including uvgbuffergen.dll which is called from the Unity process. Possibly it can cause something weird?

Can you check Aug10 version, BUT with uvgbuffergen.dll from Jul15? I expect baking to crash, but without Unity crashing.

tomaae commented 2 years ago

Yes, I got this error on every test: image Unity didnt crash.

guycalledfrank commented 2 years ago

Right, so it seems to be log-related. Can you then check Aug10 version, but with this debug version of the DLL? https://drive.google.com/file/d/13yv9dl8nCOuVMLJ2kTMJ4qVl0Ao5llEg/view?usp=sharing

It will show little messageboxes during initialization, like these:

image

Can you please tell me the last message it shows before crashing?

tomaae commented 2 years ago

test

fsize > LOG_LIMIT (4)

OK

guycalledfrank commented 2 years ago

Thanks! I've located the problematic call. Added some deeper debugging messages. Can you please try it with this version of the DLL? https://drive.google.com/file/d/1HHfY9PVY5x8AfWEIZr12gp2R5ErTSVtF/view?usp=sharing

(Same as before - final message box text is important)

tomaae commented 2 years ago

"Permission denied", but this time after "fsize > LOG_LIMIT (3)". Didnt get to (4).

guycalledfrank commented 2 years ago

Interesting. Any chance some version control system or something else locked .uvgblog.txt file from writing? Is it marked as read-only or something?

tomaae commented 2 years ago

it had hidden attribute. I have deleted all 3 log files and it went through. They are recreated without hidden attribute now. Updated to github master version and that works now too.

it is not something I changed for sure and only these 3 files were marked as hidden. Old version was able to access them before, as there are timestamps inside. in other projects, only .uvgblog.txt is marked as hidden. I have deleted them from all projects now.

Thanks. Everything looks working fine now, if you want to do some further testing, let me know.

guycalledfrank commented 2 years ago

Thanks for the tests! I've fixed the logging, it will now disable both read-only and hidden attributes, if encountered: https://github.com/guycalledfrank/bakery-compiled/commit/3b07c002f17cf6de1650901aa50ef340d2353982

The bug could be reproduced by copying the contents of .uvgblog.txt (or any other log file) a few times, so it becomes > 1 MB and marking it as hidden. Current latest patch should work even in this case.

tomaae commented 2 years ago

Good job :) yea, it was above 2MB from what I remember.