Skip to content

CRIU RPC request failed with message: error:56 #21

@zhaohang15639535703

Description

@zhaohang15639535703
let mut criu = rust_criu::Criu::new().expect("unable to new a criu");
    match criu.get_criu_version() {
        Ok(version) => info!("criu version: {}", version),
        Err(e) => error!("{:#?}", e),
    };

    
    let image_dir = format!("images_{}", pid);
    if Path::new(&image_dir).exists() {
        warn!("image directory exists");
        if let Err(e) = std::fs::remove_dir_all(&image_dir) {
            error!("Failed to remove existing directory '{}': {:#?}", image_dir, e);
            return Err(anyhow!("remove existing directory failed"));
        }
    }
    if let Err(e) = std::fs::create_dir(&image_dir) {
        error!("Failed to create directory '{}': {:#?}", image_dir, e);
        return Err(anyhow!("create dirctory fails"));
    }

    let directory = std::fs::File::open(&image_dir)?;
    
    criu.set_pid(pid); // set target pid
    criu.set_images_dir_fd(directory.as_raw_fd()); // set temporary file
    criu.set_log_file(format!("{}/dumppp.log", image_dir));
    criu.set_log_level(4);
    criu.set_leave_running(false); // set process to stop when dumping is done

    
    // do dump
    info!("dumping process {}",pid);
    criu.dump().map_err(|e| anyhow!("dump fails:{:#?}",e))?;

When I run this code i got an error: Error: dump fails:"CRIU RPC request failed with message: error:56".Is there any solution?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions