script not terminating, continues to replicate
[1/13] from: norsepower:uswest at: 5-Oct-2000 23:38
Besides the horribly inefficient code, what could be wrong with this script
(below) that would be causing problems?
My hosting service said they suspended my site because "This script has been
running constantly since the site was re-enabled, with 10 plus copies running
on each webserver. Not only does this monopolize system resources, but the
script does not terminate properly and continues to replicate. We cannot
permit scripts with programming errors on our servers as they
impact the behavior of other customer sites."
-Ryan
#!rebol -cs
REBOL [
Title: "Banner Ad Randomizer"
File: %webbanner.cgi
Date: 16-Apr-2000
Author: "Ryan Christiansen"
Purpose: {
Generate HTML code that displays a linked banner advertisement
}
]
urls: [ "http://www.schonder.com"
"http://www.abisoft.com/BePlan/PurchaseBOSJ.html"
"http://www.lebuzz.com/buzzcd_ad.html"
"http://www.bebits.com/app/867"
"http://www.bug.org.yu"
"http://www.goingware.com"
"http://www.gobe.com"
]
imgs: [ "dasbebook.gif"
"BePlan.gif"
"buzzcd_anim.gif"
"ImageProAd.gif"
"yugobug.gif"
"goingware.gif"
"gobe.gif"
]
alts: [ "Das BeBook at Papier-Schonder KG office supply and bookstore"
"BePlan from AbiSoft"
"BuzzCD - Hand-picked best BeOS software"
"ImagePro displays, zooms, and re-sizes images"
"BUG YUgoslavia"
"GoingWare, Inc. - Expert software consulting and development"
"Gobe Software"
]
heights: [ 60
59
59
59
52
60
60
]
widths: [ 468
467
467
467
115
468
468
]
random/seed now
ad: random 7
url: pick urls ad
img: pick imgs ad
alt: pick alts ad
height: pick heights ad
width: pick widths ad
print "Content-Type: text/html^/"
print rejoin [{<a href="} url {"><IMG SRC="/graphics/bannerads/} img {" ALT} alt {
target="_blank" border=0 height="} height {" width="} width {"></a>
}]
[2/13] from: brett:codeconscious at: 6-Oct-2000 16:57
I haven't done CGI but,
The script looks deterministic, but is the whole script?
Could it be that Rebol is not closing or timing out the networking
connection quickly enough?
I'm not entirely confident with this but, what if you have a client
connection that requests a the data but never takes it (drops out, filtering
proxy)?
Just some wonderings...
[3/13] from: al:bri:xtra at: 6-Oct-2000 0:20
Ryan wrote:
> Besides the horribly inefficient code, what could be wrong with this
script (below) that would be causing problems?
It could be a problem in your JavaScript? Or HTML for frames?
Andrew Martin
ICQ: 26227169
http://members.nbci.com/AndrewMartin/
[4/13] from: al:bri:xtra at: 6-Oct-2000 0:42
Ryan wrote:
> print rejoin [{<a href="} url {"><IMG SRC="/graphics/bannerads/} img {"
ALT
> "} alt {" target="_blank" border=0 height="} height {" width="} width
{"></a>
> }]
Just a suggestion, but you could add the <HTML> <HEAD> and <BODY> tags
around this code, just in case it's accessed by an older browser?
Andrew Martin
ICQ: 26227169
http://members.nbci.com/AndrewMartin/
[5/13] from: al:bri:xtra at: 6-Oct-2000 1:55
Useful things that transpose can do:
#1 - Reorganise Rebol code:
>> print mold b: transpose reduce [urls imgs alts heights widths]
[["http://www.schonder.com" "dasbebook.gif" {Das BeBook at Papier-Schonder
KG office supply and bookstore} 60 468] [
"http://www.abisoft.com/BePlan/PurchaseBOSJ.html"
"BePlan.gif"
"BePlan from AbiSoft"
59
467] [
"http://www.lebuzz.com/buzzcd_ad.html"
"buzzcd_anim.gif"
"BuzzCD - Hand-picked best BeOS software"
59
467] [
"http://www.bebits.com/app/867"
"ImageProAd.gif"
"ImagePro displays, zooms, and re-sizes images"
59
467] [
"http://www.bug.org.yu"
"yugobug.gif"
"BUG YUgoslavia"
52
115] [
"http://www.goingware.com"
"goingware.gif"
{GoingWare, Inc. - Expert software consulting and development}
60
468] [
"http://www.gobe.com"
"gobe.gif"
"Gobe Software"
60
468]]
>> pick b random length? b
== ["http://www.schonder.com" "dasbebook.gif" {Das BeBook at Papier-Schonder
KG office supply and bookstore} 60 468]
>> members: [url: img: alt: height: width:]
== [url: img: alt: height: width:]
>> print mold z: transpose reduce [members pick b random length? b]
[[url: "http://www.schonder.com"] [img: "dasbebook.gif"] [alt: {Das BeBook
at Papier-Schonder KG office supply and bookstore}]
[height: 60] [width: 468]]
>> foreach block z [do block]
== 468
>> url
== "http://www.schonder.com"
>> img
== "dasbebook.gif"
>> alt
== {Das BeBook at Papier-Schonder KG office supply and bookstore}
>> height
== 60
>> width
== 468
>> print rejoin [{<a href="} url {"><IMG SRC="/graphics/bannerads/} img {"
ALT="} alt {" target="_blank" border=0 height="} he
ight {" width="} width {"></a>}]
<a href="http://www.schonder.com"><IMG
SRC="/graphics/bannerads/dasbebook.gif" ALT="Das BeBook at Papier-Schonder
KG office su
pply and bookstore" target="_blank" border=0 height="60" width="468"></a>
Andrew Martin
Who has far too much time on his hands...
ICQ: 26227169
http://members.nbci.com/AndrewMartin/
[6/13] from: g:santilli:tiscalinet:it at: 6-Oct-2000 11:57
[Al--Bri--xtra--co--nz] wrote:
> >> pick b random length? b
> == ["http://www.schonder.com" "dasbebook.gif" {Das BeBook at Papier-Schonder
> KG office supply and bookstore} 60 468]
>
> >> members: [url: img: alt: height: width:]
> == [url: img: alt: height: width:]
I'd suggest:
set [url img alt height width] pick b random length? b
Simpler, isn't it? :-)
Regards,
Gabriele.
--
Gabriele Santilli <[giesse--writeme--com]> - Amigan - REBOL programmer
Amiga Group Italia sez. L'Aquila -- http://www.amyresource.it/AGI/
[7/13] from: al:bri:xtra at: 6-Oct-2000 3:12
Gabriele wrote:
> I'd suggest:
> set [url img alt height width] pick b random length? b
But then there's only one use of Transpose! :-) Thanks Gabriele for picking
that up.
Andrew Martin
Transposed Rebol...
ICQ: 26227169
http://members.nbci.com/AndrewMartin/
[8/13] from: norsepower:uswest at: 6-Oct-2000 8:49
The script is activated with an exec cgi statement within a server-side
include.
[9/13] from: news:ted:husted at: 6-Oct-2000 11:22
Are you able to test or replicate the problem so we know when it's
fixed?
My first suspect for a SSI/CGI bug would be the random statement.
A related question would be if the behaviour recurs if it's setup to
print a standalone page (with and without the random statement).
Of course that defeats the purpose, but it would be important to
isolate whether it only happens with SSI or not.
-Ted.
[10/13] from: jeff:rebol at: 6-Oct-2000 9:25
Howdy, Ryan.
Sorry to hear about your CGI woes.
Two considerations:
A) You are not using a REBOL/view to serve this cgi, yes?
If so, a REBOL/view would fail on boot trying to connect to
an X host that is not available. The process then hangs
out. This is a known problem. Use REBOL/core.
B) You are using an expired experimental? This would also
fail on boot-- though I don't know if it will hang out.
Maybe check to see if you can run the version of REBOL
directly.
So is the #! line pointing to the correct REBOL?
Otherwise, this script doesn't look like it could be
causing that problem.
How is this invoked, through an IMG tag?
You could also add a little logging:
write/append %banner-script.log now
I see that it is ending with .cgi. Perhaps another copy of
it is lying around in another directory getting invoked
erroneously?
-jeff
[11/13] from: rchristiansen::pop::isdfa::sei-it::com at: 6-Oct-2000 12:08
> A) You are not using a REBOL/view to serve this cgi, yes?
I am using /Core 2.3 for Solaris on Sparc.
> B) You are using an expired experimental?
It is not an experimental version of /Core.
> So is the #! line pointing to the correct REBOL?
Yes. The script is in the same directory as the binary.
> How is this invoked, through an IMG tag?
The script is invoked using an exec statement which is invoked by an
include statement.
> I see that it is ending with .cgi. Perhaps another copy of
> it is lying around in another directory getting invoked
> erroneously?
nope.
[12/13] from: jeff:rebol at: 6-Oct-2000 11:26
Shucks.
Hmmmmm....
So, this script had been working when tested?
Adding QUIT to the end?
The script as it appears to me, as a regular CGI, shouldn't
behave that way, so I'd conjecture there's something about
the SSI method that causing the problem. Wish I could be
more helpful.
-jeff
[13/13] from: rchristiansen:pop:isdfa:sei-it at: 6-Oct-2000 15:22
The strange thing about it is that I had been running the script for
months without knowing it was causing any problem. The hosting
service claims they had warned me about it before, but I cannot
recall any prior communications. I was experiencing much heavier hit
volumes when they decided to make me pull the script (since two of
the major BeOS news sites are down and I am one of the last few
standing until BeNews and BeGroovy come back online.) Perhaps
the higher hit volumes just exacerbated the problem.