Build Hanging Even After Script Exits

Muhammad Rehan Saeed's Avatar

Muhammad Rehan Saeed

06 Jun, 2018 09:31 AM

My build script completes and returns an exit code of 0 but the AppVeyor build hangs and does not complete itself. Eventually timing out after an hour. What could be causing this?

https://ci.appveyor.com/project/RehanSaeed/templates/build/417

  1. Support Staff 1 Posted by Ilya Finkelshte... on 06 Jun, 2018 04:33 PM

    Ilya Finkelshteyn's Avatar

    Hi Muhammad,

    First let us try to isolate if it is related to the code change or recent build worker image update. For that do the following two simple experiments:

    • Open last good build and press RE-BUILD COMMIT

    • In the current version of YAML replace image: Visual Studio 2017 with image: Previous Visual Studio 2017.

    Let us know what you found and we will determine the next steps.

    Ilya.

  2. 2 Posted by Muhammad Rehan ... on 07 Jun, 2018 10:39 AM

    Muhammad Rehan Saeed's Avatar

    Last good build still succeeded.
    I can't use the previous VS 2017 because I am using .NET Core 2.1.

  3. Support Staff 3 Posted by Ilya Finkelshte... on 08 Jun, 2018 07:52 AM

    Ilya Finkelshteyn's Avatar

    Just FYI -- we forked your project and trying to root cause. Will update soon.

  4. 4 Posted by Muhammad Rehan ... on 08 Jun, 2018 07:59 AM

    Muhammad Rehan Saeed's Avatar

    Excellent thanks!

  5. Support Staff 5 Posted by Owen McDonnell on 09 Jun, 2018 12:46 AM

    Owen McDonnell's Avatar

    Do you know if the cake bootstrapper pacakges.config you use (which looks emphatically deprecated by the way) updates apace with cake releases? If so, it seems that your builds started breaking around the new 0.28.0 release.

    It's not immediately apparent to me how you could pin an earlier version of cake to test. Any ideas?

  6. 6 Posted by Muhammad Rehan ... on 09 Jun, 2018 06:13 AM

    Muhammad Rehan Saeed's Avatar
  7. Support Staff 7 Posted by Owen McDonnell on 09 Jun, 2018 06:12 PM

    Owen McDonnell's Avatar

    I've tried to locally rebuild several of your previous commits and various combinations and from them it seems that once the target framework changed to netcoreapp2.1 and the sdk to 2.1.300, there is some problem with cake killing .net core processes.

    To reproduce choose any commit after said .net core upgrade and run the build script. Open task manager or process explorer and see .net core processes. They remain when the script returns. If you run it again, more are created. I believe this is irrespective of what version of cake is being used.

  8. 8 Posted by Muhammad Rehan ... on 12 Jun, 2018 08:17 AM

    Muhammad Rehan Saeed's Avatar

    When I run .\build.ps1 locally, the cake script runs and exits perfectly. I only get the issue on AppVeyor for some reason.

    I've also raise the following Cake issue:

    https://github.com/cake-build/cake/issues/2189

  9. Support Staff 9 Posted by Ilya Finkelshte... on 12 Jun, 2018 08:51 AM

    Ilya Finkelshteyn's Avatar

    Yesterday we closed somehow similar issue with setting -maxthreads 1 for xunit console. I understand that this is different situation, because Cake and .NET Core tests are involved here, but I still have feeling that this can be issue related to multi threading. Sorry for vague comment, we will continue investigating. Any ideas are highly appreciated.

  10. 10 Posted by Muhammad Rehan ... on 12 Jun, 2018 09:04 AM

    Muhammad Rehan Saeed's Avatar

    I set max threads to 1 in the build below but it's still hanging:

    https://ci.appveyor.com/project/RehanSaeed/templates/build/436

  11. 11 Posted by Muhammad Rehan ... on 14 Jun, 2018 03:39 PM

    Muhammad Rehan Saeed's Avatar

    I managed to work around this issue by adding the following to my cake script:

    Teardown(context =>
    {
        // Appveyor is failing to exit the cake script.
        if (AppVeyor.IsRunningOnAppVeyor)
        {
            foreach (var process in Process.GetProcessesByName("dotnet"))
            {
                process.Kill();
            }
        }
    });
    

    How does AppVeyor decide to end the build?

  12. Support Staff 12 Posted by Ilya Finkelshte... on 15 Jun, 2018 04:52 PM

    Ilya Finkelshteyn's Avatar

    If any of steps in pipeline return exit code other than 0, build fails. Otherwise succeed.

    AppVeyor has custom implementation of PowerShell's PSHost in which commands like Cake script runs. What happened here is those handing processes do not let it exit command execution.

    Did you see Martin's investigation?

  13. 13 Posted by Muhammad Rehan ... on 16 Jun, 2018 12:39 PM

    Muhammad Rehan Saeed's Avatar

    Yes, it seems my code is not at fault. Hurrah! I'll wait for Cake to put in a fix and use the workaround in the mean time. Thanks for your efforts.

  14. 14 Posted by gep13 on 16 Jun, 2018 08:06 PM

    gep13's Avatar

    Muhammad,

    Can you confirm what sort of fix you are looking for in Cake here? Surely this would be a fix required in the dotnet cli? I don't see what we, as the Cake Team, could do here.

    Gary

  15. 15 Posted by Muhammad Rehan ... on 18 Jun, 2018 08:13 AM

    Muhammad Rehan Saeed's Avatar

    Looks like we have to wait for the dotnet CLI to fix this [bug](https://github.com/dotnet/roslyn/issues/27566), in the mean time, my workaround is working for me.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

 

18 Aug, 2018 11:54 AM
18 Aug, 2018 12:13 AM
17 Aug, 2018 06:02 PM
17 Aug, 2018 04:26 PM
17 Aug, 2018 04:04 PM
17 Aug, 2018 06:31 AM