microsoft / vcpkg

C++ Library Manager for Windows, Linux, and MacOS
MIT License
23.27k stars 6.42k forks source link

[mesa] win_FLEX.exe has races in %TEMP% that cause sporadic build failures. #29139

Open BillyONeal opened 1 year ago

BillyONeal commented 1 year ago

Host Environment

To Reproduce

Steps to reproduce the behavior: https://dev.azure.com/vcpkg/public/_build/results?buildId=84018

This has been intermittently failing in CI. Usuaully with crashes; this is the first time we got something that tries to explain what happened.

Installing 1393/2048 mesa:x86-windows...
Building mesa[core,default-features,gles1,gles2,opengl]:x86-windows...
-- Downloading https://gitlab.freedesktop.org/mesa/mesa/-/archive/mesa-22.1.7/mesa-mesa-22.1.7.tar.gz -> mesa-mesa-mesa-22.1.7-1.tar.gz...
-- Extracting source D:/downloads/mesa-mesa-mesa-22.1.7-1.tar.gz
-- Applying patch def-fixes.patch
-- Applying patch clover.patch
-- Using source at D:/buildtrees/mesa/src/esa-22.1.7-39303a924c.clean
-- Setting up python virtual environmnent...
-- Installing python packages: setuptools;mako
-- Setting up python virtual environmnent...finished.
-- Found external ninja('1.11.0').
-- Getting CMake variables for x86-windows
-- Configuring x86-windows-dbg
-- Using cached msys-mingw-w64-i686-pkg-config-0.29.2-3-any.pkg.tar.zst.
-- Using cached msys-mingw-w64-i686-libwinpthread-git-9.0.0.6373.5be8fcd83-1-any.pkg.tar.zst.
-- Using msys root at D:/downloads/tools/msys2/9a1ec3f33446b195
-- Configuring x86-windows-dbg done
-- Configuring x86-windows-rel
-- Configuring x86-windows-rel done
-- Package x86-windows-dbg
-- Package x86-windows-rel
CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:112 (message):
    Command failed: "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/Common7/IDE/CommonExtensions/Microsoft/CMake/Ninja/ninja.exe" install -v
    Working Directory: D:/buildtrees/mesa/x86-windows-rel
    Error code: 1
    See logs for more information:
      D:\buildtrees\mesa\package-x86-windows-rel-out.log

Call Stack (most recent call first):
  scripts/cmake/vcpkg_install_meson.cmake:33 (vcpkg_execute_required_process)
  ports/mesa/portfile.cmake:117 (vcpkg_install_meson)
  scripts/ports.cmake:147 (include)

error: building mesa:x86-windows failed with: BUILD_FAILED
Elapsed time to handle mesa:x86-windows: 57.88 s

D:\buildtrees\mesa\package-x86-windows-rel-out.log has:

[87/901] "D:/downloads/tools/win_flex/2.5.25\win_flex.EXE" "--wincompat" "-DYY_USE_CONST=" "-o" "src/compiler/glsl/glcpp/glcpp-lex.c" "../src/esa-22.1.7-39303a924c.clean/src/compiler/glsl/glcpp/glcpp-lex.l"
FAILED: src/compiler/glsl/glcpp/glcpp-lex.c 
"D:/downloads/tools/win_flex/2.5.25\win_flex.EXE" "--wincompat" "-DYY_USE_CONST=" "-o" "src/compiler/glsl/glcpp/glcpp-lex.c" "../src/esa-22.1.7-39303a924c.clean/src/compiler/glsl/glcpp/glcpp-lex.l"
win_flex.EXE: error deleting file C:\Users\AzDevOps\AppData\Local\Temp\~flex_out_main_2

Ideally we would fix this to put these temporary files in a location where they won't be broken by parallelism.

Neumann-A commented 1 year ago

I think the [mesa] in the title is wrong. It could happen in any port using win_flex or not? It is just observed in the mesa port.

dg0yt commented 1 year ago

How many ports do multiple non-serialized runs of win_flex? ~The parallelism between debug and release could be resolved quite easily - there seems to be a specific environment variable for the tool's temporary dir.~(Not used for the build step.)

BillyONeal commented 1 year ago

I think the [mesa] in the title is wrong. It could happen in any port using win_flex or not? It is just observed in the mesa port.

I don't know. Maybe? I just remember seeing it in Mesa.

rasmusbonnedal commented 1 year ago

We are having the same problem building https://github.com/AcademySoftwareFoundation/OpenShadingLanguage with win_flex.

dg0yt commented 1 year ago

https://github.com/lexxmark/winflexbison/issues/86 is closed, but there is no new release yet.

dg0yt commented 1 year ago

It could happen in any port using win_flex or not? It is just observed in the mesa port.

I don't know. Maybe? I just remember seeing it in Mesa.

Just observed for libpq.

dg0yt commented 1 year ago

Just observed for libpq.

And again. Normally hidden by the fact vcpkg CI doesn't build the programs, invisible together with other issues...

github-actions[bot] commented 12 months ago

This is an automated message. Per our repo policy, stale issues get closed if there has been no activity in the past 180 days. The issue will be automatically closed in 14 days. If you wish to keep this issue open, please add a new comment.

MonicaLiu0311 commented 11 months ago

It appears again: Pipelines - Run 20231219.1 (azure.com)

JonLiu1993 commented 8 months ago

It appears again: Pipelines - Run 20240316.2 (azure.com)

m-kuhn commented 6 months ago

Experienced the same (outside vcpkg), I switched to the older version 2.5.24 and it is running stable so far

github-actions[bot] commented 1 week ago

This is an automated message. Per our repo policy, stale issues get closed if there has been no activity in the past 180 days. The issue will be automatically closed in 14 days. If you wish to keep this issue open, please add a new comment.