PyRFC icon indicating copy to clipboard operation
PyRFC copied to clipboard

Error code 4294967295 when running in Azure Pipeline

Open ecampuss opened this issue 4 years ago • 9 comments

Describe the bug I am successfully executing the script in my local machine, however when I try to run the same script in Azure Pipeline, I get the error message below in the "import pyrfc" (line 1) statement.

"The process 'C:\hostedtoolcache\windows\Python\3.9.9\x64\python.exe' failed with exit code 4294967295"

To Reproduce TO reproduce the error, create a CI or CD in Azure DevOps considering the prerequisites of downloading NWRFCSDK folder to it, defining the PATH for NWRFCSDK folder and install lastest version of pyrfc package, using python 3.9 version in a win2019 agent.

Screenshots Azure Pipeline details image

image

image

Error Message during Python Script's execution image

Environment

  • OS: Azure CI/CD with win2019 server agent and Azure CI/CD with win2022 server agent
  • Running in docker? Yes, running in Azure DevOps Pipelines
  • PyRFC version tried with 2.4.2 and latest version 2.5.0

Additional context If I comment the import statement of pyRFC package and also the Connection function statement in the code, the CI/CD flow completes successfully.

ecampuss avatar Dec 06 '21 20:12 ecampuss

Which exactly docker image is used, can you share the Dockerfile to reproduce the issue?

bsrdjan avatar Dec 08 '21 06:12 bsrdjan

Hi @bsrdjan, I am not using docker image, but using Microsoft hosted Windows agent. I tried using agent with win server 2019 and win server 2022 agents, but both returned the same error.

Step 1 - Initialize job.log

ecampuss avatar Dec 08 '21 12:12 ecampuss

Hi @ecampuss,

PyRFC is not tested on hosted Windows agents and I am not sure if that platform is supported.

Could you please confirm if Windows hosted agents are identical to Windows server platforms supported by NWRFC SDK: https://launchpad.support.sap.com/#/notes/2573790 ?

Assuming NWRFC SDK is supported on hosted agents, some possibilities might be:

  • PATH set to wrong folder, like to NWRFC SDK root folder, instead of NWRFC SDK lib folder, containing dlls
  • User running the process does not have permissions for NWRFC SDK lib folder. It happens on IIS servers for example: https://github.com/SAP/PyRFC/issues/75#issuecomment-412964343
  • NWRFC SDK 32 bit package installed instead of 64 bit

I would also try the build from source installation, like described here: https://github.com/SAP/PyRFC#download-and-installation

The prerequisites are pip install cython wheel and you can add the -v switch for the verbose installation log:

pip install -v pyrfc --no-binary :all:

bsrdjan avatar Dec 08 '21 13:12 bsrdjan

Windows hosted agent has all pre-requisites as I have in my local machine (which is working fine with py 3.9 and pyrfc 2.4.2).

I didn't set PATH due to the below statement in the readme.md and as I am using py 3.9 in the agent pool: "Due to a change introduced with Python 3.8 for Windows, PATH directories are no longer searched for DLL. The SAP NWRFC SDK lib path is no longer required on PATH, for Python >= 3.8."

Also, I don't know yet how to validate or change the agent's permission, but I am not downloading the SDK files in C:\ but in D:\ folders.

Do you know if the package works with Docker image?

ecampuss avatar Dec 08 '21 16:12 ecampuss

Due to a change introduced with Python 3.8 for Windows, PATH directories are no longer searched for DLL. The SAP NWRFC SDK lib path is no longer required on PATH, for Python >= 3.8

RFC SDK libs are found using SAPNWRFC_HOME env variable, pointing to RFC SDK root folder absolute path:

https://github.com/SAP/PyRFC/blob/main/src/pyrfc/init.py#L14

According to screenshots it looks correct and the cause might be user permissions or something else.

The build from source installation would help clarify if RFC SDK can be found and loaded during PyRFC build on agent platform. If it fails, the compiler error message might be more descriptive than the 4294967295 code (0xFFFFFFFF btw.)

The PyRFC works in docker containers and here are some of them: https://github.com/SAP/fundamental-tools/tree/main/docker

bsrdjan avatar Dec 09 '21 11:12 bsrdjan

I installed the package from source installation (powershell log attached), but the erro is still the same when running the python script. tasklog_7.log

ecampuss avatar Dec 09 '21 14:12 ecampuss

Hi ecampuss,

two things that come to my mind:

  1. Can you check in "Software and Programs" (or however this is called in this Windows version), whether the "Microsoft Visual C++ 2013 Redistributable" is installed? If not, you can install the latest version from here (make sure to choose the correct 32 or 64 bit version depending on or NW RFC installation): https://support.microsoft.com/en-us/help/4032938

  2. In the bin directory of the SDK there is a program named rfcexec.exe. Just start that without any parameters. If the sapnwrfc.dll cannot be loaded, we should hopefully see a meaningful errror message from the operating system. If everything is ok, we should see an error message from rfcexec.exe itself, complaining about missing logon parameters.

Best Regards, Ulrich

Ulrich-Schmidt avatar Dec 10 '21 07:12 Ulrich-Schmidt

Hello guys,

I believe the error I was receiving are related with the authorizations of the Azure Pipeline. So I am waiting my teammate to update the agent's authorizations to test again the whole scenario. I will post the result here when I have any feedback.

BR, Erick Campus

ecampuss avatar Jan 11 '22 13:01 ecampuss

Hi Erik,

any update in the meantime

Regards, Srdjan

bsrdjan avatar Mar 29 '22 09:03 bsrdjan

Please re-open if needed

bsrdjan avatar Sep 02 '22 06:09 bsrdjan