Erratic crash of an executable with an error code 255 in a Command Line type build step
The teamcity version and server OS are TeamCity Enterprise 2018.2.4 (build 61678) and Ubuntu Linux 16.04 LTS respectively.
The executable (specifically an exe file) has been pre-compiled (Release, x64) and checked in as part of the git repository that is pulled onto the agent by the build configuration. It performs a simple validation of an installer by verifying that a set of expected files, including dlls, are present in the appropriate locations and have the correct version numbers. For the dlls, it performs the check of version number via a call to the .NET Assembly.LoadFile method and then checking the version from the loaded assembly full name and for non-dlls, it simply checks the file properties via the .NET FileVersionInfo.GetVersionInfo method.
When this executable is run via the TeamCity service by running the build configuration, it will crash at a random dll, producing an exit code 255 and no observable thrown exception (despite the presence of try-catch blocks in the executable). The agent that the executable is run on is a Windows 10 OS and the user that the service is configured to run as on this agent has full admin rights. If the agent is connected to via remote desktop and the executable is run through the command line, it completes without issue. Reviewing the Windows event log after an unsuccessful run of the build configuration shows errors from the executable with the faulting module of kernelbase.dll and no useful information provided that I could find.
From some inserted writes to the console, it would seem that the crash is generally happening around the time the dll is being loaded (but which dll, as previously noted, appears entirely random and each time a number of dlls prior to it loaded without issue). In one case, the crash actually happened a few steps after a failed dll load (which the executable allows for) but before the execution had moved on to the next file to check.
I'm at a loss for what conflict is being generated by running under the context of the TeamCity service or if the issue is something more bizarre.
Please sign in to leave a comment.
Hi Christopher,
no wonder you are at a loss, this is definitely quite strange. You mention connecting via remote desktop, do you log in with the exact same user running the build agent's process? Do you also run the exact same file (in the same path) than the teamcity process? Do you have antivirus or backup software running on this machine? Especially antivirus software might get picky if a random service is trying to load dlls into memory.
Other than that, I can only recommend following the suggestions here (some of them won't apply, just skip over them), and if nothing works, reporting the issue as suggested there: https://www.jetbrains.com/help/teamcity/common-problems.html#CommonProblems-BuildworkslocallybutfailsormisbehavesinTeamCity