setzer22 / blackjack

A procedural, node-based modelling tool, made in rust 🦀

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error: `free(): double free detected in tcache 2`

azazdeaz opened this issue · comments

Hi There, when i try to run the app as described in the readme, it throws:

$ RUST_BACKTRACE=1 cargo run --bin blackjack_ui
    Finished dev [unoptimized + debuginfo] target(s) in 0.13s
     Running `target/debug/blackjack_ui`
free(): double free detected in tcache 2
Aborted (core dumped)

Do you have any tip how should i fix this? This project looks amazing, and i'd love to try it out!

Ubuntu 22.04
rustc 1.64.0 (a55dd71d5 2022-09-19)

Wow, that one's spooky 🤔 Looks like something's triggering UB. There's a tiny bit of unsafe code in blackjack, but there's nothing that would trigger a crash at launch like that. Could be one of its several native dependencies though, I've had issues with rfd and mlua in the past.

Let's try getting a gdb backtrace, sometimes that helps finding the root cause (but not necessarily). Could you try this?

$ gdb -q ./target/debug/blackjack_ui
(gdb) run
# wait for the error to happen ...
(gdb) backtrace
# backtrace should be printed here

Right, it's something with my setup. I tried to compile it on the same machine, but in an Ubuntu22.04 Distrobox and in worked beautifully 🎉

These are the logs. I'd be grateful for any suggestion to fix this, but ultimately it's an issue on my end, so i'll close the issue.

`$ gdb -q ./target/debug/blackjack_ui`
Reading symbols from ./target/debug/blackjack_ui...
warning: Missing auto-load script at offset 0 in section .debug_gdb_scripts
of file /home/azazdeaz/repos/temp/blackjack/target/debug/blackjack_ui.
Use `info auto-load python-scripts [REGEXP]' to list them.
(gdb) run
Starting program: /home/azazdeaz/repos/temp/blackjack/target/debug/blackjack_ui 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffea84f640 (LWP 54958)]
[New Thread 0x7fffea04e640 (LWP 54959)]
[New Thread 0x7fffe984d640 (LWP 54960)]
[New Thread 0x7fffe904c640 (LWP 54961)]
[New Thread 0x7fffe884b640 (LWP 54962)]
[New Thread 0x7fffd3fff640 (LWP 54963)]
[New Thread 0x7fffcb7fe640 (LWP 54964)]
[New Thread 0x7fffd377e640 (LWP 54965)]
[New Thread 0x7fffd2e3c640 (LWP 54966)]
[New Thread 0x7fffd19fa640 (LWP 54967)]
[New Thread 0x7fffd11f9640 (LWP 54968)]
[New Thread 0x7fffd09f8640 (LWP 54969)]
[New Thread 0x7fffcbfff640 (LWP 54970)]
[New Thread 0x7fffcaffd640 (LWP 54971)]
[New Thread 0x7fffca7fc640 (LWP 54972)]
[New Thread 0x7fffc9ffb640 (LWP 54973)]
[New Thread 0x7fffc97fa640 (LWP 54974)]
[Thread 0x7fffd377e640 (LWP 54965) exited]
[Thread 0x7fffcb7fe640 (LWP 54964) exited]
[Thread 0x7fffd3fff640 (LWP 54963) exited]
[Thread 0x7fffe884b640 (LWP 54962) exited]
[Thread 0x7fffe904c640 (LWP 54961) exited]
[Thread 0x7fffe984d640 (LWP 54960) exited]
[Thread 0x7fffea04e640 (LWP 54959) exited]
[Thread 0x7fffea84f640 (LWP 54958) exited]
free(): double free detected in tcache 2

Thread 1 "blackjack_ui" received signal SIGABRT, Aborted.
__pthread_kill_implementation (no_tid=0, signo=6, threadid=140737346103744) at ./nptl/pthread_kill.c:44
44 ./nptl/pthread_kill.c: No such file or directory.
(gdb) backtrace
#0 __pthread_kill_implementation (no_tid=0, signo=6, threadid=140737346103744) at ./nptl/pthread_kill.c:44
#1 __pthread_kill_internal (signo=6, threadid=140737346103744) at ./nptl/pthread_kill.c:78
#2 __GI___pthread_kill (threadid=140737346103744, signo=signo@entry=6) at ./nptl/pthread_kill.c:89
#3 0x00007ffff7961476 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#4 0x00007ffff79477f3 in __GI_abort () at ./stdlib/abort.c:79
#5 0x00007ffff79a86f6 in __libc_message (action=action@entry=do_abort, fmt=fmt@entry=0x7ffff7afab8c "%s\n") at ../sysdeps/posix/libc_fatal.c:155
#6 0x00007ffff79bfd7c in malloc_printerr (str=str@entry=0x7ffff7afd710 "free(): double free detected in tcache 2") at ./malloc/malloc.c:5664
#7 0x00007ffff79c212b in _int_free (av=0x7ffff7b38c80 <main_arena>, p=0x5555576e8690, have_lock=0) at ./malloc/malloc.c:4473
#8 0x00007ffff79c44d3 in __GI___libc_free (mem=) at ./malloc/malloc.c:3391
#9 0x00007fffed46b82c in ?? () from /usr/lib/x86_64-linux-gnu/libvulkan_intel.so
#10 0x00007fffed4716f1 in ?? () from /usr/lib/x86_64-linux-gnu/libvulkan_intel.so
#11 0x00007fffed471a12 in ?? () from /usr/lib/x86_64-linux-gnu/libvulkan_intel.so
#12 0x00007fffed47277a in ?? () from /usr/lib/x86_64-linux-gnu/libvulkan_intel.so
#13 0x00007fffed46d66c in ?? () from /usr/lib/x86_64-linux-gnu/libvulkan_intel.so
#14 0x00007ffff75e0c4e in ?? () from /lib/x86_64-linux-gnu/libvulkan.so.1
#15 0x000055555695a4a8 in ash::extensions::khr::swapchain::Swapchain::create_swapchain (self=0x0, create_info=0xd6a9, allocation_callbacks=...)
at src/extensions/khr/swapchain.rs:64
#16 0x000055555690f962 in wgpu_hal::vulkan::Device::create_swapchain (self=0x555557acb7f8, config=0x7fffffff5c18, provided_old_swapchain=...,
surface=) at src/vulkan/device.rs:559
#17 wgpu_hal::vulkan::instance::{impl#5}::configure (self=0x555557721b18, device=0x555557acb7f8, config=0x7fffffff5c18) at src/vulkan/instance.rs:737
#18 0x00005555568134b6 in wgpu_core::hub::Global<wgpu_core::hub::IdentityManagerFactory>::surface_configure<wgpu_core::hub::IdentityManagerFactory, wgpu_hal::vulkan::Api> (self=, surface_id=..., device_id=..., config=)
at /home/azazdeaz/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-core-0.13.2/src/device/mod.rs:5089
#19 0x00005555567518a8 in wgpu::backend::direct::{impl#3}::surface_configure (self=0xd6a9, surface=0x5555579b2248, device=,
config=0x7fffffff4f90) at src/backend/direct.rs:1003
#20 0x0000555556655764 in rend3::surface::configure_surface (surface=0xd6a9, device=0xd6a9, format=..., size=...,
present_mode=wgpu_types::PresentMode::AutoVsync) at src/surface.rs:14
#21 0x00005555557a6c13 in blackjack_ui::render_context::RenderContext::new (window=0x7fffffff6e68) at blackjack_ui/src/render_context.rs:65
#22 0x0000555555a19671 in blackjack_ui::app_window::AppWindow::new () at blackjack_ui/src/app_window.rs:42
#23 0x0000555555784c7b in blackjack_ui::main () at blackjack_ui/src/main.rs:52

I'm very excited to see the future updates of this project ❤️

Looks like the backtrace points to your the Intel Vulkan driver. This does not mean the driver is necessarily at fault, but maybe updating (or downgrading?) the drivers may help?

This looks a bit beyond my reach unfortunately 🤔 Sorry I can't be of more help

If anyone wonders here, the issue happened because i was using the Mesa driver from https://launchpad.net/~oibaf/+archive/ubuntu/graphics-drivers. Reverting to the official release fixed the issue.