Page MenuHome

OSL trace not working in 2.79 RC!
Closed, ResolvedPublic

Description

System Information
Windows 10

Blender Version
Broken: 2.79RC 4a1762f

Short description of error
OSL method "trace" not working in 2.79RC (working ok in 2.78), not working at all! +Crashes

Exact steps for others to reproduce the error
Load attached blend and render it. Material on plane below contain osl script, that maps trace calls to pixel color.

shader traceObject(
    output float ishit=0
)
{
    ishit = trace(P, point(0,0,1));
}

In 2.79RC you will get black plane with no signs of successfull trace. In 2.78 you will get torus, projected on plane - trace works as expected.

Also, in 2.79RC i get crashes when rendering this file several times or enabling Rendered preview mode and flying around the plane. They are not 100%, but quite frequent

Event Timeline

Ilja Razinkov (IPv6) updated the task description. (Show Details)
Bastien Montagne (mont29) triaged this task as Confirmed, Medium priority.

Here's ASAN debug build backtrace:

=================================================================
==3773==ERROR: AddressSanitizer: new-delete-type-mismatch on 0x604000261c10 in thread T32:
  object passed to delete has wrong type:
  size of the allocated type:   33 bytes;
  size of the deallocated type: 24 bytes.
==3773==AddressSanitizer: while reporting a bug found another one. Ignoring.
==3773==AddressSanitizer: while reporting a bug found another one. Ignoring.
    #0 0x7fec672bd7c0 in operator delete(void*, unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc37c0)
    #1 0x7fec600e5b51 in llvm::BitcodeReader::FreeState() (/opt/lib/osl/lib/liboslexec.so+0x539b51)
    #2 0x7fec600f5bc3 in llvm::BitcodeReader::~BitcodeReader() (/opt/lib/osl/lib/liboslexec.so+0x549bc3)
    #3 0x7fec600f5fd8 in llvm::BitcodeReader::~BitcodeReader() (/opt/lib/osl/lib/liboslexec.so+0x549fd8)
    #4 0x7fec60685369 in llvm::Module::~Module() (/opt/lib/osl/lib/liboslexec.so+0xad9369)
    #5 0x7fec60540491 in llvm::ExecutionEngine::~ExecutionEngine() (/opt/lib/osl/lib/liboslexec.so+0x994491)
    #6 0x7fec6011daa2 in llvm::JIT::~JIT() (/opt/lib/osl/lib/liboslexec.so+0x571aa2)
    #7 0x7fec6011dbf8 in llvm::JIT::~JIT() (/opt/lib/osl/lib/liboslexec.so+0x571bf8)
    #8 0x7fec5fda188a in OSL::pvt::LLVM_Util::execengine(llvm::ExecutionEngine*) (/opt/lib/osl/lib/liboslexec.so+0x1f588a)
    #9 0x7fec5fd9d916 in OSL::pvt::BackendLLVM::run() (/opt/lib/osl/lib/liboslexec.so+0x1f1916)
    #10 0x7fec5fca6eb5 in OSL::pvt::ShadingSystemImpl::optimize_group(OSL::ShaderGroup&) (/opt/lib/osl/lib/liboslexec.so+0xfaeb5)
    #11 0x7fec5fca86a9 in OSL::pvt::ShadingSystemImpl::optimize_all_groups(int, int, int) (/opt/lib/osl/lib/liboslexec.so+0xfc6a9)
    #12 0x7fec63aeef95  (/usr/lib/x86_64-linux-gnu/libboost_thread.so.1.62.0+0x11f95)
    #13 0x7fec651ef493 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x7493)
    #14 0x7fec5b30fa8e in __clone (/lib/x86_64-linux-gnu/libc.so.6+0xe8a8e)

0x604000261c10 is located 0 bytes inside of 33-byte region [0x604000261c10,0x604000261c31)
allocated by thread T32 here:
    #0 0x7fec672bcbc0 in operator new(unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc2bc0)
    #1 0x7fec606d2d25 in llvm::MemoryBuffer::getMemBuffer(llvm::StringRef, llvm::StringRef, bool) (/opt/lib/osl/lib/liboslexec.so+0xb26d25)

Thread T32 created by T30 here:
    #0 0x7fec6722af19 in __interceptor_pthread_create (/usr/lib/x86_64-linux-gnu/libasan.so.3+0x30f19)
    #1 0x7fec63aee2f8 in boost::thread::start_thread_noexcept() (/usr/lib/x86_64-linux-gnu/libboost_thread.so.1.62.0+0x112f8)

Thread T30 created by T21 here:
    #0 0x7fec6722af19 in __interceptor_pthread_create (/usr/lib/x86_64-linux-gnu/libasan.so.3+0x30f19)
    #1 0x563397f6f858 in ccl::thread::thread(std::function<void ()>, int) /home/i74700deb64/blender/__work__/src/intern/cycles/util/util_thread.cpp:29
    #2 0x5633930054c0 in ccl::Session::start() /home/i74700deb64/blender/__work__/src/intern/cycles/render/session.cpp:131
    #3 0x563392d7ef91 in ccl::BlenderSession::render() /home/i74700deb64/blender/__work__/src/intern/cycles/blender/blender_session.cpp:472
    #4 0x563392d6de92 in render_func /home/i74700deb64/blender/__work__/src/intern/cycles/blender/blender_python.cpp:286
    #5 0x7fec665ec9bc in PyEval_EvalFrameEx (/usr/lib/x86_64-linux-gnu/libpython3.5m.so.1.0+0x1849bc)

Thread T21 created by T0 here:
    #0 0x7fec6722af19 in __interceptor_pthread_create (/usr/lib/x86_64-linux-gnu/libasan.so.3+0x30f19)
    #1 0x563392133c00 in BLI_insert_thread /home/i74700deb64/blender/__work__/src/source/blender/blenlib/intern/threads.c:269
    #2 0x56338f4a4a15 in WM_jobs_start /home/i74700deb64/blender/__work__/src/source/blender/windowmanager/intern/wm_jobs.c:422
    #3 0x5633901ffa03 in screen_render_invoke /home/i74700deb64/blender/__work__/src/source/blender/editors/render/render_internal.c:984
    #4 0x56338f486015 in wm_operator_invoke /home/i74700deb64/blender/__work__/src/source/blender/windowmanager/intern/wm_event_system.c:1130
    #5 0x56338f48983c in wm_handler_operator_call /home/i74700deb64/blender/__work__/src/source/blender/windowmanager/intern/wm_event_system.c:1782
    #6 0x56338f48b07f in wm_handlers_do_intern /home/i74700deb64/blender/__work__/src/source/blender/windowmanager/intern/wm_event_system.c:2062
    #7 0x56338f48b882 in wm_handlers_do /home/i74700deb64/blender/__work__/src/source/blender/windowmanager/intern/wm_event_system.c:2173
    #8 0x56338f48d7fd in wm_event_do_handlers /home/i74700deb64/blender/__work__/src/source/blender/windowmanager/intern/wm_event_system.c:2539
    #9 0x56338f46fc33 in WM_main /home/i74700deb64/blender/__work__/src/source/blender/windowmanager/intern/wm.c:504
    #10 0x56338f465f3a in main /home/i74700deb64/blender/__work__/src/source/creator/creator.c:527
    #11 0x7fec5b2472b0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202b0)

SUMMARY: AddressSanitizer: new-delete-type-mismatch (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc37c0) in operator delete(void*, unsigned long)
==3773==HINT: if you don't care about these errors you may set ASAN_OPTIONS=new_delete_type_mismatch=0
==3773==ABORTING

Note the Blender version in the report is not the 2.79 RC build, it's a master build where confusingly the splash screen still shows "Release Candidate". So the crash might also be due to recent changes.

It indeed was not a bug in the actual 2.79 RC, so no need to backport this one. Also added test for this report.

Thanks for such urgent fixing! It`s really a joy to use Blender :)