Page 1 of 1

CGI Server error for unknown reason

Posted: Sun Oct 14, 2012 8:48 pm
by fenick
This one is stumping me. When I run the code in debug mode on on-rev it does everything it is suppose to do. When it gets to the end I get a server error.

The code executes fine and does all it suppose to do... I am thinking that something in the session or the DB is causing the server to throw an error. Anyone have ideas?

I pasted a couple lines of meaningless code at the end "e.g. put "test" into gTest. just to see what would happen, I can step through that code fine and get no errors... so it has something to do with getting to the end of this entire script which is causing the errors.

For help, you could probably just look past the breakpoint in the code... I just left in the full code in case I was doing something that changed a configuration or caused an error.

Code: Select all

<?lc
  global gDataBaseId
 
  require "/home/*******/*******/cgi-bin/dblib.lc"
   put $_POST["tSession"] into tGame	
   put $_POST["player"] into tPLayer	
   put $_POST["playerType"] into tPlayerType

  -- ***delete me before deploying***
  -- this is so I can use the on-rev degugger and not require the post from the application
   put "name|12345" into tGame
   put "67890" into tPLayer
   put "abc" into tPLayerType
  -- ***/delete me***

   -- open the db
   get libDBOpenDataBase("*****DBkey******")
  
  -- start the session
   set the sessionSavePath to "/home/*****/*****/sessions"
   set the sessionID to tGame
   start session
  
  -- if the player is the judge remove the judge.
   if tPlayerType = "judge" then
       put empty into $_SESSION["judgeName"]
   end if

   -- remove the playername from the playerlist
   put  $_SESSION["playerList"] into tPlayerList
   set the wholematches to true
   put lineOffset(tPLayer,tPLayerList) into tLineNum
   delete line tLineNum of tPLayerList
   put tPlayerList into $_SESSION["playerList"]
	
  breakpoint

   -- save the number of players to the session
  put the number of lines of tPLayerList into tNumPLayers
  put  tNumPlayers into $_SESSION["numPlayers"]

  -- If this is the last player in the session, then delete the session and the db entry
  if tNumPlayers = 0 then
      delete session
      get libBDDelete("activeGames", "gameName", tGame)
      revCloseDatabase gDataBaseId
  else
     stop session
  end if
?>
I've been testing the case at the end when I delete the session and delete the row in the database... so I am thinking it has something to do with that.

Thanks for any help.

Re: CGI Server error for unknown reason

Posted: Sun Oct 14, 2012 10:18 pm
by fenick
To deepen the mystery:

* I created a new file. Copied over block by block. Step through debugger with each new block copied over. When I got to the point where I had the entire code copied over to the new file. It worked fine. no error.

* When I deleted all of the code in the file but the simple put "test" into ttest... that file still got a server 500 error when I tried to execute it.

So it seems like it is a server issue with that lc file. The code is fine when I execute it under a different file name. I just get the server error when I run it under its old file name.

Re: CGI Server error for unknown reason

Posted: Mon Oct 15, 2012 1:30 am
by sturgis
The 500 error in this case is because you don't actually put anything out. You set a variable and nothing else so there is no actual content hence the error 500.