OSL: Blender crashes when activating object with OSL material (still) #92645

Closed
opened 2021-10-30 12:26:49 +02:00 by Ilja Razinkov · 20 comments

System Information
Operating system: 'macOS-11.6-x86_64-i386-64bit'
Graphics card: 'AMD Radeon Pro 570X OpenGL Engine'

Blender Version
Broken: Blender 3.0.0, Commit date: 2021-10-29 18:17, Hash fcf1ba18f0
Worked: 2.93

I have an object with some materials with osl scripts.
With latest beta blender constantly crashes when simply activating it (from crash.txt: osl_get_attribute), scrolling in materials pane for a bit and moving viewport
Look at video, corresponding blend and crash log at this report: https://developer.blender.org/T92503

#92503 closed as resolved, but error still present with latest beta (and alpha 310), to the point where blender is unusable with OSL objects (for me at least).
There was always occasional crashes when opening material pane, but now this is instakill for blender somehow //

# Blender 3.0.0, Commit date: 2021-10-29 18:17, Hash fcf1ba18f0c4
bpy.context.space_data.context = 'MATERIAL'  # Property

# backtrace
0   blender                             0x00000001198922f7 BLI_system_backtrace + 55
1   blender                             0x000000010f9112b8 sig_handle_crash + 392
2   libsystem_platform.dylib            0x00007fff20458d7d _sigtramp + 29
3   ???                                 0x0000000000000000 0x0 + 0
4   blender                             0x0000000111a46fca _ZN3ccl17OSLRenderServices13get_attributeEPNS_10ShaderDataEbN16OpenImageIO_v2_27ustringENS3_8TypeDescES4_Pv + 954
5   blender                             0x0000000111a46c02 _ZN3ccl17OSLRenderServices13get_attributeEPN9OSL_v1_1113ShaderGlobalsEbN16OpenImageIO_v2_27ustringENS4_8TypeDescES5_Pv + 98
6   blender                             0x000000010f7d97b2 _ZN9OSL_v1_1114ShadingContext17osl_get_attributeEPNS_13ShaderGlobalsEPviN16OpenImageIO_v2_27ustringES5_iiNS4_8TypeDescES3_ + 178
7   blender                             0x000000010f7bf240 osl_get_attribute + 112
8   ???                                 0x0000000146d777cf 0x0 + 5483493327

# Python backtrace
**System Information** Operating system: 'macOS-11.6-x86_64-i386-64bit' Graphics card: 'AMD Radeon Pro 570X OpenGL Engine' **Blender Version** Broken: Blender 3.0.0, Commit date: 2021-10-29 18:17, Hash fcf1ba18f0c4 Worked: 2.93 I have an object with some materials with osl scripts. With latest beta blender constantly crashes when simply activating it (from crash.txt: osl_get_attribute), scrolling in materials pane for a bit and moving viewport Look at video, corresponding blend and crash log at this report: https://developer.blender.org/T92503 #92503 closed as resolved, but error still present with latest beta (and alpha 310), to the point where blender is unusable with OSL objects (for me at least). There was always occasional crashes when opening material pane, but now this is instakill for blender somehow // ``` # Blender 3.0.0, Commit date: 2021-10-29 18:17, Hash fcf1ba18f0c4 bpy.context.space_data.context = 'MATERIAL' # Property # backtrace 0 blender 0x00000001198922f7 BLI_system_backtrace + 55 1 blender 0x000000010f9112b8 sig_handle_crash + 392 2 libsystem_platform.dylib 0x00007fff20458d7d _sigtramp + 29 3 ??? 0x0000000000000000 0x0 + 0 4 blender 0x0000000111a46fca _ZN3ccl17OSLRenderServices13get_attributeEPNS_10ShaderDataEbN16OpenImageIO_v2_27ustringENS3_8TypeDescES4_Pv + 954 5 blender 0x0000000111a46c02 _ZN3ccl17OSLRenderServices13get_attributeEPN9OSL_v1_1113ShaderGlobalsEbN16OpenImageIO_v2_27ustringENS4_8TypeDescES5_Pv + 98 6 blender 0x000000010f7d97b2 _ZN9OSL_v1_1114ShadingContext17osl_get_attributeEPNS_13ShaderGlobalsEPviN16OpenImageIO_v2_27ustringES5_iiNS4_8TypeDescES3_ + 178 7 blender 0x000000010f7bf240 osl_get_attribute + 112 8 ??? 0x0000000146d777cf 0x0 + 5483493327 # Python backtrace ```
Author

Added subscriber: @IPv6

Added subscriber: @IPv6
Author

Checked latest Alpha and Beta - problem still exist. So something else seems to be going on here //

# Blender 3.0.0, Commit date: 2021-10-31 11:08, Hash a06abbac92f2
bpy.context.space_data.context = 'MATERIAL'  # Property

# backtrace
0   blender                             0x000000010fcae2f7 BLI_system_backtrace + 55
1   blender                             0x0000000105d2d2b8 sig_handle_crash + 392
2   libsystem_platform.dylib            0x00007fff20458d7d _sigtramp + 29
3   ???                                 0x0000000000000000 0x0 + 0
4   blender                             0x0000000107e62fda _ZN3ccl17OSLRenderServices13get_attributeEPNS_10ShaderDataEbN16OpenImageIO_v2_27ustringENS3_8TypeDescES4_Pv + 954
5   blender                             0x0000000107e62c12 _ZN3ccl17OSLRenderServices13get_attributeEPN9OSL_v1_1113ShaderGlobalsEbN16OpenImageIO_v2_27ustringENS4_8TypeDescES5_Pv + 98
6   blender                             0x0000000105bf57b2 _ZN9OSL_v1_1114ShadingContext17osl_get_attributeEPNS_13ShaderGlobalsEPviN16OpenImageIO_v2_27ustringES5_iiNS4_8TypeDescES3_ + 178
7   blender                             0x0000000105bdb240 osl_get_attribute + 112
8   ???                                 0x000000013d10d7cf 0x0 + 5319481295

# Python backtrace
# Blender 3.1.0, Commit date: 2021-10-31 17:52, Hash c312c7196944
bpy.context.space_data.context = 'MATERIAL'  # Property

# backtrace
0   blender                             0x00000001124e1e97 BLI_system_backtrace + 55
1   blender                             0x00000001085616b8 sig_handle_crash + 392
2   libsystem_platform.dylib            0x00007fff20458d7d _sigtramp + 29
3   ???                                 0x0000000000000000 0x0 + 0
4   blender                             0x000000010a69744a _ZN3ccl17OSLRenderServices13get_attributeEPNS_10ShaderDataEbN16OpenImageIO_v2_27ustringENS3_8TypeDescES4_Pv + 954
5   blender                             0x000000010a697082 _ZN3ccl17OSLRenderServices13get_attributeEPN9OSL_v1_1113ShaderGlobalsEbN16OpenImageIO_v2_27ustringENS4_8TypeDescES5_Pv + 98
6   blender                             0x0000000108429bb2 _ZN9OSL_v1_1114ShadingContext17osl_get_attributeEPNS_13ShaderGlobalsEPviN16OpenImageIO_v2_27ustringES5_iiNS4_8TypeDescES3_ + 178
7   blender                             0x000000010840f640 osl_get_attribute + 112
8   ???                                 0x000000015f5e87cf 0x0 + 5894997967

# Python backtrace

Checked latest Alpha and Beta - problem still exist. So something else seems to be going on here // ``` # Blender 3.0.0, Commit date: 2021-10-31 11:08, Hash a06abbac92f2 bpy.context.space_data.context = 'MATERIAL' # Property # backtrace 0 blender 0x000000010fcae2f7 BLI_system_backtrace + 55 1 blender 0x0000000105d2d2b8 sig_handle_crash + 392 2 libsystem_platform.dylib 0x00007fff20458d7d _sigtramp + 29 3 ??? 0x0000000000000000 0x0 + 0 4 blender 0x0000000107e62fda _ZN3ccl17OSLRenderServices13get_attributeEPNS_10ShaderDataEbN16OpenImageIO_v2_27ustringENS3_8TypeDescES4_Pv + 954 5 blender 0x0000000107e62c12 _ZN3ccl17OSLRenderServices13get_attributeEPN9OSL_v1_1113ShaderGlobalsEbN16OpenImageIO_v2_27ustringENS4_8TypeDescES5_Pv + 98 6 blender 0x0000000105bf57b2 _ZN9OSL_v1_1114ShadingContext17osl_get_attributeEPNS_13ShaderGlobalsEPviN16OpenImageIO_v2_27ustringES5_iiNS4_8TypeDescES3_ + 178 7 blender 0x0000000105bdb240 osl_get_attribute + 112 8 ??? 0x000000013d10d7cf 0x0 + 5319481295 # Python backtrace ``` ``` # Blender 3.1.0, Commit date: 2021-10-31 17:52, Hash c312c7196944 bpy.context.space_data.context = 'MATERIAL' # Property # backtrace 0 blender 0x00000001124e1e97 BLI_system_backtrace + 55 1 blender 0x00000001085616b8 sig_handle_crash + 392 2 libsystem_platform.dylib 0x00007fff20458d7d _sigtramp + 29 3 ??? 0x0000000000000000 0x0 + 0 4 blender 0x000000010a69744a _ZN3ccl17OSLRenderServices13get_attributeEPNS_10ShaderDataEbN16OpenImageIO_v2_27ustringENS3_8TypeDescES4_Pv + 954 5 blender 0x000000010a697082 _ZN3ccl17OSLRenderServices13get_attributeEPN9OSL_v1_1113ShaderGlobalsEbN16OpenImageIO_v2_27ustringENS4_8TypeDescES5_Pv + 98 6 blender 0x0000000108429bb2 _ZN9OSL_v1_1114ShadingContext17osl_get_attributeEPNS_13ShaderGlobalsEPviN16OpenImageIO_v2_27ustringES5_iiNS4_8TypeDescES3_ + 178 7 blender 0x000000010840f640 osl_get_attribute + 112 8 ??? 0x000000015f5e87cf 0x0 + 5894997967 # Python backtrace ```
Author

Last working (for me) - "version: 3.0.0 Alpha, branch: master, commit date: 2021-10-18 21:38, hash: d7b231baa8, type: release"
according to https://builder.blender.org/download/daily/archive/

Last working (for me) - "version: 3.0.0 Alpha, branch: master, commit date: 2021-10-18 21:38, hash: d7b231baa87e, type: release" according to https://builder.blender.org/download/daily/archive/
Member

Added subscribers: @brecht, @lichtwerk

Added subscribers: @brecht, @lichtwerk
Member

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'
Member

Can confirm.

CC @brecht

Can confirm. CC @brecht

Added subscriber: @dfelinto

Added subscriber: @dfelinto

Can confirm crash with file from #92503.

Can confirm crash with file from #92503.

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Brecht Van Lommel self-assigned this 2021-11-05 20:20:59 +01:00

Resolved by f24ad274cb.

Resolved by f24ad274cb.
Author

@brecht Sorry, but it still crashing for me // In latest beta and 3.1.0 alpha, according to dates commit already incorporated

Just switch to object (mesh, not armature), open material pane and scroll materials list + viewport.
Should i create new bug report?

# Blender 3.1.0, Commit date: 2021-11-07 23:45, Hash 4f387e66ac85
bpy.context.space_data.context = 'MATERIAL'  # Property

# backtrace
0   blender                             0x00000001147c85b7 BLI_system_backtrace + 55
1   blender                             0x000000010a834928 sig_handle_crash + 392
2   libsystem_platform.dylib            0x00007fff20458d7d _sigtramp + 29
3   ???                                 0x0000000000000000 0x0 + 0
4   blender                             0x000000010c97dd9a _ZN3ccl17OSLRenderServices13get_attributeEPNS_10ShaderDataEbN16OpenImageIO_v2_27ustringENS3_8TypeDescES4_Pv + 954
5   blender                             0x000000010c97d9d2 _ZN3ccl17OSLRenderServices13get_attributeEPN9OSL_v1_1113ShaderGlobalsEbN16OpenImageIO_v2_27ustringENS4_8TypeDescES5_Pv + 98
6   blender                             0x000000010a6fce32 _ZN9OSL_v1_1114ShadingContext17osl_get_attributeEPNS_13ShaderGlobalsEPviN16OpenImageIO_v2_27ustringES5_iiNS4_8TypeDescES3_ + 178
7   blender                             0x000000010a6e28c0 osl_get_attribute + 112
8   ???                                 0x0000000141a697cf 0x0 + 5396404175

# Python backtrace
@brecht Sorry, but it still crashing for me // In latest beta and 3.1.0 alpha, according to dates commit already incorporated Just switch to object (mesh, not armature), open material pane and scroll materials list + viewport. Should i create new bug report? ``` # Blender 3.1.0, Commit date: 2021-11-07 23:45, Hash 4f387e66ac85 bpy.context.space_data.context = 'MATERIAL' # Property # backtrace 0 blender 0x00000001147c85b7 BLI_system_backtrace + 55 1 blender 0x000000010a834928 sig_handle_crash + 392 2 libsystem_platform.dylib 0x00007fff20458d7d _sigtramp + 29 3 ??? 0x0000000000000000 0x0 + 0 4 blender 0x000000010c97dd9a _ZN3ccl17OSLRenderServices13get_attributeEPNS_10ShaderDataEbN16OpenImageIO_v2_27ustringENS3_8TypeDescES4_Pv + 954 5 blender 0x000000010c97d9d2 _ZN3ccl17OSLRenderServices13get_attributeEPN9OSL_v1_1113ShaderGlobalsEbN16OpenImageIO_v2_27ustringENS4_8TypeDescES5_Pv + 98 6 blender 0x000000010a6fce32 _ZN9OSL_v1_1114ShadingContext17osl_get_attributeEPNS_13ShaderGlobalsEPviN16OpenImageIO_v2_27ustringES5_iiNS4_8TypeDescES3_ + 178 7 blender 0x000000010a6e28c0 osl_get_attribute + 112 8 ??? 0x0000000141a697cf 0x0 + 5396404175 # Python backtrace ```
Author

@brecht i can try to compile Blender and find the points that cause crashes, post result here, will it help?

I understand that may be i overuse OSL (but with good reasons - that probably hard to explain), so majority of other users may never hit that problem... but at least it would be cool to know what features should be avoided for productive use of OSL

@brecht i can try to compile Blender and find the points that cause crashes, post result here, will it help? I understand that may be i overuse OSL (but with good reasons - that probably hard to explain), so majority of other users may never hit that problem... but at least it would be cool to know what features should be avoided for productive use of OSL
Author

@brecht Sorry to bother futher... but i compiled Blender for MacOs and seems to find the problem that cause a crash - "leftovers" in shared struct.

  • I may create patch if my finding are ok - i understand its a complex thing and side-effects for "simple solutions" possible.
    But i rendered some of my scenes with this fix and didn`t see any differences

  • Or i may create another bug report with proposed solution/fix

Details:

  1. For me crash happens in services.cpp:
  else if (name == u_path_transparent_depth) {
    /* Transparent Ray Depth */
    const IntegratorStateCPU *state = sd->osl_path_state; // <- here is the BROKEN pointer
    const IntegratorShadowStateCPU *shadow_state = sd->osl_shadow_path_state;
    int f = (state)        ? state->path.transparent_bounce : // <- BROKEN pointer used since it is not null
            (shadow_state) ? shadow_state->shadow_path.transparent_bounce :
                             0;
    return set_attribute_int(f, type, derivatives, val);
  }
  1. i checked around and the place where osl_path_state is filled looks like this (shader.cpp, shaderdata_to_shaderglobals):
  /* Used by render-services. */
  sd->osl_globals = kg;
  if (path_flag & PATH_RAY_SHADOW) {
    sd->osl_shadow_path_state = (const IntegratorShadowStateCPU *)state;
  }
  else {
    sd->osl_path_state = (const IntegratorStateCPU *)state;
  }
  1. Proposed solution that fixes the crashes and seems not to have any side-effects (for me) is to nullify non-used osl-slot in struct
  /* Used by render-services. */
  sd->osl_globals = kg;
  if (path_flag & PATH_RAY_SHADOW) {
    sd->osl_shadow_path_state = (const IntegratorShadowStateCPU *)state;
      sd->osl_path_state = nullptr;// proposed fix
  }
  else {
    sd->osl_path_state = (const IntegratorStateCPU *)state;
      sd->osl_shadow_path_state = nullptr;// proposed fix
  }

Does it makes sense?

@brecht Sorry to bother futher... but i compiled Blender for MacOs and seems to find the problem that cause a crash - "leftovers" in shared struct. - I may create patch if my finding are ok - i understand its a complex thing and side-effects for "simple solutions" possible. But i rendered some of my scenes with this fix and didn`t see any differences - Or i may create another bug report with proposed solution/fix Details: 1) For me crash happens in services.cpp: ``` else if (name == u_path_transparent_depth) { /* Transparent Ray Depth */ const IntegratorStateCPU *state = sd->osl_path_state; // <- here is the BROKEN pointer const IntegratorShadowStateCPU *shadow_state = sd->osl_shadow_path_state; int f = (state) ? state->path.transparent_bounce : // <- BROKEN pointer used since it is not null (shadow_state) ? shadow_state->shadow_path.transparent_bounce : 0; return set_attribute_int(f, type, derivatives, val); } ``` 2) i checked around and the place where osl_path_state is filled looks like this (shader.cpp, shaderdata_to_shaderglobals): ``` /* Used by render-services. */ sd->osl_globals = kg; if (path_flag & PATH_RAY_SHADOW) { sd->osl_shadow_path_state = (const IntegratorShadowStateCPU *)state; } else { sd->osl_path_state = (const IntegratorStateCPU *)state; } ``` 3) Proposed solution that fixes the crashes and seems not to have any side-effects (for me) is to nullify non-used osl-slot in struct ``` /* Used by render-services. */ sd->osl_globals = kg; if (path_flag & PATH_RAY_SHADOW) { sd->osl_shadow_path_state = (const IntegratorShadowStateCPU *)state; sd->osl_path_state = nullptr;// proposed fix } else { sd->osl_path_state = (const IntegratorStateCPU *)state; sd->osl_shadow_path_state = nullptr;// proposed fix } ``` Does it makes sense?
Author

Checked latest Windows Alpha - no crash. so OSL problem with the fix above - is the MacOs-only thing.

On MacOs latest alpha (without fix) - still crashes, with osl_path_state/osl_shadow_path_state fix from the post above - everything ok

Checked latest Windows Alpha - no crash. so OSL problem with the fix above - is the MacOs-only thing. On MacOs latest alpha (without fix) - still crashes, with osl_path_state/osl_shadow_path_state fix from the post above - everything ok

Changed status from 'Resolved' to: 'Confirmed'

Changed status from 'Resolved' to: 'Confirmed'

Thanks for investigating.

Thanks for investigating.

This issue was referenced by blender/cycles@fdb63f7223

This issue was referenced by blender/cycles@fdb63f7223fe2b4095a5bab44118dd86f26fcd8d

This issue was referenced by 5f44298280

This issue was referenced by 5f442982803e50d4add20950106971cde565f3cb

That fix makes sense, I'll commit it.

That fix makes sense, I'll commit it.

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
5 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#92645
No description provided.