Linux cgi using shellScript results in repeat loop

Deploying to Linux? Get penguinated here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
GWC-
Posts: 1
Joined: Thu Sep 16, 2021 6:23 pm

Linux cgi using shellScript results in repeat loop

Post by GWC- » Thu Sep 16, 2021 6:50 pm

I'm in the process of converting all of our code from Runtime Revolution 2008 version engine to LC Server 9-6-4

I have a LC cgi script, which makes a call to a LC .lc file using shellScript function.

Tax rates change every year or two, and I need to support prior rates, as well as future rates that come into effect. So I have a tax rate script which checks the date being passed to it, and the location, and returns a value of the tax rate for that date and location.

To avoid having this exist in 10 different cgi apps, I programmed a shell script app to return the result, and I call it using shellScript function within the cgi.

What used to work under RunRev now breaks under LC 9. It breaks even going back to the 7-x versions.

When the user loads the CGI and it does the shellScript function, the cgi spawns a massive loop of shell instances, resulting in the machine being effectively taken down by local DOS. The cgi fails to conclude or get any result back from the .lc shell script. I have to kill the cgi process, and then manually kill all of the shell processes that were spawned. If enough time passes from when the cgi was executed and when I kill it, I have many hundreds of instances spawned.

The issue seems to be in the .lc shell script, not the cgi, because if I exchange out the engine being used on the cgi from LC8-1-10 to RunRev 2008, it fails. If I change out the engine being used on the .lc shell script from LC8-1-10 to RunRev2008, it works fine. However, I can't have RunRev dangling around, I want to convert everything to latest LC.

In short:
1. .lc shell script triggered by a LC cgi, both using 8-1-10, shell script runs infinitely and spawns hundreds of processes.
2. .lc shell script (RunRev2008) triggered by LC cgi (8-1-10), shell script runs fine, returns result to cgi, and terminates.

Is there a bug that I found? Was the way of running shell scripts changed from RunRev2008 to LC?

Snippet of code:

Old RunRev .lc file (returnTaxRate) that returns the tax rates (there is no repeat loop in the code at all)
#!revolution -ui

startup

on startup
put $1 into province
put $2 into theTime
if theTime is a number then
if theTime > "0" then
put theTime into x
...

Section of the code that calls the above .lc file using shell:

put ''revolution -ui returnTaxRate ''&province&theTime into shellScript
put shell(shellScript) into theData

Post Reply

Return to “Linux”