NCAR / VAPOR

VAPOR is the Visualization and Analysis Platform for Ocean, Atmosphere, and Solar Researchers
https://www.vapor.ucar.edu/
BSD 3-Clause "New" or "Revised" License
178 stars 49 forks source link

Windows crashes on enabling Particle Renderer #3646

Open sgpearse opened 1 month ago

sgpearse commented 1 month ago

With our current Windows installer, create and enable a Particle Renderer. Vapor will crash.

sgpearse commented 1 month ago

@stasj - I haven't been able to debug this on Windows, but by chance I've been able to reproduce a crash happening nondeterministically on macOS x86 and appleSilicon. I suspect it's the same issue as what's happening on Windows.

Here's the trace from lldb. It looks like it's coming from the recent refactorization in #3541, at ParticleRenderer.cpp:421.

(lldb) run
Process 83986 launched: '/Users/vapor/VAPOR2/build/bin/vapor.app/Contents/MacOS/vapor' (arm64)
libc++abi: terminating with uncaught exception of type std::length_error: allocator<T>::allocate(size_t n) 'n' exceeds maximum supported size
Process 83986 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
    frame #0: 0x00000001a3592d98 libsystem_kernel.dylib`__pthread_kill + 8
libsystem_kernel.dylib`__pthread_kill:
->  0x1a3592d98 <+8>:  b.lo   0x1a3592db8               ; <+40>
    0x1a3592d9c <+12>: pacibsp
    0x1a3592da0 <+16>: stp    x29, x30, [sp, #-0x10]!
    0x1a3592da4 <+20>: mov    x29, sp
Target 0: (vapor) stopped.
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
  * frame #0: 0x00000001a3592d98 libsystem_kernel.dylib`__pthread_kill + 8
    frame #1: 0x00000001a35c7ee0 libsystem_pthread.dylib`pthread_kill + 288
    frame #2: 0x00000001a3502340 libsystem_c.dylib`abort + 168
    frame #3: 0x00000001a3582b18 libc++abi.dylib`abort_message + 132
    frame #4: 0x00000001a3572a3c libc++abi.dylib`demangling_terminate_handler() + 312
    frame #5: 0x00000001a3468330 libobjc.A.dylib`_objc_terminate() + 160
    frame #6: 0x00000001a3581eb4 libc++abi.dylib`std::__terminate(void (*)()) + 20
    frame #7: 0x00000001a3584c2c libc++abi.dylib`__cxxabiv1::failed_throw(__cxxabiv1::__cxa_exception*) + 36
    frame #8: 0x00000001a3584bd8 libc++abi.dylib`__cxa_throw + 140
    frame #9: 0x00000001019feb24 librender.dylib`std::__1::__throw_length_error(__msg="allocator<T>::allocate(size_t n) 'n' exceeds maximum supported size") at stdexcept:256:5
    frame #10: 0x0000000101a084c0 librender.dylib`std::__1::allocator<VAPoR::ParticleRenderer::_generateTextureData(VAPoR::Grid const*, std::__1::vector<VAPoR::Grid*, std::__1::allocator<VAPoR::Grid*> > const&)::PointDataT>::allocate(this=0x000000016fdfce18, __n=1152921504936694609) at allocator.h:103:13
    frame #11: 0x0000000101a08370 librender.dylib`std::__1::allocator_traits<std::__1::allocator<VAPoR::ParticleRenderer::_generateTextureData(VAPoR::Grid const*, std::__1::vector<VAPoR::Grid*, std::__1::allocator<VAPoR::Grid*> > const&)::PointDataT> >::allocate(__a=0x000000016fdfce18, __n=1152921504936694609)::PointDataT>&, unsigned long) at allocator_traits.h:262:20
    frame #12: 0x0000000101a082b4 librender.dylib`std::__1::__split_buffer<VAPoR::ParticleRenderer::_generateTextureData(VAPoR::Grid const*, std::__1::vector<VAPoR::Grid*, std::__1::allocator<VAPoR::Grid*> > const&)::PointDataT, std::__1::allocator<VAPoR::ParticleRenderer::_generateTextureData(VAPoR::Grid const*, std::__1::vector<VAPoR::Grid*, std::__1::allocator<VAPoR::Grid*> > const&)::PointDataT>&>::__split_buffer(this=0x000000016fdfcb90, __cap=1152921504936694609, __start=0, __a=0x000000016fdfce18)::PointDataT>&) at __split_buffer:315:29
    frame #13: 0x0000000101a08160 librender.dylib`std::__1::__split_buffer<VAPoR::ParticleRenderer::_generateTextureData(VAPoR::Grid const*, std::__1::vector<VAPoR::Grid*, std::__1::allocator<VAPoR::Grid*> > const&)::PointDataT, std::__1::allocator<VAPoR::ParticleRenderer::_generateTextureData(VAPoR::Grid const*, std::__1::vector<VAPoR::Grid*, std::__1::allocator<VAPoR::Grid*> > const&)::PointDataT>&>::__split_buffer(this=0x000000016fdfcb90, __cap=1152921504936694609, __start=0, __a=0x000000016fdfce18)::PointDataT>&) at __split_buffer:314:1
    frame #14: 0x00000001019fd89c librender.dylib`std::__1::vector<VAPoR::ParticleRenderer::_generateTextureData(VAPoR::Grid const*, std::__1::vector<VAPoR::Grid*, std::__1::allocator<VAPoR::Grid*> > const&)::PointDataT, std::__1::allocator<VAPoR::ParticleRenderer::_generateTextureData(VAPoR::Grid const*, std::__1::vector<VAPoR::Grid*, std::__1::allocator<VAPoR::Grid*> > const&)::PointDataT> >::reserve(this=0x000000016fdfce08 size=0, __n=1152921504936694609) at vector:1609:53
    frame #15: 0x00000001019fafdc librender.dylib`VAPoR::ParticleRenderer::_generateTextureData(this=0x000000013a7ffb60, grid=0x0000000293016a00, vecGrids=size=0) at ParticleRenderer.cpp:421:19
    frame #16: 0x00000001019f8f9c librender.dylib`VAPoR::ParticleRenderer::_paintGL(this=0x000000013a7ffb60, (null)=false) at ParticleRenderer.cpp:125:13
    frame #17: 0x00000001018d5d7c librender.dylib`VAPoR::Renderer::paintGL(this=0x000000013a7ffb60, fast=false) at Renderer.cpp:131:14
    frame #18: 0x000000010191ae20 librender.dylib`VAPoR::Visualizer::paintEvent(this=0x0000600003d08000, fast=false) at Visualizer.cpp:197:39
    frame #19: 0x00000001018a8b3c librender.dylib`VAPoR::ControlExec::Paint(this=0x000060000261ad00, winName="Visualizer_No._0", fast=false) at ControlExecutive.cpp:164:17
    frame #20: 0x0000000100105068 vapor`VizWin::_renderHelper(this=0x000060003348c1e0, fast=false) at VizWin.cpp:676:28
    frame #21: 0x000000010010212c vapor`VizWin::Render(this=0x000060003348c1e0, fast=false) at VizWin.cpp:644:5
    frame #22: 0x000000010010e050 vapor`VizWinMgr::Update(this=0x00006000029259d0, fast=false) at VizWinMgr.cpp:335:81
    frame #23: 0x00000001000dbc68 vapor`MainForm::eventFilter(this=0x0000000104421170, obj=0x0000000104421170, event=0x000060000077d3c0) at MainForm.cpp:2113:25
    frame #24: 0x00000001078f4d28 QtCore`QCoreApplicationPrivate::sendThroughApplicationEventFilters(QObject*, QEvent*) + 240
    frame #25: 0x000000010607f044 QtWidgets`QApplicationPrivate::notify_helper(QObject*, QEvent*) + 80
    frame #26: 0x000000010608048c QtWidgets`QApplication::notify(QObject*, QEvent*) + 548
    frame #27: 0x00000001078f4b5c QtCore`QCoreApplication::notifyInternal2(QObject*, QEvent*) + 292
    frame #28: 0x00000001078f6024 QtCore`QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) + 1404
    frame #29: 0x0000000105b19c4c libqcocoa.dylib`___lldb_unnamed_symbol704$$libqcocoa.dylib + 312
    frame #30: 0x0000000105b1a2f8 libqcocoa.dylib`___lldb_unnamed_symbol716$$libqcocoa.dylib + 48
    frame #31: 0x00000001a3694f94 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28
    frame #32: 0x00000001a3694ee0 CoreFoundation`__CFRunLoopDoSource0 + 208
    frame #33: 0x00000001a3694be0 CoreFoundation`__CFRunLoopDoSources0 + 268
    frame #34: 0x00000001a3693560 CoreFoundation`__CFRunLoopRun + 828
    frame #35: 0x00000001a3692a84 CoreFoundation`CFRunLoopRunSpecific + 600
    frame #36: 0x00000001ac2d6338 HIToolbox`RunCurrentEventLoopInMode + 292
    frame #37: 0x00000001ac2d60b4 HIToolbox`ReceiveNextEventCommon + 564
    frame #38: 0x00000001ac2d5e68 HIToolbox`_BlockUntilNextEventMatchingListInModeWithFilter + 72
    frame #39: 0x00000001a61fa51c AppKit`_DPSNextEvent + 860
    frame #40: 0x00000001a61f8e14 AppKit`-[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1328
    frame #41: 0x00000001a61eafe0 AppKit`-[NSApplication run] + 596
    frame #42: 0x0000000105b19128 libqcocoa.dylib`___lldb_unnamed_symbol697$$libqcocoa.dylib + 1768
    frame #43: 0x00000001078f0b10 QtCore`QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 520
    frame #44: 0x00000001078f5170 QtCore`QCoreApplication::exec() + 132
    frame #45: 0x00000001000c6788 vapor`main(argc=1, argv=0x000000016fdff818) at main.cpp:214:35
    frame #46: 0x0000000100f4d08c dyld`start + 520
sgpearse commented 1 month ago

To reproduce, enable the particle renderer in the attached session/data file. This causes the crash for me 1/10th of the time. Archive.zip

StasJ commented 1 month ago

Hey @sgpearse, thanks for adding the session and data files. I am unable to trigger the bug after trying >100 times across three computers (two M1 and an x86).

ifranda commented 1 week ago

I'm also getting a crash every time on Windows