Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add miri job to run MIRI to tests #66

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

ci: add miri job to run MIRI to tests #66

wants to merge 2 commits into from

Conversation

laysakura
Copy link
Contributor

@laysakura laysakura commented Jul 13, 2022

Issue number and link

Fixes: #61

Describe your changes

  • add miri CI job
  • add miri cargo make task

Checklist before requesting a review

  • I follow the Semantic Pull Requests rules (bugfix/feature)
  • I specified links to related issues (must: bugfix, want: feature)
  • I have performed a self-review of my code (bugfix/feature)
  • I have added thorough tests (bugfix/feature)
  • I have edited ## [Unreleased] section in CHANGELOG.md following keep a changelog syntax (bugfix/feature)
  • I {made/will make} a related pull request for documentation repo (feature)

@laysakura
Copy link
Contributor Author

laysakura commented Jul 13, 2022

MIRI failed for the two reasons.

1. parking_lot

warning: integer-to-pointer cast
   --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/parking_lot_core-0.9.3/src/word_lock.rs:320:9
    |
320 |         (self & QUEUE_MASK) as *const ThreadData
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ integer-to-pointer cast
    |
    = help: This program is using integer-to-pointer casts or (equivalently) `ptr::from_exposed_addr`,
    = help: which means that Miri might miss pointer bugs in this program.
    = help: See https://doc.rust-lang.org/nightly/std/ptr/fn.from_exposed_addr.html for more details on that operation.
    = help: To ensure that Miri does not miss bugs in your program, use Strict Provenance APIs (https://doc.rust-lang.org/nightly/std/ptr/index.html#strict-provenance, https://crates.io/crates/sptr) instead.
    = help: You can then pass the `-Zmiri-strict-provenance` flag to Miri, to ensure you are not relying on `from_exposed_addr` semantics.
    = help: Alternatively, the `-Zmiri-permissive-provenance` flag disables this warning.
    = note: backtrace:
    = note: inside `<usize as parking_lot_core::word_lock::LockState>::queue_head` at /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/parking_lot_core-0.9.3/src/word_lock.rs:320:9
    = note: inside `parking_lot_core::word_lock::WordLock::unlock` at /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/parking_lot_core-0.9.3/src/word_lock.rs:104:39
    = note: inside `parking_lot_core::parking_lot::unpark_one::<[closure@parking_lot::raw_mutex::RawMutex::unlock_slow::{closure#0}]>` at /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/parking_lot_core-0.9.3/src/parking_lot.rs:789:5
    = note: inside `parking_lot::raw_mutex::RawMutex::unlock_slow` at /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/parking_lot-0.12.0/src/raw_mutex.rs:321:13
    = note: inside `<parking_lot::raw_mutex::RawMutex as lock_api::mutex::RawMutex>::unlock` at /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/parking_lot-0.12.0/src/raw_mutex.rs:109:9
    = note: inside `<lock_api::mutex::MutexGuard<parking_lot::raw_mutex::RawMutex, bool> as std::ops::Drop>::drop` at /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/lock_api-0.4.7/src/mutex.rs:656:13
    = note: inside `std::ptr::drop_in_place::<lock_api::mutex::MutexGuard<parking_lot::raw_mutex::RawMutex, bool>> - shim(Some(lock_api::mutex::MutexGuard<parking_lot::raw_mutex::RawMutex, bool>))` at /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:487:1
    = note: inside `springql_core::stream_engine::autonomous_executor::worker::worker_handle::WorkerSetupCoordinator::sync::<bool, [closure@springql_core::stream_engine::autonomous_executor::worker::worker_handle::WorkerSetupCoordinator::sync_bool::{closure#0}]>` at /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/springql-core-0.16.0/src/stream_engine/autonomous_executor/worker/worker_handle.rs:126:17
    = note: inside `springql_core::stream_engine::autonomous_executor::worker::worker_handle::WorkerSetupCoordinator::sync_bool` at /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/springql-core-0.16.0/src/stream_engine/autonomous_executor/worker/worker_handle.rs:114:9
    = note: inside `springql_core::stream_engine::autonomous_executor::worker::worker_handle::WorkerSetupCoordinator::sync_wait_all_workers` at /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/springql-core-0.16.0/src/stream_engine/autonomous_executor/worker/worker_handle.rs:88:9
    = note: inside `<springql_core::stream_engine::autonomous_executor::memory_state_machine_worker::memory_state_machine_worker_thread::MemoryStateMachineWorkerThread as springql_core::stream_engine::autonomous_executor::worker::worker_thread::WorkerThread>::main_loop` at /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/springql-core-0.16.0/src/stream_engine/autonomous_executor/worker/worker_thread.rs:146:9
    = note: inside closure at /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/springql-core-0.16.0/src/stream_engine/autonomous_executor/worker/worker_thread.rs:125:17
    = note: inside `std::sys_common::backtrace::__rust_begin_short_backtrace::<[closure@<springql_core::stream_engine::autonomous_executor::memory_state_machine_worker::memory_state_machine_worker_thread::MemoryStateMachineWorkerThread as springql_core::stream_engine::autonomous_executor::worker::worker_thread::WorkerThread>::run::{closure#1}], ()>` at /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys_common/backtrace.rs:122:18
    = note: inside closure at /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/mod.rs:505:17
    = note: inside `<std::panic::AssertUnwindSafe<[closure@std::thread::Builder::spawn_unchecked_<[closure@<springql_core::stream_engine::autonomous_executor::memory_state_machine_worker::memory_state_machine_worker_thread::MemoryStateMachineWorkerThread as springql_core::stream_engine::autonomous_executor::worker::worker_thread::WorkerThread>::run::{closure#1}], ()>::{closure#1}::{closure#0}]> as std::ops::FnOnce<()>>::call_once` at /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/panic/unwind_safe.rs:271:9
    = note: inside `std::panicking::r#try::do_call::<std::panic::AssertUnwindSafe<[closure@std::thread::Builder::spawn_unchecked_<[closure@<springql_core::stream_engine::autonomous_executor::memory_state_machine_worker::memory_state_machine_worker_thread::MemoryStateMachineWorkerThread as springql_core::stream_engine::autonomous_executor::worker::worker_thread::WorkerThread>::run::{closure#1}], ()>::{closure#1}::{closure#0}]>, ()>` at /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:492:40
    = note: inside `std::panicking::r#try::<(), std::panic::AssertUnwindSafe<[closure@std::thread::Builder::spawn_unchecked_<[closure@<springql_core::stream_engine::autonomous_executor::memory_state_machine_worker::memory_state_machine_worker_thread::MemoryStateMachineWorkerThread as springql_core::stream_engine::autonomous_executor::worker::worker_thread::WorkerThread>::run::{closure#1}], ()>::{closure#1}::{closure#0}]>>` at /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:456:19
    = note: inside `std::panic::catch_unwind::<std::panic::AssertUnwindSafe<[closure@std::thread::Builder::spawn_unchecked_<[closure@<springql_core::stream_engine::autonomous_executor::memory_state_machine_worker::memory_state_machine_worker_thread::MemoryStateMachineWorkerThread as springql_core::stream_engine::autonomous_executor::worker::worker_thread::WorkerThread>::run::{closure#1}], ()>::{closure#1}::{closure#0}]>, ()>` at /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panic.rs:137:14
    = note: inside closure at /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/mod.rs:504:30
    = note: inside `<[closure@std::thread::Builder::spawn_unchecked_<[closure@<springql_core::stream_engine::autonomous_executor::memory_state_machine_worker::memory_state_machine_worker_thread::MemoryStateMachineWorkerThread as springql_core::stream_engine::autonomous_executor::worker::worker_thread::WorkerThread>::run::{closure#1}], ()>::{closure#1}] as std::ops::FnOnce<()>>::call_once - shim(vtable)` at /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:248:5
    = note: inside `<std::boxed::Box<dyn std::ops::FnOnce()> as std::ops::FnOnce<()>>::call_once` at /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/boxed.rs:1934:9
    = note: inside `<std::boxed::Box<std::boxed::Box<dyn std::ops::FnOnce()>> as std::ops::FnOnce<()>>::call_once` at /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/boxed.rs:1934:9
    = note: inside `std::sys::unix::thread::Thread::new::thread_start` at /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/unix/thread.rs:108:17

Solution

Remove dependency to parking_lot.
SpringQL/SpringQL#222

2. once_cell

warning: integer-to-pointer cast
   --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/once_cell-1.10.0/src/imp_std.rs:227:29
    |
227 |             let mut queue = (state_and_queue & !STATE_MASK) as *const Waiter;
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ integer-to-pointer cast
    |
    = note: inside `<once_cell::imp::WaiterQueue as std::ops::Drop>::drop` at /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/once_cell-1.10.0/src/imp_std.rs:227:29
    = note: inside `std::ptr::drop_in_place::<once_cell::imp::WaiterQueue> - shim(Some(once_cell::imp::WaiterQueue))` at /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:487:1
    = note: inside `once_cell::imp::initialize_inner` at /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/once_cell-1.10.0/src/imp_std.rs:176:13
    = note: inside `once_cell::imp::OnceCell::<std::sync::Arc<springql_core::stream_engine::in_memory_queue_repository::InMemoryQueueRepository>>::initialize::<[closure@once_cell::sync::OnceCell<std::sync::Arc<springql_core::stream_engine::in_memory_queue_repository::InMemoryQueueRepository>>::get_or_init<[closure@once_cell::sync::Lazy<std::sync::Arc<springql_core::stream_engine::in_memory_queue_repository::InMemoryQueueRepository>>::force::{closure#0}]>::{closure#0}], once_cell::sync::OnceCell<T>::get_or_init::Void>` at /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/once_cell-1.10.0/src/imp_std.rs:93:9
    = note: inside `once_cell::sync::OnceCell::<std::sync::Arc<springql_core::stream_engine::in_memory_queue_repository::InMemoryQueueRepository>>::get_or_try_init::<[closure@once_cell::sync::OnceCell<std::sync::Arc<springql_core::stream_engine::in_memory_queue_repository::InMemoryQueueRepository>>::get_or_init<[closure@once_cell::sync::Lazy<std::sync::Arc<springql_core::stream_engine::in_memory_queue_repository::InMemoryQueueRepository>>::force::{closure#0}]>::{closure#0}], once_cell::sync::OnceCell<T>::get_or_init::Void>` at /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/once_cell-1.10.0/src/lib.rs:1014:13
    = note: inside `once_cell::sync::OnceCell::<std::sync::Arc<springql_core::stream_engine::in_memory_queue_repository::InMemoryQueueRepository>>::get_or_init::<[closure@once_cell::sync::Lazy<std::sync::Arc<springql_core::stream_engine::in_memory_queue_repository::InMemoryQueueRepository>>::force::{closure#0}]>` at /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/once_cell-1.10.0/src/lib.rs:974:19
    = note: inside `once_cell::sync::Lazy::<std::sync::Arc<springql_core::stream_engine::in_memory_queue_repository::InMemoryQueueRepository>>::force` at /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/once_cell-1.10.0/src/lib.rs:1162:13
    = note: inside `<once_cell::sync::Lazy<std::sync::Arc<springql_core::stream_engine::in_memory_queue_repository::InMemoryQueueRepository>> as std::ops::Deref>::deref` at /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/once_cell-1.10.0/src/lib.rs:1172:13
    = note: inside `springql_core::stream_engine::in_memory_queue_repository::InMemoryQueueRepository::instance` at /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/springql-core-0.16.0/src/stream_engine/in_memory_queue_repository.rs:34:9
    = note: inside `<springql_core::stream_engine::autonomous_executor::task::sink_task::sink_writer::in_memory_queue::InMemoryQueueSinkWriter as springql_core::stream_engine::autonomous_executor::task::sink_task::sink_writer::SinkWriter>::start` at /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/springql-core-0.16.0/src/stream_engine/autonomous_executor/task/sink_task/sink_writer/in_memory_queue.rs:22:9
    = note: inside `springql_core::stream_engine::autonomous_executor::task::sink_task::sink_writer::sink_writer_factory::SinkWriterFactory::sink` at /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/springql-core-0.16.0/src/stream_engine/autonomous_executor/task/sink_task/sink_writer/sink_writer_factory.rs:30:28
    = note: inside `springql_core::stream_engine::autonomous_executor::task::sink_task::sink_writer::sink_writer_repository::SinkWriterRepository::register` at /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/springql-core-0.16.0/src/stream_engine/autonomous_executor/task/sink_task/sink_writer/sink_writer_repository.rs:46:27
    = note: inside closure at /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/springql-core-0.16.0/src/stream_engine/autonomous_executor/task_executor.rs:88:17
    = note: inside closure at /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/iterator.rs:2296:26
    = note: inside `<std::vec::IntoIter<&springql_core::pipeline::sink_writer_model::SinkWriterModel> as std::iter::Iterator>::try_fold::<(), [closure@std::iter::Iterator::try_for_each::call<&springql_core::pipeline::sink_writer_model::SinkWriterModel, std::result::Result<(), springql::SpringError>, [closure@springql_core::stream_engine::autonomous_executor::task_executor::TaskExecutor::update_pipeline::{closure#1}]>::{closure#0}], std::result::Result<(), springql::SpringError>>` at /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/iterator.rs:2238:21
    = note: inside `<std::vec::IntoIter<&springql_core::pipeline::sink_writer_model::SinkWriterModel> as std::iter::Iterator>::try_for_each::<[closure@springql_core::stream_engine::autonomous_executor::task_executor::TaskExecutor::update_pipeline::{closure#1}], std::result::Result<(), springql::SpringError>>` at /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/iterator.rs:2299:9
    = note: inside `springql_core::stream_engine::autonomous_executor::task_executor::TaskExecutor::update_pipeline` at /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/springql-core-0.16.0/src/stream_engine/autonomous_executor/task_executor.rs:84:9
    = note: inside `springql_core::stream_engine::autonomous_executor::AutonomousExecutor::notify_pipeline_update` at /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/springql-core-0.16.0/src/stream_engine/autonomous_executor.rs:138:9
    = note: inside `springql_core::stream_engine::StreamEngine::alter_pipeline` at /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/springql-core-0.16.0/src/stream_engine.rs:80:9
    = note: inside `springql_core::connection::Connection::command` at /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/springql-core-0.16.0/src/connection.rs:53:42
    = note: inside `springql::SpringPipeline::command::<std::string::String>` at /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/springql-core-0.16.0/src/api/spring_pipeline.rs:30:9
note: inside closure at src/lib.rs:148:32
   --> src/lib.rs:148:32
    |
148 |     let result = with_catch(|| ru_pipeline.command(sql));
    |                                ^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure at src/lib.rs:623:21
   --> src/lib.rs:623:21
    |
623 |     catch_unwind(|| f().map_err(LastError::SpringErr))
    |                     ^^^
    = note: inside `std::panicking::r#try::do_call::<[closure@src/lib.rs:623:18: 623:20], std::result::Result<(), spring_last_err::LastError>>` at /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:492:40
    = note: inside `std::panicking::r#try::<std::result::Result<(), spring_last_err::LastError>, [closure@src/lib.rs:623:18: 623:20]>` at /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:456:19
    = note: inside `std::panic::catch_unwind::<[closure@src/lib.rs:623:18: 623:20], std::result::Result<(), spring_last_err::LastError>>` at /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panic.rs:137:14
note: inside `with_catch::<[closure@src/lib.rs:148:29: 148:31], ()>` at src/lib.rs:623:5
   --> src/lib.rs:623:5
    |
623 |     catch_unwind(|| f().map_err(LastError::SpringErr))
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `spring_command` at src/lib.rs:148:18
   --> src/lib.rs:148:18
    |
148 |     let result = with_catch(|| ru_pipeline.command(sql));
    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tests::spring_sink_row::command` at src/tests/spring_sink_row.rs:9:17
   --> src/tests/spring_sink_row.rs:9:17
    |
9   |     let errno = spring_command(pipeline, sql.as_ptr());
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tests::spring_sink_row::test_spring_sink_row` at src/tests/spring_sink_row.rs:32:9
   --> src/tests/spring_sink_row.rs:32:9
    |
32  | /         command(
33  | |             pipeline,
34  | |             "
35  | |             CREATE SINK WRITER queue_sink FOR sink_1
36  | |                 TYPE IN_MEMORY_QUEUE OPTIONS (NAME 'q_sink');
37  | |             ",
38  | |         );
    | |_________^
note: inside closure at src/tests/spring_sink_row.rs:14:1
   --> src/tests/spring_sink_row.rs:14:1
    |
13  |   #[test]
    |   ------- in this procedural macro expansion
14  | / fn test_spring_sink_row() {
15  | |     unsafe {
16  | |         let config = spring_config_default();
17  | |         assert!(!config.is_null());
...   |
74  | |     }
75  | | }
    | |_^
    = note: this warning originates in the attribute macro `test` (in Nightly builds, run with -Z macro-backtrace for more info)

Solution

This PR will solve it.
https://github.com/matklad/once_cell/pull/185/files#diff-931984fc678467bcffbb90024e5007bede70745764accb6cb34150f28a548928R181

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Integration test with MIRI
1 participant