CGI failure Intermittent -- "Can't Open File"
Sannyasin Sivakatirswami
katir at hindu.org
Wed Apr 7 00:49:04 EDT 2004
This one is a hair puller....possibly OT because it may have nothing to
do with REV, but I can't diagnose if the issue is Rev CGI that is
receiving the POST, the Rev Application that is sending the POST, a
permissions problem on the server, an Apache config problem or an OSX
Server file system problem. I have a sinking feeling is the latter,
which will be hard to tackle.
Simply stated: the CGI accepts incoming data from a POST and writes it
to a file sometimes and sometimes it says it can't open the file. No
pattern...
CONTEXT:
OSX server running Apache with a little "intranet" web site
Darwin version Rev engine 2.1.2 installed and functioning nicely
The remote app is running from a 2.2. standalone player, and does this:
on upLoadToKauai
put fld "user" of stack "prefs" into tUser
put "_remotestaff=" & urlEncode(tUser) into tUploadData
put "&_project=" & urlEncode("gita") after tUploadData
put "&_fileName=" & urlEncode(gFileName) after tUploadData
put "&_transcript=" & urlEncode (gDataToUpload) after tUploadData
put
"http://user:pass@our.kauai.server.org/cgi-bin/
uploadGitaTranscript.cgi" into tURL
POST tUploadData to url tURL
put it into fld "feedBack"
show fld "FeedBack" with visual effect dissolve
show btn "Close" with visual effect dissolve
end upLoadToKauai
the CGI (truncated a bit for email purposes:) goes like this:
on startup
if $REQUEST_METHOD is "POST" then
read from stdin until empty
put urlDecode (it) into tDataIn
split tDataIn by "&" and "="
put tDataIn["_remotestaff"] into tUser
put tDataIn["_project"] into tProject
put tDataIn["_transcript"] into tTranscript
put tDataIn["_fileName"] into tfileName
put url "file:transcriptionTeam.txt" into tAuthenticate
if (tUser is among the lines of tAuthenticate) then
# set up a file path to the incoming transcription
# it will just be a small xml file
switch tProject
case "taka"
put "/taka/New-Not Yet Posted/" into tLocalDestination
break
case "gita"
put "/gita/new_incoming/" into tLocalDestination
break
end switch
put ("../remote-team/" & tUser & tLocalDestination & tFileName) into
tFilePath
# next: open, write data and close the file
## !! but here is the problem:
## this attempt to write a file fails intermittently...
# sometimes apache writes the file
# other times it returns "can't open file" to the result
put tTranscript into url ("file:" & tFilePath) ## fails intermittently
put the Result & cr & cr into tResponse # sometimes empty some times
"can't open file"
## send stuff back to the user to confirm, along with the result
end start up
What is happening is when then the user clicks the button in the remote
rev app, to trigger the upload to Kauai it may return result: "can't
open file" then he clicks again and this time gets no result and the
file is written. I thought it might be something in our fire wall, but
I'm getting the same sporadic results over our LAN... whether I open
the application in Rev IDE or open in from my new standalone HA Stack
Player, I am also unable to discern any pattern as to when and why it
can't open file... click 4 times, a file is written 4 times, on the
fifth POST you get "can't open file" quit everything, go to the server,
delete the file book the remote app again, upload and on first attempt,
"can't open file" second attempt, file is written, third click, file is
written, forth attempt, "can't open file" = no pattern. Windows and
Mac versions both display same behavior.
Any clues as to how to debug this?
Sannyasin Sivakatirswami
Himalayan Academy Publications
at Kauai's Hindu Monastery
katir at hindu.org
www.HimalayanAcademy.com,
www.HinduismToday.com
www.Gurudeva.org
www.Hindu.org
More information about the use-livecode
mailing list