alexcrichton / openssl-src-rs

Source code and logic to build OpenSSL from source
Apache License 2.0
69 stars 114 forks source link

Probabilistic compile failure on Windows Server 2016 for target i686-pc-windows-msvc #101

Open Radar3 opened 3 years ago

Radar3 commented 3 years ago

# version: openssl-src-111.15.0+1.1.1k

run: cargo build --release --target i686-pc-windows-msvc

may fail report: { code: 32, kind: Other, message: "The process cannot access the file because it is being used by another process." } at openssl-src-111.15.0+1.1.1k\src\lib.rs:456:40, which is: fs::remove_dir_all(&inner_dir).unwrap();

detail: created directoryC:/pipeline-255714-1/target/i686-pc-windows-msvc/release/build/openssl-sys-07fd305febe929f0/out/openssl-build/install/lib' Copying: libcrypto.lib to C:/pipeline-255714-1/target/i686-pc-windows-msvc/release/build/openssl-sys-07fd305febe929f0/out/openssl-build/install/lib/libcrypto.lib Copying: libssl.lib to C:/pipeline-255714-1/target/i686-pc-windows-msvc/release/build/openssl-sys-07fd305febe929f0/out/openssl-build/install/lib/libssl.lib Copying: ossl_static.pdb to C:/pipeline-255714-1/target/i686-pc-windows-msvc/release/build/openssl-sys-07fd305febe929f0/out/openssl-build/install/lib/ossl_static.pdb

--- stderr

Microsoft (R) Program Maintenance Utility Version 14.29.30133.0 Copyright (C) Microsoft Corporation. All rights reserved.

Microsoft (R) Program Maintenance Utility Version 14.29.30133.0 Copyright (C) Microsoft Corporation. All rights reserved.

Microsoft (R) Program Maintenance Utility Version 14.29.30133.0 Copyright (C) Microsoft Corporation. All rights reserved.

Microsoft (R) Program Maintenance Utility Version 14.29.30133.0 Copyright (C) Microsoft Corporation. All rights reserved.

Microsoft (R) Program Maintenance Utility Version 14.29.30133.0 Copyright (C) Microsoft Corporation. All rights reserved.

Microsoft (R) Program Maintenance Utility Version 14.29.30133.0 Copyright (C) Microsoft Corporation. All rights reserved.

thread 'main' panicked at 'called Result::unwrap() on an Err value: Os { code: 32, kind: Other, message: "The process cannot access the file because it is being used by another process." }', C:\Windows\system32\config\systemprofile.cargo\registry\src\github.com-1ecc6299db9ec823\openssl-src-111.15.0+1.1.1k\src\lib.rs:456:40 [2021-09-02 19:22:06] note: run with RUST_BACKTRACE=1 environment variable to display a backtrace [2021-09-02 19:22:06]The command "cargo build --release --target i686-pc-windows-msvc" exited with 101. `

Then I add a line before it to print var inner_dir : panic!("inner_dir {:?}", inner_dir); thread 'main' panicked at 'inner_dir "C:\\-pipeline-255714-1\\target\\i686-pc-windows-msvc\\release\\build\\openssl-sys-07fd305febe929f0\\out\\openssl-build\\build\\src"', C:\Users\Administrator\.cargo\registry\src\github.com-1ecc6299db9ec823\openssl-src-111.15.0+1.1.1k\src\lib.rs:456:9 note: run withRUST_BACKTRACE=1environment variable to display a backtrace

That means program failed during removing build\src dir.

Then I add a line to sleep 1s before rm dir, it seems resolved. # # std:: thread ::sleep(std::time::Duration::from_millis(1000));

alexcrichton commented 3 years ago

Thanks for the report. While I don't think adding a sleep is the right fix this is a known issue with MSVC's compilers where they'll run things in the background to generate things like debuginfo I believe. I think it should be fine to update the code here to either ignore the error or do something to try to resolve it.

Radar3 commented 3 years ago

Thanks for the report. While I don't think adding a sleep is the right fix this is a known issue with MSVC's compilers where they'll run things in the background to generate things like debuginfo I believe. I think it should be fine to update the code here to either ignore the error or do something to try to resolve it.

Thank You. I agree, so I just open this issue, and give my local fix, instead of commit it as a PR.