Failures with FinalBuilder 8 running from a non-logged in scheduled task which worked with FinalBuilder 7

Hi all

I’ve recently switched our automated builds from FB7 to FB8 in preparation for using Delphi 10.
Now all our scheduled tasks that use FBCMD.exe instantly fail with error code 1.

The OS is Windows Server 2012 R2 and the FinalBuilder version(s) are 8.0.0.1780 and 7.0.0.3486 respectively.

If I change the scheduled task to only run when logged in, they run as normal.
If I switch back to FBCmd.exe from version 7, they run as normal whether the tasks are set to run logged in or not.

I’m previously ran into the Server 2012 R2 user profile issue, but per the advice from Vince, I’d added the necessary environment variable workarounds which allows FB7 to run happily. I’ve also recently applied the MS hot fix for the Server 2012 scheduler issue.

Are there any switches I can add to get more error details from FBCmd.exe which indicate what version 8 doesn’t like that version 7 is OK with?
Alternatively, are there any plans to backport the Delphi 10 action support to FB7?

Cheers,
  Paul.

Hi Paul

Exit code 1 is ERR_BUILDFAILED which suggests the project did run. If you open the project and look at the build log what does it show? Also, check the users %temp% directory, is there are “finalbuilder BugReport.txt” file there? As far as I know, nothing has changed in FBCMD that would affect this.

I tested here on a server 2012R2 machine and it works as expected (whether logged in or not).

Hi Vince

No, nothing turns up in the Build History and there is no Finalbuilder Bugreport.txt in the %TEMP% directory.
However, there is a NexusDB_TemporaryStorage.tmp file left behind in the %TEMP% directory.

Here is the Test.CMD file I’m using in my Scheduled task test.

DEL test.txt
ECHO TEMP %TEMP% >>test.txt
ECHO Profile %USERPROFILE% >>test.txt

ECHO “C:\Program Files (x86)\FinalBuilder 8\FBCmd.Exe” >>test.txt
"C:\Program Files (x86)\FinalBuilder 8\FBCmd.Exe" >>test.txt
IF ERRORLEVEL 1 Goto Error
ECHO Done >>test.txt
GOTO Fini

:Error
ECHO Error %ERRORLEVEL% >>test.txt

:Fini
ECHO. >>test.txt


When run logged in, it outputs this into test.txt:

TEMP C:\Users\ADMINI~1.ACC\AppData\Local\Temp\2
Profile C:\Users\administrator.ACCREDO
“C:\Program Files (x86)\FinalBuilder 8\FBCmd.Exe”
******************************************************************
 FinalBuilder 8 - Copyright © 2001-2015 VSoft Technologies Pty Ltd
 Version: 8.0.0.1780
 Professional Edition

[…snip usage…]
 
Exit with return code: 2 (INVALIDARGS)

Error 2
 
When run not logged in, it just outputs this into test.txt:

TEMP C:\Users\ADMINI~1.ACC\AppData\Local\Temp
Profile C:\Users\administrator.ACCREDO
“C:\Program Files (x86)\FinalBuilder 8\FBCmd.Exe”
Error 1
 
Note that no Finalbuilder banner message is output, nor does it error that no project was specified.
It’s guessing it’s failing before it loads the (missing) project which would be why nothing ends up in the build history even if one is specified.

If I switch to executing FBCmd.Exe from FinalBuilder 7, the test.txt contents are identical apart from the different TEMP directory i.e. the banner message is output and then error code 2.

So I’m left wondering if the error code 1 is actually from Windows i.e. ERROR_INVALID_FUNCTION rather than Finalbuilder but why?!?

Cheers,
  Paul.

I’ve since simplified my testcase and reproduced the error code 1 issue by simply running FBCmd.exe directly from a scheduled task without the batch file and just observing the Last Result.

I can see FBCMD.exe being launched via process explorer and then promptly exiting.

So I had a look at the two FBCmd.exe instances, the one in the FinalBuilder 7 directory and the one in the FinalBuilder 8 directory.

The FB8 version of FBCmd.exe is smaller (900,096 bytes vs. 1,241,840) and unlike the FB7 version, has no icon and is not digitally signed.

Does that sound correct? I wonder if the lack of digital signature is impacting it’s ‘not logged in’ execution in some way.

As an aside, all the FB7 applications are dual-signed (sha1 and sha256) whereas the FB8 applications that are signed (i.e. ActionStudio.exe,FinalBuilder8.exe, not FBCmd.exe) are single-signed (sha256 only).

I note that FB8 is also using seperate .config files which I assume are the manifests, unlike FB7 which doesn’t.

Hi Paul

Looks like there may be an issue with our build process, because FBCMD.exe should definitely be signed. The icon is not an issue, I recall removing it since it isn’t needed for a console tool.

The reason FB7 is dual signed is because it’s supported on XP/2003, which don’t support SHA256 signatures. FB8 is not supported on XP/2003 so we only sign with SHA256 (supported on windows 7 or later). See this blog post on code signing for details : https://www.finalbuilder.com/resources/blogs/postid/742/code-signing-changes-for-2016

Hi Paul

Please try this build (only change is code signing of FBCMD) - http://downloads.finalbuilder.com/downloads/finalbuilder/800/FB800_1822.exe

Thanks for the prompt provision. Downloaded and tried and still get the instance error code 1.

Damn - that seemed like a good theory.

Hrmm… I might try ProcMon next see if record the I/O and registry activity shows anything failing.

Ok, I had a sneaking suspicion and I think I may have figured out why I’m able to reproduce this on our Windows 2012 Server and you can’t on yours.

I’m guessing you don’t have the Microsoft KB3133689 hotfix installed. https://support.microsoft.com/en-us/kb/3133689

This hotfix is meant to resolve the Task Scheduler User Profile issue that Vince pointed me at earlier. https://support.microsoft.com/en-us/kb/2968540

I uninstalled that hotfix and lo and behold, FBCmd.exe from FinalBuilder 8 now works when run ‘not logged in’ i.e. it no longer fails with error code 1.

So, it would appear FBCmd.exe from version 8 fails if that hotfix has been applied, whereas FBCmd.exe from version 7 is fine either way.

If you install that hotfix on your Windows 2012 R2 server, you may well be able to reproduce the error code 1 failures too.

It’s possible that hotfix is just problematic since I have an alternative Task Scheduler (System Scheduler) and it was also getting unexpected error code 1 failures and that have gone away since I uninstalled that hotfix.

Still if the hotfix is indeed the cause, I figure you will want to know and possibly workaround the introduced issue since other users may install that particular hotfix to resolve other scheduled task issues and then run into problems with FinalBuilder 8 like I have.

Cheers,
Paul.

Microsoft is currently reporting that the service to download this hotfix is not available. I will attempt to download this at a later date and test the issue.