16 Replies Latest reply on May 20, 2014 1:41 AM by blomm

    Product Licensing in Scheduled Batch

    anunn
      I have an application that selects records from a SQL Server table and geocodes the address, returning the XYs and populating fields in the row. This app was originally written for ArcGIS 9.3, later modified for 10. It was called from either a scheduled task (Server 2008) or xp_cmdshell in SQL Server (2008r2) and worked perfectly.

      But after moving to 10.1 the application no longer works from batch. It runs fine in a command window logged into the server as any user, including the account used for tasks/jobs. It stops when attempting to bind the license with the following error in the Event Log. Any ideas?


      [INDENT]Faulting application name: geocode.exe, version: 0.0.0.0, time stamp: 0x50e6f6bf
      Faulting module name: AfCore_libFNP.dll_unloaded, version: 0.0.0.0, time stamp: 0x4f920360
      Exception code: 0xc0000005
      Fault offset: 0x5963e9b0
      Faulting process id: 0x9230
      Faulting application start time: 0x01cdea912fe817ed
      Faulting application path: C:\tasks\geocode.exe
      Faulting module path: AfCore_libFNP.dll
      Report Id: 6e229a8d-5684-11e2-9618-78e7d1ec71be[/INDENT]


      Thanks,
      April
        • Re: Product Licensing in Scheduled Batch
          Wayne_Whitley
          It sounds like your compiled app worked with a module referenced that no longer exists or - I like this kind of error message, "...is no longer supported."  It seems because you upgraded your exe cannot interact with ArcGIS as before...so my suggestion is if it is any way possible, to 'rewrite' the code in Python (or scripting of your choice) or recompile it after you debug it in VS (provided you have source code).

          Hope that helps...sorry I have only a suggested 'cure' and not the antidote.
          • Re: Product Licensing in Scheduled Batch
            anunn
            I've considered rewriting in Python but i'm not sure that will be the fix. The dll referenced in the error does exist, and does not throw an error when run from command prompt. Only in a batch situation does this error occur. What would make the batch Python any different?

            Thanks,
            April
            • Re: Product Licensing in Scheduled Batch
              Wayne_Whitley
              hmmmm, see what you mean...I'd be interested to know what this line means, why would this dll be a problem?:

              Faulting module path: AfCore_libFNP.dll
              • Re: Product Licensing in Scheduled Batch
                Wayne_Whitley
                ...apparently that's a Flexnet dll?  So you have a system problem, is that concerning the license manager?...did you get that far in troubleshooting, see this for example:

                http://systemexplorer.net/file-database/file/afcore_libfnp-dll
                • Re: Product Licensing in Scheduled Batch
                  dotunited
                  I've considered rewriting in Python but i'm not sure that will be the fix. The dll referenced in the error does exist, and does not throw an error when run from command prompt. Only in a batch situation does this error occur. What would make the batch Python any different?

                  Thanks,
                  April


                  Hi April,

                  We are having the same problem, but with a windows-service. It runs fine from command-prompt with an exe. But as soon as we put it back in the service we get THE EXACT same message as you.

                  Did you solve it? (Pleeease say you did...) :)
                  • Re: Product Licensing in Scheduled Batch
                    rlwatson
                    Running a program in the context of a service is not, in general, the same as running it from the command line.

                    One key difference is that services are often run using the System account.  That account is special in that it is very powerful on the local machine but it has no network rights, e.g. you cannot access a UNC share.

                    Another difference is that services run in Windows session 0 which has many implications.  One implication is that there is no UI.  Attempts to do things like display a message box will, depending the API, either hang the process or generate an exception.

                    There are other, more subtle differences, as well.

                    One thing that you can do to help figure this out is to use the SysInternals psexec utility:

                    http://technet.microsoft.com/en-us/sysinternals/bb897553

                    You will want to check out the "-i 0" and the -s switches.  If you Google on these keywords then you will find a lot of useful articles.

                    Another trick is to use the Sysinternals Process Explorer utility to look you process.  What you want to do is to look at the details of the process properties.  It will show all the security information, environment variables, etc. related to the process.  For example, perhaps the PATH environment variable is different.
                    • Re: Product Licensing in Scheduled Batch
                      dotunited
                      Running a program in the context of a service is not, in general, the same as running it from the command line.

                      One key difference is that services are often run using the System account.  That account is special in that it is very powerful on the local machine but it has no network rights, e.g. you cannot access a UNC share.



                      Our service in running under user-account with the correct privs. It is the same user we test with command-exe.

                      EDIT: Nooooo. Apparently it was not the correct privs as when i changed to my admin-account. It worked! Our service-account had been downgraded on the test-machine OR 10.1 demands more of the account running the service and binding the license, then earlier versions. THANKYOU!
                      • Re: Product Licensing in Scheduled Batch
                        anunn
                        Hi April,

                        We are having the same problem, but with a windows-service. It runs fine from command-prompt with an exe. But as soon as we put it back in the service we get THE EXACT same message as you.

                        Did you solve it? (Pleeease say you did...) :)


                        Yes I did, after determining the problem was permissions on the service account (as related in the other post). But another issue I ran into was our security team - service accounts aren't allowed the necessary privileges here, and I am required to use a security account for scheduled jobs. So I re-wrote my app to use locator and map services instead of accessing the database directly. It might be a smidge slower but speed really isn't an issue in our use.

                        Glad you got it fixed,

                        April
                        • Re: Product Licensing in Scheduled Batch
                          dotunited
                          Yes I did, after determining the problem was permissions on the service account (as related in the other post). But another issue I ran into was our security team - service accounts aren't allowed the necessary privileges here, and I am required to use a security account for scheduled jobs. So I re-wrote my app to use locator and map services instead of accessing the database directly. It might be a smidge slower but speed really isn't an issue in our use.

                          Glad you got it fixed,

                          April


                          Hi April,

                          Would you know the exact privileges the account need?

                          Thanks
                          Johan
                          • Re: Product Licensing in Scheduled Batch
                            anunn
                            Not exactly, but something to do with logon. I was told very little by the security team. Maybe there are more details in the link on the other post???

                            Sorry,

                            April
                            • Re: Product Licensing in Scheduled Batch
                              anaalvarez
                              Not exactly, but something to do with logon. I was told very little by the security team. Maybe there are more details in the link on the other post???

                              Sorry,

                              April


                              Hello,

                              I have the same problem. Does anyone know the permissions required to run Python from a scheduled task?

                              Thanks,
                              Ana
                              • Re: Product Licensing in Scheduled Batch
                                jkub
                                The Esri development team gave me a fix.

                                The issue here is that the FLEXnet Licensing Service (which Esri now uses at 10.1, but was not used in 10.0) doesn�??t have the proper execution permissions set to it such that the �??Network Service�?� account can start it.

                                Esri working on a patch, but in the meantime, there is a manual workaround:

                                1. Ensure that you are logged in as a user with administration privileges on the machine.

                                2. From the windows Start menu, select run and enter �??cmd�??. Right-click on �??cmd.exe�?� and select �??Run as Administrator.�?�

                                3. In the command prompt, run the following command:
                                sc sdshow "FLEXnet Licensing Service"

                                This will print out the DACL permissions that are registered with that service:
                                D:(D;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;NU)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;SY)(A;;CCLCSWRPLOCRRC;;;IU)S:(AU;FA;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;WD)

                                We need to insert �??(A;;CCLCSWRPWPDTLOCRRC;;;WD)�?� into the permission string, such that it becomes:
                                D:(D;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;NU)(A;;CCLCSWRPWPDTLOCRRC;;;WD)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;SY)(A;;CCLCSWRPLOCRRC;;;IU)S:(AU;FA;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;WD)
                                NOTE:  The user�??s DACL string may vary, and edits to the string should be done carefully.

                                4. To register the DACL with the service run the command:
                                sc sdset "FLEXnet Licensing Service" ${your original DACL string with the new permission string inserted}

                                For the example above you would enter:
                                sc sdset "FLEXnet Licensing Service" D:(D;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;NU)(A;;CCLCSWRPWPDTLOCRRC;;;WD)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;SY)(A;;CCLCSWRPLOCRRC;;;IU)S:(AU;FA;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;WD)

                                5. You should see a [SC] SetServiceObjectSecurity SUCCESS. That's it. Network Service should now run without error.
                                • Re: Product Licensing in Scheduled Batch
                                  jkub
                                  I don't know why my last post added strange unhappy face characters.

                                  Please look at my other post at:
                                  http://stackoverflow.com/questions/15051467/arcgis-10-1-net-windows-service

                                  This is the same information without the unhappy face symbols.
                                  • Re: Product Licensing in Scheduled Batch
                                    kenbuja
                                    You can avoid those symbols by putting the text in one of the wrappers such as CODE or QUOTE. The text interpreter transforms groups of characters such as : followed by ( as :(
                                    • Re: Product Licensing in Scheduled Batch
                                      emelinerenz
                                      Just to chime in here...

                                      I was running a BAT script from Task Scheduler that called a python script. I could run it from Windows Explorer or the command line, but it was failing with the same error when running from Task Scheduler, "Faulting module name: AfCore_libFNP.dll_unloaded".

                                      In the BAT file, I was referencing:
                                      <Drive>:\Python27\ArcGIS10.1\python.exe

                                      When I changed the path to:
                                      <Drive>:\Python27\ArcGISx6410.1\python.exe

                                      the Task ran successfully.

                                      If you are running the app on a 64-bit server, try using the x64 directory path to python.exe instead. Worked for me.
                                      • Re: Product Licensing in Scheduled Batch
                                        blomm
                                        Hi

                                        I am not using the LM service... my arcmap install on this box is stand-alone.

                                        Everything runs when the user has admin permissions, but I cannot determine where permissions need to be set so that I can run the sched task without admin permissions.

                                        Does anyone know which folders are read to get the licensing for a stand-alone install?

                                        I'm using process monitor, but it's not raising any alarm bells.

                                        I did notice in my reg keys that FlexNetService was set to true.. i tried making this false and re-running but no luck.

                                        Thanks,
                                        Mike