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

Intermittent "Permission denied" on Windows #22628

Closed
Manishearth opened this issue Feb 21, 2015 · 19 comments
Closed

Intermittent "Permission denied" on Windows #22628

Manishearth opened this issue Feb 21, 2015 · 19 comments
Labels
O-windows Operating system: Windows

Comments

@Manishearth
Copy link
Member

Example: http://buildbot.rust-lang.org/builders/auto-win-64-nopt-t/builds/2223

error: linking with `gcc` failed: exit code: 1
note: "gcc" '"-Wl,--enable-long-section-names"' '"-fno-use-linker-plugin"' '"-Wl,--nxcompat"' '"-static-libgcc"' '"-m64"' '"-L"' '"C:\\bot\\slave\\auto-win-64-nopt-t\\build\\obj\\x86_64-pc-windows-gnu\\stage2\\bin\\rustlib\\x86_64-pc-windows-gnu\\lib"' '"-o"' '"x86_64-pc-windows-gnu\\stage2\\test\\stdtest-x86_64-pc-windows-gnu.exe"' '"x86_64-pc-windows-gnu\\stage2\\test\\stdtest-x86_64-pc-windows-gnu.o"' '"-Wl,--gc-sections"' '"C:\\bot\\slave\\auto-win-64-nopt-t\\build\\obj\\x86_64-pc-windows-gnu\\stage2\\bin\\rustlib\\x86_64-pc-windows-gnu\\lib\\libtest-4e7c5e5c.rlib"' '"C:\\bot\\slave\\auto-win-64-nopt-t\\build\\obj\\x86_64-pc-windows-gnu\\stage2\\bin\\rustlib\\x86_64-pc-windows-gnu\\lib\\libgetopts-4e7c5e5c.rlib"' '"C:\\bot\\slave\\auto-win-64-nopt-t\\build\\obj\\x86_64-pc-windows-gnu\\stage2\\bin\\rustlib\\x86_64-pc-windows-gnu\\lib\\libterm-4e7c5e5c.rlib"' '"C:\\bot\\slave\\auto-win-64-nopt-t\\build\\obj\\x86_64-pc-windows-gnu\\stage2\\bin\\rustlib\\x86_64-pc-windows-gnu\\lib\\libserialize-4e7c5e5c.rlib"' '"C:\\bot\\slave\\auto-win-64-nopt-t\\build\\obj\\x86_64-pc-windows-gnu\\stage2\\bin\\rustlib\\x86_64-pc-windows-gnu\\lib\\liblog-4e7c5e5c.rlib"' '"C:\\bot\\slave\\auto-win-64-nopt-t\\build\\obj\\x86_64-pc-windows-gnu\\stage2\\bin\\rustlib\\x86_64-pc-windows-gnu\\lib\\libstd-4e7c5e5c.rlib"' '"C:\\bot\\slave\\auto-win-64-nopt-t\\build\\obj\\x86_64-pc-windows-gnu\\stage2\\bin\\rustlib\\x86_64-pc-windows-gnu\\lib\\libcollections-4e7c5e5c.rlib"' '"C:\\bot\\slave\\auto-win-64-nopt-t\\build\\obj\\x86_64-pc-windows-gnu\\stage2\\bin\\rustlib\\x86_64-pc-windows-gnu\\lib\\librand-4e7c5e5c.rlib"' '"C:\\bot\\slave\\auto-win-64-nopt-t\\build\\obj\\x86_64-pc-windows-gnu\\stage2\\bin\\rustlib\\x86_64-pc-windows-gnu\\lib\\liballoc-4e7c5e5c.rlib"' '"C:\\bot\\slave\\auto-win-64-nopt-t\\build\\obj\\x86_64-pc-windows-gnu\\stage2\\bin\\rustlib\\x86_64-pc-windows-gnu\\lib\\liblibc-4e7c5e5c.rlib"' '"C:\\bot\\slave\\auto-win-64-nopt-t\\build\\obj\\x86_64-pc-windows-gnu\\stage2\\bin\\rustlib\\x86_64-pc-windows-gnu\\lib\\libunicode-4e7c5e5c.rlib"' '"C:\\bot\\slave\\auto-win-64-nopt-t\\build\\obj\\x86_64-pc-windows-gnu\\stage2\\bin\\rustlib\\x86_64-pc-windows-gnu\\lib\\libcore-4e7c5e5c.rlib"' '"-L"' '"x86_64-pc-windows-gnu\\rt"' '"-L"' '"C:\\bot\\slave\\auto-win-64-nopt-t\\build\\obj\\x86_64-pc-windows-gnu\\llvm\\Release+Asserts\\lib"' '"-L"' '"C:\\bot\\slave\\auto-win-64-nopt-t\\build\\obj\\x86_64-pc-windows-gnu\\stage2\\bin\\rustlib\\x86_64-pc-windows-gnu\\lib"' '"-L"' '"C:\\bot\\slave\\auto-win-64-nopt-t\\build\\obj\\.rust\\bin\\x86_64-pc-windows-gnu"' '"-L"' '"C:\\bot\\slave\\auto-win-64-nopt-t\\build\\obj\\bin\\x86_64-pc-windows-gnu"' '"-Wl,--whole-archive"' '"-Wl,-Bstatic"' '"-Wl,--no-whole-archive"' '"-Wl,-Bdynamic"' '"-lws2_32"' '"-luserenv"' '"-lkernel32"' '"-lws2_32"' '"-luserenv"' '"-lcompiler-rt"'
note: C:/program files/mingw-w64/x86_64-4.9.1-win32-seh-rt_v3-rev1/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot open output file x86_64-pc-windows-gnu\stage2\test\stdtest-x86_64-pc-windows-gnu.exe: Permission denied
collect2.exe: error: ld returned 1 exit status

It doesn't seem to happen in the same place at every time, but basically an exe (usually stdtest) can't be opened for whatever reason.

cc @retep998 @klutzy

@klutzy
Copy link
Contributor

klutzy commented Feb 21, 2015

I've thought it's basically this: for some reason stdtest hanged at previous test, then during the second build linker fails to open exe since it's still running.
(The comment only said run-pass tests but while investigating it I also found one some ***test hanged.)

@klutzy
Copy link
Contributor

klutzy commented Feb 21, 2015

Ping @alexcrichton: I think you can access to buildbot directly. Could you dump thread/stack status of hanged process (when this occurs again) using Process Explorer? This article explains how to see list of threads and stack trace of each thread.

@kmcallister kmcallister added O-windows Operating system: Windows A-infrastructure labels Feb 21, 2015
@Manishearth
Copy link
Member Author

Seems like 99b39cc should have fixed it, but d0de2b4 broke it.

We tried b6044c7 but it caused a panic

Edit: I'm talking about the wrong failure here.

@brson
Copy link
Contributor

brson commented Feb 21, 2015

@Manishearth suspects d0de2b4 may caused the recent spike.

@brson
Copy link
Contributor

brson commented Feb 21, 2015

I added a patch to buildbot that attempts to kill everything named stdtest before running make check, and changed the max builds per windows slave to 1 rust-lang-deprecated/rust-buildbot@9911005

@brson
Copy link
Contributor

brson commented Feb 22, 2015

This is how mariadb creates buildbot jobs https://mariadb.com/kb/en/mariadb/buildbot-setup-buildbot-setup-for-windows/

@alexcrichton
Copy link
Member

@klutzy is correct in the diagnosis. The fact that stdtest hangs is pretty new to me and I haven't had the chance to investigate it much.

Note that the fix for all the tests in @klutzy's linked comment was to join on all threads. I had a patch to use scoped but it should have instead been spawn + join. @Manishearth I see a few linked commits to this issue which add calls to sleep, but I believe it is better solved with a join.

Could you dump thread/stack status of hanged process (when this occurs again) using Process Explorer? This article explains how to see list of threads and stack trace of each thread.

I took a peek, and unfortunately all I could deduce was that a thread was blocked in accept. I was unable to get any indication of which accept it was blocked in (no symbols were available).

and changed the max builds per windows slave to 1 rust-lang-deprecated/rust-buildbot@9911005

@brson, why change the max builds? I'm under the impression that the error does not come from this but rather the fact that something just hangs for too long. Killing stdtest at the start sounds like a good idea though. Note that this was my impetus for opening #22448.

@Manishearth
Copy link
Member Author

@alexcrichton We can't join() when the child has panicked. That's why I added a sleep()

@Manishearth
Copy link
Member Author

@alexcrichton Max builds has to be one, we're indiscriminately killing all stdtest processes without knowing which build they came from. Peter is working on a job object based solution so that we don't have to do that.

@alexcrichton
Copy link
Member

@alexcrichton We can't join() when the child has panicked. That's why I added a sleep()

It depends how you spawned the thread. If the thread was spawned with scoped then it will propagate the panic but if spawned with spawn you will catch the panic with a Result.

Max builds has to be one, we're indiscriminately killing all stdtest processes without knowing which build they came from

Hm ok.

@retep998
Copy link
Member

I have created a simple Rust wrapper application that uses job objects to ensure all existing processes are completely dead.
https://github.com/retep998/dojob-rs/blob/master/src/main.rs

@Manishearth
Copy link
Member Author

http://buildbot.rust-lang.org/builders/auto-win-32-nopt-t/builds/3431

note: C:/program files (x86)/mingw-w64/i686-4.9.1-win32-dwarf-rt_v3-rev1/mingw32/bin/../lib/gcc/i686-w64-mingw32/4.9.1/../../../../i686-w64-mingw32/bin/ld.exe: cannot open output file i686-pc-windows-gnu\test\run-pass\unwind-resource.stage2-i686-pc-windows-gnu.exe: Permission denied

So the diagnosis by @klutzy / @alexcrichton is correct; this test sometimes hangs and stays alive for the next build. (Though stdtest might be a separate problem)

We need to integrate dojob somehow ... @brson ?

alexcrichton added a commit to alexcrichton/rust that referenced this issue Feb 23, 2015
If these tests exit while a thread is panicking it often leads to situations
like rust-lang#22628.
@alexcrichton
Copy link
Member

@Manishearth no the fix for that problem specifically is #22723

@Manishearth
Copy link
Member Author

Yeah, I'm talking about both failures here (stdtest, and the unsafe one).

Manishearth added a commit to Manishearth/rust that referenced this issue Feb 23, 2015
…t, r=alexcrichton

 If these tests exit while a thread is panicking it often leads to situations
like rust-lang#22628.
@Manishearth
Copy link
Member Author

http://buildbot.rust-lang.org/builders/auto-win-32-nopt-t/builds/3449

rm: cannot remove ‘i686-pc-windows-gnu/stage0/bin/rustlib/i686-pc-windows-gnu/lib/syntax-4e7c5e5c.0.o’: Device or resource busy

@brson
Copy link
Contributor

brson commented Feb 24, 2015

@alexcrichton max_builds=1 because the script indiscrimanently kills anything called stdtest.

@retep998 wants me to wrap the make calls with dojob.rs, which should make buildbot kill the whole process tree. Seems like a good idea. I hope that would let us remove the taskkill hack.

@brson brson mentioned this issue Feb 24, 2015
65 tasks
@retep998
Copy link
Member

retep998 commented Mar 5, 2015

Has anyone seen this issue lately since dojob was implemented?

@alexcrichton
Copy link
Member

I have not, thanks @retep998!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-windows Operating system: Windows
Projects
None yet
Development

No branches or pull requests

6 participants