Servlets executing a C program.
Hi: I have a website(servlets on Apache/Tomcat/mysql ) that does the following.
Lets user upload a file, gives this file as input to a C program. The C program exectutes and gives some output files. The servlet picks up those output files and lists them to user for downloading/viewing.
Problems I have now:
1. Where to store the C program- I have put it in /tomcat/bin for now. If I have it anywhere else, it gives me a segmentation fault or Access Denied(dont know why) The file owner is root. Now is this safe?
2. After a period of inactivity(generally overnight) my servlet gives this exception "./myCcode: No such file or directroy" . If I restart the server this error disappears.
3. Sometimes the c code gives me a core dump for a particular file. Once again restarting the server makes this disappear.
4. I call the c code either directly from the servlet or in the background as a thread(depending on if the user wants the result sent to him as an email). Now for the same uploaded file, the direct servlet execution works ok while if its a background thread I get a core dump. Again restarting the server makes this behavior disappear.
I use the Runtime.exec() method to execute the c code. If anybody can solve any or all of the above mysteries(to me) I would really appreciate it.
Actually I have another c program with similar functions as the first one on my website, and it has NEVER given me any of the above problems. This was written by another programmer, which makes me wonder if its the c program which is faulty?!!!
Thanks a lot for any input.
Last edited by webee; 02-04-2003 at 02:20 PM.