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

MPSC Channel test case times out. #1286

Closed
YoshikiTakashima opened this issue Jun 16, 2022 · 3 comments · Fixed by #2395
Closed

MPSC Channel test case times out. #1286

YoshikiTakashima opened this issue Jun 16, 2022 · 3 comments · Fixed by #2395
Labels
[E] Performance Track performance improvement (Time / Memory / CPU)

Comments

@YoshikiTakashima
Copy link
Contributor

YoshikiTakashima commented Jun 16, 2022

Tracking issue

Originally posted by @danielsn in #1285 (comment)

Running

./scripts/kani mpsc.rs

on the following code times out as of Kani 0.4.0 on M1 Mac, cargo 1.63.0-nightly (85e457e15 2022-06-07). Note that kani::unwind(1) fails to verify, and kani::unwind(2) or not putting an unwind limit leads to timeout.

// mpsc.rs
use std::sync::mpsc::*;

static mut CELL: i32 = 0;

struct DropSetCELLToOne {}

impl Drop for DropSetCELLToOne {
    fn drop(&mut self) {
        unsafe {
            CELL = 1;
        }
    }
}

#[kani::unwind(2)]
#[kani::proof]
fn main() {
    {
        let (send, recv) = channel::<DropSetCELLToOne>();
        send.send(DropSetCELLToOne {}).unwrap();
        let _to_drop: DropSetCELLToOne = recv.recv().unwrap();
    }
    assert_eq!(unsafe { CELL }, 1, "Drop should be called");
}
@tedinski
Copy link
Contributor

Just to clarify: It times out with the unwind(2)? Or it times out without it and seems weird to need it?

@YoshikiTakashima
Copy link
Contributor Author

@tedinski It's timeout with unwind(2) and no bound. So no verification success either way.

Text on original issue is also fixed.

@YoshikiTakashima YoshikiTakashima added Area: verification [E] Performance Track performance improvement (Time / Memory / CPU) labels Jun 16, 2022
@tedinski tedinski changed the title Tracking issue: MPSC Channel test case times out. MPSC Channel test case times out. Aug 26, 2022
@celinval
Copy link
Contributor

celinval commented Feb 3, 2023

Interesting, with the fix for #2164, this test passes on Mac but fails on Linux due to #1781. :(

tautschnig added a commit to tautschnig/kani that referenced this issue Apr 20, 2023
CBMC's heap allocator will produce objects that aren't just a byte array
when a prior call to `size_of` was involved in computing the number of
bytes to be allocated via malloc/calloc/realloc. This, in turn, permits
type-safe member accesses to heap-allocated objects. This should speed
up copying as well as all other operations on the resulting object
(which will then not have to go through byte extract/byte update
operations).

It also seems that there no longer is a "size_of" intrinsic.

Fixes: model-checking#1286
Fixes: model-checking#1781
tautschnig added a commit to tautschnig/kani that referenced this issue Apr 21, 2023
CBMC's heap allocator will produce objects that aren't just a byte array
when a prior call to `size_of` was involved in computing the number of
bytes to be allocated via malloc/calloc/realloc. This, in turn, permits
type-safe member accesses to heap-allocated objects. This should speed
up copying as well as all other operations on the resulting object
(which will then not have to go through byte extract/byte update
operations).

It also seems that there no longer is a "size_of" intrinsic.

Fixes: model-checking#1286
Fixes: model-checking#1781
tautschnig added a commit to tautschnig/kani that referenced this issue Apr 21, 2023
CBMC's heap allocator will produce objects that aren't just a byte array
when a prior call to `size_of` was involved in computing the number of
bytes to be allocated via malloc/calloc/realloc. This, in turn, permits
type-safe member accesses to heap-allocated objects. This should speed
up copying as well as all other operations on the resulting object
(which will then not have to go through byte extract/byte update
operations).

It also seems that there no longer is a "size_of" intrinsic.

Fixes: model-checking#1286
Fixes: model-checking#1781
tautschnig added a commit to tautschnig/kani that referenced this issue Apr 21, 2023
CBMC's heap allocator will produce objects that aren't just a byte array
when a prior call to `size_of` was involved in computing the number of
bytes to be allocated via malloc/calloc/realloc. This, in turn, permits
type-safe member accesses to heap-allocated objects. This should speed
up copying as well as all other operations on the resulting object
(which will then not have to go through byte extract/byte update
operations).

It also seems that there no longer is a "size_of" intrinsic.

Fixes: model-checking#1286
Fixes: model-checking#1781
tautschnig added a commit to tautschnig/kani that referenced this issue Apr 24, 2023
CBMC's heap allocator will produce objects that aren't just a byte array
when a prior call to `size_of` was involved in computing the number of
bytes to be allocated via malloc/calloc/realloc. This, in turn, permits
type-safe member accesses to heap-allocated objects. This should speed
up copying as well as all other operations on the resulting object
(which will then not have to go through byte extract/byte update
operations).

It also seems that there no longer is a "size_of" intrinsic.

Fixes: model-checking#1286
Fixes: model-checking#1781
tautschnig added a commit to tautschnig/kani that referenced this issue Apr 24, 2023
CBMC's heap allocator will produce objects that aren't just a byte array
when a prior call to `size_of` was involved in computing the number of
bytes to be allocated via malloc/calloc/realloc. This, in turn, permits
type-safe member accesses to heap-allocated objects. This should speed
up copying as well as all other operations on the resulting object
(which will then not have to go through byte extract/byte update
operations).

It also seems that there no longer is a "size_of" intrinsic.

Fixes: model-checking#1286
Fixes: model-checking#1781
tautschnig added a commit to tautschnig/kani that referenced this issue Apr 24, 2023
CBMC's heap allocator will produce objects that aren't just a byte array
when a prior call to `size_of` was involved in computing the number of
bytes to be allocated via malloc/calloc/realloc. This, in turn, permits
type-safe member accesses to heap-allocated objects. This should speed
up copying as well as all other operations on the resulting object
(which will then not have to go through byte extract/byte update
operations).

It also seems that there no longer is a "size_of" intrinsic.

Fixes: model-checking#1286
Fixes: model-checking#1781
tautschnig added a commit to tautschnig/kani that referenced this issue Apr 25, 2023
CBMC's heap allocator will produce objects that aren't just a byte array
when a prior call to `size_of` was involved in computing the number of
bytes to be allocated via malloc/calloc/realloc. This, in turn, permits
type-safe member accesses to heap-allocated objects. This should speed
up copying as well as all other operations on the resulting object
(which will then not have to go through byte extract/byte update
operations).

It also seems that there no longer is a "size_of" intrinsic.

Fixes: model-checking#1286
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[E] Performance Track performance improvement (Time / Memory / CPU)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants