Known problems - shuwens/NetBricks GitHub Wiki

running deluge

https://github.com/deluge-torrent/deluge/pull/270

DPDK issues

using later Linux version will incur the

error: this statement may fall through [-Werror=implicit-fallthrough=]

https://github.com/intel/linux-sgx-driver/issues/97

https://askubuntu.com/questions/851433/kernel-doesnt-support-pic-mode-for-compiling

https://askubuntu.com/questions/1064656/cc1-error-code-model-kernel-does-not-support-pic-mode

https://github.com/rburkholder/vagrant/blob/master/bldkrnlpkg/buildkrnl.sh

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=841420

https://unix.stackexchange.com/questions/319761/cannot-compile-kernel-error-kernel-does-not-support-pic-mode/319830

Add '-Wno-implicit-fallthrough'

https://dpdkdashboard.iol.unh.edu/results/dashboard/patchsets/6912/

https://gitea.ananwork.com/mirrors/dpdk/commit/c96bbbd010f7abb88c2ca2ed9dfc5ecd37e9027d

https://www.mail-archive.com/[email protected]/msg143955.html

https://patches.openembedded.org/patch/163671/

https://patches.dpdk.org/patch/57239/

compiler NetBricks

Only works on Ubuntu kernel 4, Ubuntu kernel 5 will incur this error: code model kernel does not support PIC mode

Cargo compiler issues

Later nightly compiler will not cache compiled dependency in workspaces, could try https://github.com/mozilla/sccache, https://doc.rust-lang.org/cargo/guide/build-cache.html

cargo install sccache

And then add this to the Cargo.toml

RDR proxy

spawning too many headless browser...

Receiving started
thread 'sched-5' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 1, kind: PermissionDenied, message: "Operation not permitted" }

   0: <failure::backtrace::Backtrace as core::default::Default>::default
             at /home/jethros/.cargo/registry/src/github.com-1ecc6299db9ec823/failure-0.1.7/src/backtrace/internal.rs:46
   1: headless_chrome::browser::process::Process::start_process
   2: headless_chrome::browser::process::Process::new
   3: pvn_rdr_transform_app::nf::rdr
             at /home/jethros/.cargo/git/checkouts/rust-headless-chrome-64aacc558fc60af2/a32ed87/src/browser/mod.rs:82
   4: <alloc::vec::Vec<T> as core::iter::traits::collect::FromIterator<T>>::from_iter
             at test/app-rdr_t/src/main.rs:47
      core::iter::traits::iterator::Iterator::collect
             at /rustc/38114ff16e7856f98b2b4be7ab4cd29b38bed59a/src/libcore/iter/traits/iterator.rs:1659
      pvn_rdr_transform_app::rdr_proxy_test
             at test/app-rdr_t/src/main.rs:45
   5: e2d2::scheduler::context::NetBricksContext::add_pipeline_to_run::{{closure}}
   6: e2d2::scheduler::standalone_scheduler::StandaloneScheduler::handle_request
             at framework/src/scheduler/standalone_scheduler.rs:95
   7: e2d2::scheduler::context::NetBricksContext::start_scheduler::{{closure}}
             at framework/src/scheduler/standalone_scheduler.rs:118
      std::sys_common::backtrace::__rust_begin_short_backtrace
             at /rustc/38114ff16e7856f98b2b4be7ab4cd29b38bed59a/src/libstd/sys_common/backtrace.rs:130
   8: std::thread::Builder::spawn_unchecked::{{closure}}::{{closure}}
             at /rustc/38114ff16e7856f98b2b4be7ab4cd29b38bed59a/src/libstd/thread/mod.rs:475
      <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /rustc/38114ff16e7856f98b2b4be7ab4cd29b38bed59a/src/libstd/panic.rs:318
      std::panicking::try::do_call
             at /rustc/38114ff16e7856f98b2b4be7ab4cd29b38bed59a/src/libstd/panicking.rs:331
      std::panicking::try
             at /rustc/38114ff16e7856f98b2b4be7ab4cd29b38bed59a/src/libstd/panicking.rs:274
      std::panic::catch_unwind
             at /rustc/38114ff16e7856f98b2b4be7ab4cd29b38bed59a/src/libstd/panic.rs:394
      std::thread::Builder::spawn_unchecked::{{closure}}
             at /rustc/38114ff16e7856f98b2b4be7ab4cd29b38bed59a/src/libstd/thread/mod.rs:474
      core::ops::function::FnOnce::call_once{{vtable.shim}}
             at /rustc/38114ff16e7856f98b2b4be7ab4cd29b38bed59a/src/libcore/ops/function.rs:232
   9: <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once
             at /rustc/38114ff16e7856f98b2b4be7ab4cd29b38bed59a/src/liballoc/boxed.rs:1017
  10: <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once
             at /rustc/38114ff16e7856f98b2b4be7ab4cd29b38bed59a/src/liballoc/boxed.rs:1017
      std::sys_common::thread::start_thread
             at src/libstd/sys_common/thread.rs:13
      std::sys::unix::thread::Thread::new::thread_start
             at src/libstd/sys/unix/thread.rs:80
  11: start_thread
  12: __clone
', test/app-rdr_t/src/nf.rs:55:23
stack backtrace:
   0:     0x55555577ebeb - backtrace::backtrace::libunwind::trace::h8ac7b6ec69387d92
                               at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.45/src/backtrace/libunwind.rs:86
   1:     0x55555577ebeb - backtrace::backtrace::trace_unsynchronized::h52e23d5def56c96d
                               at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.45/src/backtrace/mod.rs:66
   2:     0x55555577ebeb - std::sys_common::backtrace::_print_fmt::h15ed2362e9ccd2a1
                               at src/libstd/sys_common/backtrace.rs:78
   3:     0x55555577ebeb - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h41f699e6bf24dadd
                               at src/libstd/sys_common/backtrace.rs:59
   4:     0x555555604f8c - core::fmt::write::hd0bcc8c62ff6b7a7
                               at src/libcore/fmt/mod.rs:1069
   5:     0x55555577e321 - std::io::Write::write_fmt::hb48820ae2393c84b
                               at src/libstd/io/mod.rs:1427
   6:     0x55555577de73 - std::sys_common::backtrace::_print::h2be62896807550d2
                               at src/libstd/sys_common/backtrace.rs:62
   7:     0x55555577de73 - std::sys_common::backtrace::print::hf7ae942ef2de419d
                               at src/libstd/sys_common/backtrace.rs:49
   8:     0x55555577de73 - std::panicking::default_hook::{{closure}}::h44b5e5560f225767
                               at src/libstd/panicking.rs:198
   9:     0x55555577d499 - std::panicking::default_hook::h9b61628334f056c5
                               at src/libstd/panicking.rs:218
  10:     0x55555577d499 - std::panicking::rust_panic_with_hook::h1fdc57c433270b4b
                               at src/libstd/panicking.rs:511
  11:     0x55555577d038 - rust_begin_unwind
                               at src/libstd/panicking.rs:419
  12:     0x5555556032b0 - core::panicking::panic_fmt::h2f1dd5e65f940408
                               at src/libcore/panicking.rs:111
  13:     0x5555556091e2 - core::option::expect_none_failed::h320a464854808d98
                               at src/libcore/option.rs:1268
  14:     0x5555555ddd6d - pvn_rdr_transform_app::nf::rdr::h33fd8d7c7b7b644b
                               at /rustc/38114ff16e7856f98b2b4be7ab4cd29b38bed59a/src/libcore/result.rs:1003
  15:     0x5555555cde21 - <alloc::vec::Vec<T> as core::iter::traits::collect::FromIterator<T>>::from_iter::he5fc387d46289879
                               at test/app-rdr_t/src/main.rs:47
  16:     0x5555555cde21 - core::iter::traits::iterator::Iterator::collect::hcf812174eb527cc4
                               at /rustc/38114ff16e7856f98b2b4be7ab4cd29b38bed59a/src/libcore/iter/traits/iterator.rs:1659
  17:     0x5555555cde21 - pvn_rdr_transform_app::rdr_proxy_test::h5bcb7ba811dbe839
                               at test/app-rdr_t/src/main.rs:45
  18:     0x5555555aa5c6 - e2d2::scheduler::context::NetBricksContext::add_pipeline_to_run::{{closure}}::hf31608a8467e9806
  19:     0x5555555c87fb - e2d2::scheduler::standalone_scheduler::StandaloneScheduler::handle_request::h7034ab9b40f80153
                               at framework/src/scheduler/standalone_scheduler.rs:95
  20:     0x5555555cfc1a - e2d2::scheduler::context::NetBricksContext::start_scheduler::{{closure}}::h220c8ffdddbcf6d3
                               at framework/src/scheduler/standalone_scheduler.rs:118
  21:     0x5555555cfc1a - std::sys_common::backtrace::__rust_begin_short_backtrace::hf9c33978107cfc0f
                               at /rustc/38114ff16e7856f98b2b4be7ab4cd29b38bed59a/src/libstd/sys_common/backtrace.rs:130
  22:     0x5555556e7070 - std::thread::Builder::spawn_unchecked::{{closure}}::{{closure}}::h9a144dc4cc3223da
                               at /rustc/38114ff16e7856f98b2b4be7ab4cd29b38bed59a/src/libstd/thread/mod.rs:475
  23:     0x5555556e7070 - <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::haeeac5dd839b12c8
                               at /rustc/38114ff16e7856f98b2b4be7ab4cd29b38bed59a/src/libstd/panic.rs:318
  24:     0x5555556e7070 - std::panicking::try::do_call::h7cc86abb197e6dd4
                               at /rustc/38114ff16e7856f98b2b4be7ab4cd29b38bed59a/src/libstd/panicking.rs:331
  25:     0x5555556e7070 - std::panicking::try::h3457ae23239dad03
                               at /rustc/38114ff16e7856f98b2b4be7ab4cd29b38bed59a/src/libstd/panicking.rs:274
  26:     0x5555556e7070 - std::panic::catch_unwind::h0782427a3be659d6
                               at /rustc/38114ff16e7856f98b2b4be7ab4cd29b38bed59a/src/libstd/panic.rs:394
  27:     0x5555556e7070 - std::thread::Builder::spawn_unchecked::{{closure}}::h12ef51dfb911ada1
                               at /rustc/38114ff16e7856f98b2b4be7ab4cd29b38bed59a/src/libstd/thread/mod.rs:474
  28:     0x5555556e7070 - core::ops::function::FnOnce::call_once{{vtable.shim}}::h9392c325cf4f85fc
                               at /rustc/38114ff16e7856f98b2b4be7ab4cd29b38bed59a/src/libcore/ops/function.rs:232
  29:     0x55555578f91f - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::he430a6894c2b20e9
                               at /rustc/38114ff16e7856f98b2b4be7ab4cd29b38bed59a/src/liballoc/boxed.rs:1017
  30:     0x555555792aa3 - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h029952ec4742e6b3
                               at /rustc/38114ff16e7856f98b2b4be7ab4cd29b38bed59a/src/liballoc/boxed.rs:1017
  31:     0x555555792aa3 - std::sys_common::thread::start_thread::h27ffb6aa3b5f68c5
                               at src/libstd/sys_common/thread.rs:13
  32:     0x555555792aa3 - std::sys::unix::thread::Thread::new::thread_start::h27466b8f06c168c0
                               at src/libstd/sys/unix/thread.rs:80
  33:     0x7ffff6bde6db - start_thread
  34:     0x7ffff66ef88f - __clone
  35:                0x0 - <unknown>
^C⏎

FFI safe

warning: `extern` block uses type `u128` which is not FFI-safe: 128-bit integers don't currently have a known stable ABI
    --> /home/jethros/dev/netbricks/target/release/build/e2d2-42204544dcf174cd/out/dpdk_bindings.rs:4133:18

https://github.com/rust-lang/rust-bindgen/issues/1549

https://github.com/rust-lang/rust/issues/54341

https://github.com/zmwangx/rust-ffmpeg-sys/commit/d54e5590c444a56774e44b2977efd929e1ab4d07#diff-d0d98998092552a1d3259338c2c71e118a5b8343dd4703c0c7f552ada7f9cb42

Running NetBricks

https://rust-unofficial.github.io/too-many-lists/fifth-layout.html

https://www.reddit.com/r/rust/comments/2muvqx/cloning_of_vectors_or_how_to_explicitly_copy_a/

run netbricks on multi-core

Using master core 0
Name of this NF is recv
Cores we can use are: [2]
Cores for port are: {"0000:01:00.0": [2]}
Start with primary...
Failed to detect # of NUMA nodes from: /sys/devices/system/node/possible. Assuming a single-node system...
EAL: Detected 6 lcore(s)
EAL: Probing VFIO support...
Running on node 0
Devname: "0000:01:00.0"

NUMA socket setup

EAL: PCI device 0000:01:00.0 on NUMA socket -1
EAL:   Invalid NUMA socket, default to 0
EAL:   probe driver: 8086:1583 net_i40e
Going to try and use port 0
Running on node 0
Receiving started
Running 1 pipelines

dpdk mailing list warning "Invalid NUMA socket" is meaningless

thread panic

1.00 OVERALL RX 0.00 TX 0.00 FLOWS 0
thread '<unnamed>' panicked at 'called `Option::unwrap()` on a `None` value', src/libcore/option.rs:345:21
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

Issue 1: alloc::Opaque issue

Description: std::alloc has changed and alloc::Opaque no longer exists

error[E0432]: unresolved import `std::alloc::Opaque`
 --> framework/src/allocators/cache_aligned.rs:1:47
  |
1 | use std::alloc::{self, Alloc, Global, Layout, Opaque};
  |                                               ^^^^^^ no `Opaque` in `alloc`

The Opaque was firstly discussed (here)in Allocator trait, but was later removed during a GlobalAllocator discussion (here)

Solution: use u8 instead.

Issue 2: packed type

Description: struct DirectoryHeader are defined as packed type, however the struct contains align type implicitly which is causing the Rust compiler to throw out an error.(rust referece)

error[E0588]: packed type cannot transitively contain a `[repr(align)]` type
  --> framework/src/shared_state/directory.rs:13:1
   |
13 | / pub struct DirectoryHeader {
14 | |     entries: AtomicUsize,
15 | |     // Used to signal that snapshotting is in progress.
16 | |     current_version: AtomicUsize,
17 | |     committed_version: AtomicUsize,
18 | |     length: usize,
19 | | }
   | |_^

Issue here

Current Solution: Since packed is used to strip out padding, we can use align(N) here to enforce the rule.

Alternative Solution: Getting rid of packed. As from the Advanced Rust Book (packed can cause performance penalty)

However

  • LLVM issue with Rust alignment? issue

packed and align

The fix

Issue 3: features

Description: the heap_api and unique features in framework/src/lib.rs are causing compiling errors.

Solutions: get rid of unique -- it is now ptr_internals, getting rid of heap_api -- deprecated gracefully?

Issue 4: LLVM/Clang

clang 5.0 is fine but clang 6.0 and 7.0 will complain:

ToFix--Issue 5: xxx package update breaks Travis because of too many error messages.

Description: TBA

TODO: We need to figure out the tradeoff here, i.e., should I update the internal impl etc because of the performance gain from the upgrade, or that we should skip it.

ToFix--Issue 6: Deprecating FnBox

Description: This will break the NetBricks build starting 2019/06/29 (issue).

TODO: Need to figure out if I want to change the impl.

https://stackoverflow.com/questions/53355265/how-can-i-only-show-warnings-if-there-are-no-errors

Features

Can we do dynamic loading in Rust (i.e., can we change crates at runtime)

Dynamic Loading & Plugins

how to write a plugin in rust

blog: rust dynamic loading

reddit: rust dynamic loading

SO: does rust have a dlopen equal

rust github: make runtime lib loading safer

rust github: get dynamic loading working

Valgrind

valgrind guide from Peloton

Using massif with valgrind

sudo valgrind --tool=massif  env PATH="$PATH" LD_LIBRARY_PATH="$LD_LIBRARY_PATH" LD_PRELOAD="$LD_PRELOAD" \
    $executable "$@"

Using valgrind

sudo valgrind --tool=callgrind --trace-children=yes env PATH="$PATH" LD_LIBRARY_PATH="$LD_LIBRARY_PATH" LD_PRELOAD="$LD_PRELOAD" \
    $executable "$@"
⚠️ **GitHub.com Fallback** ⚠️