servo / ipc-channel

A multiprocess drop-in replacement for Rust channels
Apache License 2.0
883 stars 129 forks source link

Unix channels trigger valgrind errors #230

Open jdm opened 5 years ago

jdm commented 5 years ago

One example from https://paste.sh/LwlXNbkD#GFVUcztjTpQbNpZoVKg4SDmI:

==130127== Thread 57 LayoutThread Pip:
==130127== Syscall param sendmsg(msg.msg_control) points to uninitialised byte(s)
==130127==    at 0xE7E83A7: __libc_sendmsg (sendmsg.c:28)
==130127==    by 0xE7E83A7: sendmsg (sendmsg.c:25)
==130127==    by 0x953F937: ipc_channel::platform::unix::OsIpcSender::send::send_first_fragment (mod.rs:284)
==130127==    by 0x953ED06: ipc_channel::platform::unix::OsIpcSender::send (mod.rs:336)
==130127==    by 0x56D6B1E: <ipc_channel::ipc::IpcSender<T>>::send::{{closure}}::{{closure}} (ipc.rs:189)
==130127==    by 0x577523E: <std::thread::local::LocalKey<T>>::try_with (local.rs:300)
==130127==    by 0x577367B: <std::thread::local::LocalKey<T>>::with (local.rs:246)
==130127==    by 0x56D5C51: <ipc_channel::ipc::IpcSender<T>>::send::{{closure}} (ipc.rs:171)
==130127==    by 0x5774D0E: <std::thread::local::LocalKey<T>>::try_with (local.rs:300)
==130127==    by 0x5773442: <std::thread::local::LocalKey<T>>::with (local.rs:246)
==130127==    by 0x56D5B41: <ipc_channel::ipc::IpcSender<T>>::send (ipc.rs:170)
==130127==    by 0x56F032E: <gfx::font_cache_thread::FontCacheThread as gfx::font_context::FontSource>::font_template (font_cache_thread.rs:537)
==130127==    by 0x4ADD77B: <gfx::font_context::FontContext<S>>::font_template::{{closure}} (font_context.rs:162)
==130127==  Address 0x207bbe64 is 20 bytes inside a block of size 24 alloc'd
==130127==    at 0xD77E77F: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==130127==    by 0x953F686: ipc_channel::platform::unix::OsIpcSender::send::send_first_fragment (mod.rs:245)
==130127==    by 0x953ED06: ipc_channel::platform::unix::OsIpcSender::send (mod.rs:336)
==130127==    by 0x56D6B1E: <ipc_channel::ipc::IpcSender<T>>::send::{{closure}}::{{closure}} (ipc.rs:189)
==130127==    by 0x577523E: <std::thread::local::LocalKey<T>>::try_with (local.rs:300)
==130127==    by 0x577367B: <std::thread::local::LocalKey<T>>::with (local.rs:246)
==130127==    by 0x56D5C51: <ipc_channel::ipc::IpcSender<T>>::send::{{closure}} (ipc.rs:171)
==130127==    by 0x5774D0E: <std::thread::local::LocalKey<T>>::try_with (local.rs:300)
==130127==    by 0x5773442: <std::thread::local::LocalKey<T>>::with (local.rs:246)
==130127==    by 0x56D5B41: <ipc_channel::ipc::IpcSender<T>>::send (ipc.rs:170)
==130127==    by 0x56F032E: <gfx::font_cache_thread::FontCacheThread as gfx::font_context::FontSource>::font_template (font_cache_thread.rs:537)
==130127==    by 0x4ADD77B: <gfx::font_context::FontContext<S>>::font_template::{{closure}} (font_context.rs:162)
jdm commented 5 years ago

It looks like due to alignment we could end up sending bytes that we don't actually initialize. I don't think we ever read from it, however.