Add Transparent Shader to Mix Shader with Material Panel open equals crash - OSL segtfault? #41123

Closed
opened 2014-07-19 03:37:08 +02:00 by Joel Godin · 27 comments

System Information
OSX 10.6.8
Graphic card ATI Radeon HD2600 Pro
iMa8,1
Intel Core 2 Duo

Blender Version
Broken: 2.71 of date 07-18-14 Hash # a04a803

Go to node window, add material, add mix shader in between diffuse and output,
add transparent to mix,
Open materials panel, crash.

See unlisted vid: http://youtu.be/1QGv5fccUrs
Blend precrash attached as well as crash report.
PreCrash.blend

crashreport.rtf

**System Information** OSX 10.6.8 Graphic card ATI Radeon HD2600 Pro iMa8,1 Intel Core 2 Duo **Blender Version** Broken: 2.71 of date 07-18-14 Hash # a04a803 Go to node window, add material, add mix shader in between diffuse and output, add transparent to mix, Open materials panel, crash. See unlisted vid: http://youtu.be/1QGv5fccUrs Blend precrash attached as well as crash report. [PreCrash.blend](https://archive.blender.org/developer/F98477/PreCrash.blend) [crashreport.rtf](https://archive.blender.org/developer/F98478/crashreport.rtf)
Author

Changed status to: 'Open'

Changed status to: 'Open'
Author

Added subscriber: @joel.godin

Added subscriber: @joel.godin
Author

Last version I had worked okay, it was 7-10-14 hash a1aa969.

Last version I had worked okay, it was 7-10-14 hash a1aa969.
Member

Added subscriber: @lichtwerk

Added subscriber: @lichtwerk
Member

cannot confirm on linux fedora20 with Intel Graphics (no crash here)

cannot confirm on linux fedora20 with Intel Graphics (no crash here)

Added subscriber: @mont29

Added subscriber: @mont29

Can’t confirm it either here (latest master, linux64, NVidia 850m). Maybe OSX-related?

Can’t confirm it either here (latest master, linux64, NVidia 850m). Maybe OSX-related?
Author

My Windows 8.1 version works okay using the latest build e0d8e62 of Jul 19.
So must be a Mac thing. Crashes on my OSX 10.6.8 older mac, and the newer 2011 OSX 10.9.3 one as well.

My Windows 8.1 version works okay using the latest build e0d8e62 of Jul 19. So must be a Mac thing. Crashes on my OSX 10.6.8 older mac, and the newer 2011 OSX 10.9.3 one as well.

Added subscriber: @sambler

Added subscriber: @sambler

Confirmed here.

The key point is you have OSL enabled. Showing the material panel initiates a preview render (even for the small icon in front of the material name) the crash can also be achieved with 3dview or final render.

Disable OSL and setup your example with 3dview rendering - all is ok
Enable OSL and crash.

I found the same issue running osl scripts that mix closures, while plain colour and numeric output is ok.

2.71-release is good, it is just recent master that fails.

A gdb backtrace from the example diffuse and transparent into mix shows it fails inside flatten_surface_closure_tree.

Program received signal SIGBUS, Bus error.
[Switching to Thread 8269bf800 (LWP 101314)]
0x0000000001f532e4 in ccl::flatten_surface_closure_tree(ccl::ShaderData*, int, OSL::ClosureColor const*, ccl::float3)
    ()
(gdb) bt
- 0  0x0000000001f532e4 in ccl::flatten_surface_closure_tree(ccl::ShaderData*, int, OSL::ClosureColor const*, ccl::float3) ()
- 1  0x0000000001f53240 in ccl::flatten_surface_closure_tree(ccl::ShaderData*, int, OSL::ClosureColor const*, ccl::float3) ()
- 2  0x0000000001f53240 in ccl::flatten_surface_closure_tree(ccl::ShaderData*, int, OSL::ClosureColor const*, ccl::float3) ()
- 3  0x0000000001d7ab3c in ccl::kernel_path_integrate ()
- 4  0x0000000001c1420a in ccl::kernel_cpu_avx_path_trace(ccl::KernelGlobals*, float*, unsigned int*, int, int, int, int, int) ()
- 5  0x0000000001711450 in ccl::CPUDevice::thread_path_trace(ccl::DeviceTask&) ()
- 6  0x000000000168ed5c in boost::function0<void>::operator()() const ()
- 7  0x0000000001f60b0d in ccl::TaskScheduler::thread_run(int) ()
- 8  0x000000000168ed5c in boost::function0<void>::operator()() const ()
- 9  0x00000000016f9649 in ccl::thread::run(void*) ()
#10 0x00000008055ae192 in ?? () from /lib/libthr.so.3

Confirmed here. The key point is you have OSL enabled. Showing the material panel initiates a preview render (even for the small icon in front of the material name) the crash can also be achieved with 3dview or final render. Disable OSL and setup your example with 3dview rendering - all is ok Enable OSL and crash. I found the same issue running osl scripts that mix closures, while plain colour and numeric output is ok. 2.71-release is good, it is just recent master that fails. A gdb backtrace from the example diffuse and transparent into mix shows it fails inside flatten_surface_closure_tree. ``` Program received signal SIGBUS, Bus error. [Switching to Thread 8269bf800 (LWP 101314)] 0x0000000001f532e4 in ccl::flatten_surface_closure_tree(ccl::ShaderData*, int, OSL::ClosureColor const*, ccl::float3) () (gdb) bt - 0 0x0000000001f532e4 in ccl::flatten_surface_closure_tree(ccl::ShaderData*, int, OSL::ClosureColor const*, ccl::float3) () - 1 0x0000000001f53240 in ccl::flatten_surface_closure_tree(ccl::ShaderData*, int, OSL::ClosureColor const*, ccl::float3) () - 2 0x0000000001f53240 in ccl::flatten_surface_closure_tree(ccl::ShaderData*, int, OSL::ClosureColor const*, ccl::float3) () - 3 0x0000000001d7ab3c in ccl::kernel_path_integrate () - 4 0x0000000001c1420a in ccl::kernel_cpu_avx_path_trace(ccl::KernelGlobals*, float*, unsigned int*, int, int, int, int, int) () - 5 0x0000000001711450 in ccl::CPUDevice::thread_path_trace(ccl::DeviceTask&) () - 6 0x000000000168ed5c in boost::function0<void>::operator()() const () - 7 0x0000000001f60b0d in ccl::TaskScheduler::thread_run(int) () - 8 0x000000000168ed5c in boost::function0<void>::operator()() const () - 9 0x00000000016f9649 in ccl::thread::run(void*) () #10 0x00000008055ae192 in ?? () from /lib/libthr.so.3 ```
Bastien Montagne changed title from Add Transparent Shader to Mix Shader with Material Panel open equals crash to Add Transparent Shader to Mix Shader with Material Panel open equals crash - OSL segtfault? 2014-07-22 08:21:19 +02:00

@sambler thanks, are you using OSX too?

@sambler thanks, are you using OSX too?

No I'm on FreeBSD

No I'm on FreeBSD

Added subscriber: @Sergey

Added subscriber: @Sergey

@sambler, what's your CPU?

Also, does the crahs happen when switching viewport to a rendered mode instead of going to the material panel?

@sambler, what's your CPU? Also, does the crahs happen when switching viewport to a rendered mode instead of going to the material panel?
Sergey Sharybin self-assigned this 2014-07-24 13:11:09 +02:00

Sorry for spam, seems i've managed to redo the issue on windows now. Looking.

Sorry for spam, seems i've managed to redo the issue on windows now. Looking.

Added subscribers: @MartijnBerger, @ThomasDinges

Added subscribers: @MartijnBerger, @ThomasDinges

It seems crash for is caused by some bad memory access in OSL's evaluation function, not really up to investigating this further for until new OSL/LLVM are committed to SVN libraries repository. It might be some issue with optimization or so.

@ThomasDinges, @MartijnBerger, any idea when we'll have new OSL? :)

It seems crash for is caused by some bad memory access in OSL's evaluation function, not really up to investigating this further for until new OSL/LLVM are committed to SVN libraries repository. It might be some issue with optimization or so. @ThomasDinges, @MartijnBerger, any idea when we'll have new OSL? :)

Also we have one report about OSL crash, will merge them together since root of the issue is likely goes to the same exact thing.

Also we have one report about OSL crash, will merge them together since root of the issue is likely goes to the same exact thing.

Changed status from 'Open' to: 'Duplicate'

Changed status from 'Open' to: 'Duplicate'

✘ Merged into #40971.

✘ Merged into #40971.

Changed status from 'Duplicate' to: 'Open'

Changed status from 'Duplicate' to: 'Open'

I found a cause for this. I am re-opening this issue as I can't reproduce a crash with the example in the other issue #40971 - environment maps with osl, so I can't be sure they are related.

85c7fce3de specifically in the ShaderClosure struct definition it moved data2 before N and T. Moving data2 after T fixes this for me.

So that's a subtle thing that points to a deeper issue that needs further investigation.

For now the workaround is -

diff --git a/intern/cycles/kernel/kernel_types.h b/intern/cycles/kernel/kernel_types.h
index 164df41..a506d4a 100644
--- a/intern/cycles/kernel/kernel_types.h
+++ b/intern/cycles/kernel/kernel_types.h
@@ -528,11 +528,10 @@ typedef struct ShaderClosure {
 
 	float data0;
 	float data1;
-	float data2;
 
 	float3 N;
 	float3 T;
+float data2;
 #ifdef __OSL__
 	void *prim;
 #endif

I found a cause for this. I am re-opening this issue as I can't reproduce a crash with the example in the other issue #40971 - environment maps with osl, so I can't be sure they are related. 85c7fce3de specifically in the ShaderClosure struct definition it moved data2 before N and T. Moving data2 after T fixes this for me. So that's a subtle thing that points to a deeper issue that needs further investigation. For now the workaround is - ``` diff --git a/intern/cycles/kernel/kernel_types.h b/intern/cycles/kernel/kernel_types.h index 164df41..a506d4a 100644 --- a/intern/cycles/kernel/kernel_types.h +++ b/intern/cycles/kernel/kernel_types.h @@ -528,11 +528,10 @@ typedef struct ShaderClosure { float data0; float data1; - float data2; float3 N; float3 T; +float data2; #ifdef __OSL__ void *prim; #endif ```

Added subscriber: @jensverwiebe

Added subscriber: @jensverwiebe

Confirmed, the workaround above fixes the OSL crash with bmw file on Mac OS as well. @jensverwiebe

Confirmed, the workaround above fixes the OSL crash with bmw file on Mac OS as well. @jensverwiebe

This issue was referenced by c0c037f41d

This issue was referenced by c0c037f41d934344cebedad84340fa880133612e
Member

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Member

Closed by commit c0c037f41d.

Closed by commit c0c037f41d.
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
8 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#41123
No description provided.