upenn-acg/ProcessCache

Failure to sereliaze/deserialize cache

Closed this issue · 3 comments

After implementing #57. I'm currently seeing the following error:

Error: io_tracker::run_tracer_and_tracee(): Failed while tracing program. file: src/main.rs, line: 86.

Caused by:
    0: io_tracker::execution::trace_program(): Unable to serialize execs to our cache file. file: src/execution.rs, line: 54.
    1: io_tracker::cache::serialize_execs_to_cache(): Cannot write to cache location: "./IOTracker/cache/cache". file: src/cache.rs, line: 815.
    2: No such file or directory (os error 2)

Basically. We cannot create the cache file because the directories don't exist: "./IOTracker/cache/cache". We need to make sure the directories IOTracker/ and cache/ exist. Probably using:

    Recursively create a directory and all of its parent components if they are missing.
    Examples
    use std::fs;
    fs::create_dir_all("/some/dir")?;

Similarly I expect:

let exec_struct_bytes = fs::read("./research/IOTracker/cache/cache").expect("failed");`

To fail on my system.

I can fix this to make it create the proper directories and not use the ./research/IOTracker/cache/cache hard coded path?

One question: Are you calling P$ from outside the project directory? The path ./research/IOTracker/cache/cache lends me to believe you are? I have been calling P$ from cargo run -- ARGS.

krs85 commented

I can fix this to make it create the proper directories and not use the ./research/IOTracker/cache/cache hard coded path?

Yep, this is the solution!

One question: Are you calling P$ from outside the project directory? The path ./research/IOTracker/cache/cache lends me to believe you are? I have been calling P$ from cargo run -- ARGS.

Yes, I am, you are correct. This is just a continuation of my hard-coded paths you saw from the last PR 😬 Oops! It's funny how much tunnel vision you can get when you are the only one running it, so you only run it on your own machine. One of these iterations we will eliminate my hard-coded paths 😆 I think we should fix it to work so you call P$ from the project directory as cargo run -- ARGS, just like how you are running it.

Oops! It's funny how much tunnel vision you can get when you are the only one running it, so you only run it on your own machine

Definitely! I think this is why continuous integration is used so much by people. There has been times when I'm convinced a test should work anywhere, and it turns out to fail elsewhere, but works on my machine 😱

Anyways, sounds good. I'll work on fixing this minor issue today :)

Fixed by #60