Skip to content
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

Nasty Crash correlated with a Malt Node Tree #560

Closed
dibli-goost opened this issue Jun 10, 2024 · 18 comments
Closed

Nasty Crash correlated with a Malt Node Tree #560

dibli-goost opened this issue Jun 10, 2024 · 18 comments

Comments

@dibli-goost
Copy link

dibli-goost commented Jun 10, 2024

Malt version

Node Groups

Blender version

Blender 4.1.1

OS

Windows 10

Hardware info

AMD Ryzen Threadripper 1920x 12-Core Processor, 3950 Mhz, 24 Logical Processors | 32GB RAM | NVIDIA GeForce GTX 1080 Ti

Issue description and reproduction steps

I'm not 100% positive that this crash is being caused due to Malt, I can reproduce via this file with factory defaults as well. The node tree was appended out of a project that was crashing on load, I was trying to figure out what was causing the crash and then I happened upon this node tree.

There's some bad nodes in there, I don't think they're the source of the issue, but I couldn't delete them because that'll cause blender to immediately crash.

To reproduce, all you should have to do is open the file and then open a new or different file. Blender should immediately crash.

Attachments

malt 2024-06-10(01-28).log

nodetree bug.crash.txt

nodetree bug.zip


Here's the crash from the character file, maybe it's the same thing.

Corsi Vinifera.crash.txt

@dibli-goost
Copy link
Author

This is a much more cut-down version of the blend. Same reproduction steps, just need to open the file and then attempt to open another one. It'll immediately crash.

nodetree.zip

I got back the progress I had made on that character file, redoing a bunch of stuff from the past couple of days, and I wound up running into the same crash on load again. Only started to happen once I started making changes to that node tree.

I'm guessing the node tree is corrupted, so I'm just going to rebuild the node tree from scratch in that character project and hope it doesn't happen again.

@pragma37
Copy link
Member

The issue seems to happen specifically with the Line Width property of the MAIN PIXEL SHADER Output node in Skin Node Tree.
The internal Blender property seemingly has become corrupted. But this is not something that Malt or any other addon should be able to cause, no matter what.
I don't think there's any way to work around this issue from the Python/addon side.
I'll ask if it's ok to open a report for this on the Blender bug tracker.

@ksami
Copy link

ksami commented Jun 21, 2024

I think I'm running into a similar corruption issue, seems to happen when I try to undo something like adding an image node though I haven't been able to reliably reproduce it. It also affects previous autosaves and incremental saves where they crash immediately when opening Blender.

Since it's a Blender bug I guess there's no choice but to wait. In the meantime, does this mean it would be safer to use code based materials for now?

For anyone else trying to recover their work, here are the steps I took:

  1. Start a new blend file
  2. File > Append... and select the scene from the crashed file
  3. From the outliner, switch the Display Mode from View Layer to Blender File, delete the material linked to the affected node group (deleting the node group directly causes a crash)
  4. File > Cleanup > Unused Data-Blocks and the affected node group should now be deleted with no issues

@dibli-goost
Copy link
Author

dibli-goost commented Jun 22, 2024

I got back the progress I had made on that character file, redoing a bunch of stuff from the past couple of days, and I wound up running into the same crash on load again. Only started to happen once I started making changes to that node tree.

It's back 😢 I was working on the same character project file for a bit, it seemed fine. Then I tried to load it about an hour ago and it's crashing on load.

It seems to have started occurring in a different node tree. I've appended it out and isolated as before. Blender crashes on trying to load a project after loading this one. I can also crash blender by just simply trying to delete either of the two remaining nodes in the node tree. I was able to get rid of every other node just fine.

Are these crashes still being caused by the Line Width Property? I haven't even touched it since starting these projects. But the last thing I did before the crashes started up again was plug that combine node into the main pass out.

x1.zip

For anyone else trying to recover their work, here are the steps I took:

Unfortunately, this isn't working for me. Blender crashes upon using the clean up operator.


Edit: If I delete the input props on the main pass, I can delete the node, but attempting to delete the combine will still crash. So it looks like it's corrupted too.

@ksami
Copy link

ksami commented Jun 22, 2024

I don't think it's only caused by Line Width, I've had it happen with Image and Color Gradient in node trees where Line Width is not connected.

Did you ever undo anything in the node tree? My theory is undo-ing causes something between Blender and Malt to go out of sync, at least from what I understand from one of my Malt crash logs while trying to reproduce the crash by deleting and undo-ing an Image node.

Malt > INIT PIPELINE: C:\Users\...\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\addons\BlenderMalt\.MaltPath\Malt\Pipelines\NPR_Pipeline\NPR_Pipeline.py
Blender > Blender 4.1.1 b'blender-v4.1-release' b'e1743a0317bc'
Blender > Traceback (most recent call last):

Blender >
Blender >   File "C:\Users\...\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\addons\BlenderMalt\MaltNodes\MaltNodeTree.py", line 306, in update_ext
    source = self.get_generated_source(force_update=True)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Blender >
Blender >   File "C:\Users\...\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\addons\BlenderMalt\MaltNodes\MaltNodeTree.py", line 237, in get_generated_source
    shader[output.io_type] = get_source(output)
                             ^^^^^^^^^^^^^^^^^^

Blender >
Blender >   File "C:\Users\...\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\addons\BlenderMalt\MaltNodes\MaltNodeTree.py", line 231, in get_source
    code += node.get_source_code(transpiler) + '\n'
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Blender >
Blender >   File "C:\Users\...\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\addons\BlenderMalt\MaltNodes\Nodes\MaltFunctionNode.py", line 199, in get_source_code
    socket = self.inputs[parameter['name']]
             ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^

Blender >
Blender > KeyError: 'bpy_prop_collection[key]: key "base_color" not found'

Blender >

malt 2024-06-15(22-03).log
blender-crash-240615.txt

Unfortunately, this isn't working for me. Blender crashes upon using the clean up operator.

Try saving the file before running the clean up operation, I had one attempt where though it crashed when running clean up, re-opening the file after the crash showed that the node was deleted.

@pragma37
Copy link
Member

I don't think it's only caused by Line Width, I've had it happen with Image and Color Gradient in node trees where Line Width is not connected.

I didn't mean to say it can only happen with Line Width, this is about Blender Python properties somehow getting corrupted.
But in the linked file the corrupted property was Line Width.
Also, being connected or not has nothing to do with it.


I've been looking deeper into this and I found a workaround to prevent the crash, but it requires patching Blender itself, and I doubt a workaround like that would be accepted without knowing what causes the corruption in the first place, so I'll have to look further into it.

@ksami
Copy link

ksami commented Jun 29, 2024

👍 Thanks for looking into it!

@pragma37
Copy link
Member

pragma37 commented Jul 6, 2024

I can't figure out the reason why this happens, so this is the best I can do for now:

Here's a custom build of Blender 4.1 that should allow you to load corrupted files without crashes
https://drive.google.com/file/d/1wqRVISdip_eMbBMnM_pooBW1CEF6utHD/view?usp=sharing
Once you have saved your file with this version, it should work again on the regular Blender release.

This version also prints the name of the corrupted property. For example:
IDPROP ERROR: read_ui_data: U_0_main_pass_pixel_shader_output1_0_Line_Width (8)
I'd appreciate it if you could post here your IDPROP ERROR messages, so we can (hopefully) find a pattern.
Also, if you figure out a somewhat reliable way to generate a corrupted file, that would be massively useful.

I've also updated the Development and Node Groups versions of Malt to fully remove the use of the old Blender's _RNA_UI system. I have the suspicion that the issue might be related to this, but I can't say for sure.

So, long story short:

  • Download the new Malt (Development or Node Group versions).
  • Fix your corrupted files with the Blender build I've uploaded and report your IDPROP ERROR messages.
  • But use your regular Blender install for work.
  • If your files are still getting corrupted with the new Malt version, report this as well.

@ksami
Copy link

ksami commented Jul 6, 2024

I had to run the patched Blender from Powershell to see the output, this is what I got from 2 separate corrupted files though still haven't found a reliable way to reproduce it
IDPROP ERROR: read_ui_data: U_0_vector_4d1_0_a (8)
IDPROP ERROR: read_ui_data: U_0_color_gradient1_0_Coord (8)

Will feedback on the new Malt version later

@ksami
Copy link

ksami commented Jul 9, 2024

So I tried the latest Node Group version, no problems so far. In fact, I don't know if it's my imagination or not, but it seems a little smoother/faster now.

@ksami
Copy link

ksami commented Jul 24, 2024

Unfortunately I got a corrupted file again though it didn't crash while I was working on it but when I reopened the saved file.
Using Blender 4.2 and the newest node-groups-latest build at c88fa73

IDPROP ERROR: read_ui_data: U_0_vector_4d1_0_a (8)

@HSDSZ
Copy link

HSDSZ commented Aug 1, 2024

could we have a custom build of blender 4.2 that fix this bug? My file fail to open again in blender 4.2

@pragma37
Copy link
Member

could we have a custom build of blender 4.2 that fix this bug? My file fail to open again in blender 4.2

Here you have it! :)
https://builder.blender.org/download/patch/PR126790/

I'm still looking into this, but it's quite tricky to figure out.

@Teelron
Copy link

Teelron commented Sep 20, 2024

I think I've gotten the file corruption to happen consistently, but it won't cause a crash itself.

  1. Open new file
  2. Give default cube malt node tree
  3. Add a vec4 math node
  4. switch to Combine
  5. save

After that, the blend file is corrupted and it will crash when loading.

@ksami
Copy link

ksami commented Sep 20, 2024

I can confirm this works for me too, the patched build reports the corrupted property as

IDPROP ERROR: read_ui_data: U_0_vector_4d1_0_a (8)
IDPROP ERROR: read_ui_data: U_0_vector_4d1_0_b (8)

@pragma37 I think you've been waiting for this

@pragma37
Copy link
Member

pragma37 commented Sep 21, 2024

Yes! Thank you so much @Teelron!

I've been able to set up a super simple reproduction script that doesn't even require Malt:

import bpy
C = bpy.context

C.scene["test"] = [1.0,1.0,1.0,1.0]
C.scene.id_properties_ui("test").update(default = [1.0,1.0,1.0,1.0])

C.scene["test"] = 1.0
C.scene.id_properties_ui("test").update(default = 1.0)

I'll open a report in the Blender bug tracker and try to find a fix/workaround.

@pragma37
Copy link
Member

This is finally fixed! :)
The root cause has been fixed already in Blender 4.3 and it will be backported to 4.2.3
https://projects.blender.org/blender/blender/issues/127952

Aside from that, I've also implemented a simple workaround on the Malt side, so this should no longer be an issue even in unpatched Blender versions.

@ksami
Copy link

ksami commented Sep 25, 2024

Thanks for the quick fix! And thanks @Teelron for the repro too!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants