GraphiteEditor / Graphite

2D vector & raster editor that melds traditional layers & tools with a modern node-based, non-destructive, procedural workflow.
https://graphite.rs
Apache License 2.0
7.8k stars 410 forks source link

[Crash Report] Poisson-disk sampling crashes when using a particular Pen tool shape #1591

Closed Keavon closed 2 weeks ago

Keavon commented 8 months ago

Describe the Crash Explain clearly what you were doing when the crash occurred.

Steps To Reproduce Describe precisely how the crash occurred, step by step, starting with a new editor window.

  1. Open the Graphite editor at https://dev.graphite.rs
  2. Open this file, or build it its graph yourself from a new document: Crash When Relink Layer.graphite.json (remove the .json from the extension)
  3. Replace the link with the upper layer's Shape node output as shown:

image

Additional Details Provide any further information or context that you think would be helpful in fixing the issue. Screenshots or video can be linked or attached to this issue.

Browser and OS Chrome 120, Windows 10 or 11

Stack Trace

In debug mode running from localhost:

image

Text form:


panicked at library/alloc/src/raw_vec.rs:534:5:
capacity overflow

Error
    at http://localhost:8080/src/io-managers/panic.ts:7:24
    at callCallback (http://localhost:8080/src/wasm-communication/subscription-router.ts:24:9)
    at Object.handleJsMessage (http://localhost:8080/src/wasm-communication/subscription-router.ts:32:5)
    at http://localhost:8080/src/wasm-communication/editor.ts:33:19
    at http://localhost:8080/wasm/pkg/graphite_wasm.js:2086:37
    at handleError (http://localhost:8080/wasm/pkg/graphite_wasm.js:354:18)
    at imports.wbg.__wbg_call_4c92f6aec1e1d6e6 (http://localhost:8080/wasm/pkg/graphite_wasm.js:2085:67)
    at js_sys::Function::call2::h2129f5722ad44249 (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[11025]:0x7f2060)
    at graphite_wasm::editor_api::JsEditorHandle::send_frontend_message_to_js::h931ccf2f57f183ed (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[1622]:0x4cf54c)
    at std::thread::local::LocalKey<T>::with::h8511a116dfa659e0 (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[3180]:0x5ef08c)
    at core::ops::function::Fn::call::h83dcfb1ff89712e6 (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[9577]:0x7c95c4)
    at std::panicking::rust_panic_with_hook::h3aa054d35a0817d7 (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[7735]:0x778c75)
    at std::panicking::begin_panic_handler::{{closure}}::h2f73e4cf6cd6319a (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[8746]:0x7a7915)
    at std::sys_common::backtrace::__rust_end_short_backtrace::h98ac61a6abbff7e9 (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[17054]:0x827f26)
    at rust_begin_unwind (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[10767]:0x7ec29f)
    at core::panicking::panic_fmt::h3e1dd3d08288569e (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[12043]:0x8053f8)
    at alloc::raw_vec::capacity_overflow::h956ebe6bf04b9c73 (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[12042]:0x8053b8)
    at <T as alloc::vec::spec_from_elem::SpecFromElem>::from_elem::h23cd91843868cf1d (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[4428]:0x681d17)
    at bezier_rs::poisson_disk::poisson_disk_sample::he2eae602c7d2f7a2 (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[471]:0x2bc65f)
    at bezier_rs::subpath::solvers::<impl bezier_rs::subpath::Subpath<ManipulatorGroupId>>::poisson_disk_points::ha35a382d0e7add25 (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[1817]:0x4fe852)
    at <graphene_std::any::FutureWrapperNode<N> as graphene_core::Node<T>>::eval::{{closure}}::ha5691019a7d6b8c7 (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[2462]:0x57d372)
    at <graphene_std::any::DynAnyNode<_I,_O,N> as graphene_core::Node<alloc::boxed::Box<dyn dyn_any::DynAny>>>::eval::{{closure}}::h886700140fd1ca86 (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[5311]:0x6d2059)
    at <graphene_std::any::ComposeTypeErased as graphene_core::Node<alloc::boxed::Box<dyn dyn_any::DynAny>>>::eval::{{closure}}::h2051518d874a7551 (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[4485]:0x6878b7)
    at <core::pin::Pin<P> as core::future::future::Future>::poll::hdfaf39f5319aaa0b (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[11767]:0x800c2a)
    at <graphene_std::any::DowncastBothNode<I,O> as graphene_core::Node<I>>::eval::{{closure}}::hbba3b2be4cd410e8 (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[5460]:0x6debf9)
    at <graphene_core::vector::vector_nodes::CopyToPoints<S0,S1> as graphene_core::Node<graphene_core::transform::Footprint>>::eval::{{closure}}::h3f759989c24fce4e (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[749]:0x379d70)
    at <graphene_std::any::DynAnyNode<_I,_O,N> as graphene_core::Node<alloc::boxed::Box<dyn dyn_any::DynAny>>>::eval::{{closure}}::h8de1c2390c998397 (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[5057]:0x6bc328)
    at <graphene_std::any::ComposeTypeErased as graphene_core::Node<alloc::boxed::Box<dyn dyn_any::DynAny>>>::eval::{{closure}}::h2051518d874a7551 (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[4485]:0x68780b)
    at <graphene_std::any::ComposeTypeErased as graphene_core::Node<alloc::boxed::Box<dyn dyn_any::DynAny>>>::eval::{{closure}}::h2051518d874a7551 (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[4485]:0x68780b)
    at <core::pin::Pin<P> as core::future::future::Future>::poll::hdfaf39f5319aaa0b (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[11767]:0x800c2a)
    at <graphene_std::any::DowncastBothNode<I,O> as graphene_core::Node<I>>::eval::{{closure}}::hb84593dafbea07e8 (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[5483]:0x6e0a78)
    at <graphene_core::memo::MonitorNode<I,T,N> as graphene_core::Node<I>>::eval::{{closure}}::hc5f76592f0b49e54 (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[1238]:0x4581b7)
    at <graphene_std::any::DynAnyNode<_I,_O,N> as graphene_core::Node<alloc::boxed::Box<dyn dyn_any::DynAny>>>::eval::{{closure}}::h72403573de1d07c8 (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[5308]:0x6d1bdb)
    at <core::pin::Pin<P> as core::future::future::Future>::poll::hdfaf39f5319aaa0b (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[11767]:0x800c2a)
    at <graphene_std::any::DowncastBothNode<I,O> as graphene_core::Node<I>>::eval::{{closure}}::hb84593dafbea07e8 (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[5458]:0x6de953)
    at <graphene_core::graphic_element::ConstructLayerNode<S0,S1> as graphene_core::Node<graphene_core::transform::Footprint>>::eval::{{closure}}::h1a7a043caef01775 (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[1888]:0x50e42f)
    at <graphene_std::any::DynAnyNode<_I,_O,N> as graphene_core::Node<alloc::boxed::Box<dyn dyn_any::DynAny>>>::eval::{{closure}}::hc4520659ada3b124 (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[5173]:0x6c6285)
    at <core::pin::Pin<P> as core::future::future::Future>::poll::hdfaf39f5319aaa0b (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[11767]:0x800c2a)
    at <graphene_std::any::DowncastBothNode<I,O> as graphene_core::Node<I>>::eval::{{closure}}::h25861fd4eeb03380 (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[5443]:0x6dd580)
    at <graphene_core::graphic_element::ConstructLayerNode<S0,S1> as graphene_core::Node<graphene_core::transform::Footprint>>::eval::{{closure}}::h1a7a043caef01775 (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[1888]:0x50e58f)
    at <graphene_std::any::DynAnyNode<_I,_O,N> as graphene_core::Node<alloc::boxed::Box<dyn dyn_any::DynAny>>>::eval::{{closure}}::hc4520659ada3b124 (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[5173]:0x6c6285)
    at <core::pin::Pin<P> as core::future::future::Future>::poll::hdfaf39f5319aaa0b (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[11767]:0x800c2a)
    at <graphene_std::any::DowncastBothNode<I,O> as graphene_core::Node<I>>::eval::{{closure}}::h25861fd4eeb03380 (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[5443]:0x6dd580)
    at <graphene_core::graphic_element::ConstructArtboardNode<S0,S1,S2,S3,S4> as graphene_core::Node<graphene_core::transform::Footprint>>::eval::{{closure}}::h2a13630f2033e647 (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[788]:0x38e0fc)
    at <graphene_std::any::DynAnyNode<_I,_O,N> as graphene_core::Node<alloc::boxed::Box<dyn dyn_any::DynAny>>>::eval::{{closure}}::h5e08b17ddea61ffe (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[5303]:0x6d1461)
    at <graphene_std::any::ComposeTypeErased as graphene_core::Node<alloc::boxed::Box<dyn dyn_any::DynAny>>>::eval::{{closure}}::h2051518d874a7551 (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[4485]:0x68780b)
    at <core::pin::Pin<P> as core::future::future::Future>::poll::hdfaf39f5319aaa0b (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[11767]:0x800c2a)
    at <graphene_std::any::DowncastBothNode<I,O> as graphene_core::Node<I>>::eval::{{closure}}::hb84593dafbea07e8 (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[5483]:0x6e0a78)
    at <graphene_core::memo::MonitorNode<I,T,N> as graphene_core::Node<I>>::eval::{{closure}}::hc5f76592f0b49e54 (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[1238]:0x4581b7)
    at <graphene_std::any::DynAnyNode<_I,_O,N> as graphene_core::Node<alloc::boxed::Box<dyn dyn_any::DynAny>>>::eval::{{closure}}::h72403573de1d07c8 (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[5308]:0x6d1bdb)
    at <core::pin::Pin<P> as core::future::future::Future>::poll::hdfaf39f5319aaa0b (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[11767]:0x800c2a)
    at <graphene_std::any::DowncastBothNode<I,O> as graphene_core::Node<I>>::eval::{{closure}}::hb84593dafbea07e8 (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[5458]:0x6de953)
    at <graphene_core::graphic_element::ConstructLayerNode<S0,S1> as graphene_core::Node<graphene_core::transform::Footprint>>::eval::{{closure}}::h1a7a043caef01775 (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[1888]:0x50e42f)
    at <graphene_std::any::DynAnyNode<_I,_O,N> as graphene_core::Node<alloc::boxed::Box<dyn dyn_any::DynAny>>>::eval::{{closure}}::hc4520659ada3b124 (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[5173]:0x6c6285)
    at <core::pin::Pin<P> as core::future::future::Future>::poll::hdfaf39f5319aaa0b (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[11767]:0x800c2a)
    at <graphene_std::any::DowncastBothNode<I,O> as graphene_core::Node<I>>::eval::{{closure}}::h25861fd4eeb03380 (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[5443]:0x6dd580)
    at <graphene_std::wasm_application_io::RenderNode<Data,Surface,graphene_core::transform::Footprint> as graphene_core::Node<graphene_core::application_io::EditorApi<graphene_std::wasm_application_io::WasmApplicationIo>>>::eval::{{closure}}::h785fe6b3b2cfe2ca (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[2537]:0x58a91a)
    at <graphene_std::any::DynAnyNode<_I,_O,N> as graphene_core::Node<alloc::boxed::Box<dyn dyn_any::DynAny>>>::eval::{{closure}}::h63e1a137e11a284a (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[2424]:0x5763a3)
    at <graphene_std::any::ComposeTypeErased as graphene_core::Node<alloc::boxed::Box<dyn dyn_any::DynAny>>>::eval::{{closure}}::h2051518d874a7551 (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[4485]:0x6878b7)
    at <core::pin::Pin<P> as core::future::future::Future>::poll::hdfaf39f5319aaa0b (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[11767]:0x800c2a)
    at <graphene_std::any::DowncastBothNode<I,O> as graphene_core::Node<I>>::eval::{{closure}}::h388d8abea827fa87 (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[4057]:0x65ad14)
    at <graphene_std::any::DynAnyNode<_I,_O,N> as graphene_core::Node<alloc::boxed::Box<dyn dyn_any::DynAny>>>::eval::{{closure}}::he1f533493bd62249 (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[2910]:0x5c782d)
    at <graphene_std::any::ComposeTypeErased as graphene_core::Node<alloc::boxed::Box<dyn dyn_any::DynAny>>>::eval::{{closure}}::h2051518d874a7551 (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[4485]:0x6878b7)
    at <core::pin::Pin<P> as core::future::future::Future>::poll::hdfaf39f5319aaa0b (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[11767]:0x800c2a)
    at <&interpreted_executor::dynamic_executor::DynamicExecutor as graph_craft::graphene_compiler::Executor<I,graph_craft::document::value::TaggedValue>>::execute::{{closure}}::h879f63318096b1e7 (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[1542]:0x4b9f88)
    at graphite_editor::node_graph_executor::NodeRuntime::run::{{closure}}::h08d6466e488e4efc (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[269]:0x1695ab)
    at graphite_wasm::editor_api::poll_node_graph_evaluation::{{closure}}::h35e70cf4b5286951 (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[1849]:0x505887)
    at wasm_bindgen_futures::queue::Queue::new::{{closure}}::h8e594b6c27a9154f (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[2232]:0x552973)
    at <dyn core::ops::function::FnMut<(A,)>+Output = R as wasm_bindgen::closure::WasmClosure>::describe::invoke::h850a2d3afd757952 (http://localhost:8080/wasm/pkg/graphite_wasm_bg.wasm:wasm-function[13384]:0x81489e)
    at __wbg_adapter_56 (http://localhost:8080/wasm/pkg/graphite_wasm.js:276:10)
    at real (http://localhost:8080/wasm/pkg/graphite_wasm.js:231:20)
0HyperCube commented 8 months ago

@Keavon This is because you are constructing a Vec with more than usize::MAX items (usize is u32 on wasm32-unknown-unknown). I think this is likely inside the AccelerationGrid::new function.

Keavon commented 8 months ago

Ah, the detail I had missed which threw me for a loop was how this newly connected shape ended up being huge, because it starts out large and then gets fed through the Transform node's additional massive enlargement that was used for the previous unit circle Shape node. So that's how it ended up trying to sample across a totally massive area. Now that makes sense!