Lucee/cfexecute insists on using old versions of apps in Linux

Good afternoon. I am running the following setup:

OS : Linux (4.4.0-1128-aws) 64bit
Java Version : 1.8.0_292 (Private Build) 64bit
Tomcat Version : Apache Tomcat/8.0.32 (Ubuntu)
Lucee Version : Lucee 5.3.8.201

I am running into a weird issue when using the <cfexecute> tag. Programs that run in <cfexecute> are showing old, outdated versions. I’ve upgraded the programs through the shell, (like ffmpeg and aws) to current versions, but Lucee continues to use the old versions when executed through <cfexecute>.

This is an example of a command run through my server’s shell:

$ aws --version
aws-cli/2.2.31 Python/3.8.8 Linux/4.4.0-1128-aws exe/x86_64.ubuntu.16 prompt/off

And here’s my <cfexecute> version:

<cfexecute name="aws" arguments="--version" timeout="0" errorvariable="error"></cfexecute>
aws-cli/1.18.69 Python/3.5.2 Linux/4.4.0-1128-aws botocore/1.16.19

What on earth could be causing this? I am at a total loss. Is this some kind of weird issue with aliasing? If so - I am going to need a lot of help for figuring out how to undo this mess.

Any suggestions are kindly and warmly appreciated.

As another example, when I run which aws in each, I get this:

Shell:

$ which aws
/usr/local/bin/aws

<cfexecute>:

<cfexecute name="which" arguments="aws" timeout="0" errorvariable="errorthing"></cfexecute>
/usr/bin/aws

How does Lucee determine which programs to execute? I can’t seem to find a configuration file for this, um, anywhere?

I think the shell is simply executed by the user who is accessing the shell. For cfexecute that would be the shell of the user running Tomcat.

As far as I’m aware, there is no such “special execution configuration for Lucee”, BUT… could it be possible, that you have different PATH variables set for the user running Lucee than of the shell you are accessing manually? I’d check those first and look what values these environment variables are holding for each user. Is it possible that you didn’t install/upgrade the aws software system wide (for all users)?

1 Like

When you call something via cfexecute, I don’t believe bash is involved as there’s no interactive shell. This likely skips several scripts that override local path vars when you perform the same commands from a normal bash shell. For example, you can run “ls” from cfexecute, you can’t run the common alias “ll” because it isn’t defined outside of your interactive shell.

I’m not sure how to track down the default path for your system and it may differ based on Linux distro. I do know it’s possible to pass the command you want through bash and it could be worth playing with to see if it behaves different. This is more less what CommandBox’s run command does (except I use Java’s ProcessBuilder directly which is far more powerful than cfexecute). Something like:

bash -i -c your original command

The other alternative (which is probably a bit safer) is just to use a full path to the exact binary you want so you’re depending on whatever PATH lookups exist for the user Lucee is running as. So instead of calling aws, call /usr/local/bin/aws directly.

1 Like

restart the application. its more than likely using an old binary as the core files have been updated but on NIX systems, binaries in process stay in a protected memory realm.

The “binaries” don’t stay anywhere. It’s most likely the PATH env var. And it’s not a “protected memory realm” per se. It’s simply the process’s environment which is created as a copy of the parent’s process when it spawns by the kernel. Whatever env vars were visible to the process when it spawned will stay that way until it finishes.

I m way too tired to start the whole Inode debate.

Just restart your app or don’t.

If you want to actually know why your app is running some old version

as for aws
python -c "import awscli; print(‘version:’, awscli.version, ‘root:’, awscli.file)"andsudo -u tomcat python -c “import awscli; print(‘version:’, awscli.version, ‘root:’, awscli.file)”`

or as userX vs userY
set |grep -i python

or delete userY (tomcat exec user) by rm -rf .*
then su userY
then aws-cli -v

and/ or just uninstall and reinstall via pip
pip3 uninstall awscli
pip3 install awscli

Ok, next time I will try to include descriptors for INODE ops… FINALLY, someone who gets INODE

Good afternoon. Thank you for your kind replies. Before posting I had already tried restarting the system, and also had uninstalled and re-installed the aws-cli; neither of which solved the issue. The only solution I have managed to make work is the suggestion from bdw429s to call /usr/local/bin/aws directly from the name="" argument in the tag.

In the future, I would love to re-map the aws command to the real life, existing version, but I’m not sure how to do that. I have no clue how to do this. Perhaps someday I will find out! It appears, based on using whoami from <cfexecute> that programs are executing under the tomcat8 user.

1 Like