LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 02-04-2003, 02:17 PM   #1
webee
LQ Newbie
 
Registered: Jan 2003
Posts: 11

Rep: Reputation: 0
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.
 
Old 02-04-2003, 05:19 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,978
Blog Entries: 11

Rep: Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879
I would think that there's a problem with your C code if you get
segfaults on a more or less regular basis ...

As for the way you call it, I'd recommend you try this ...



HIH

Cheers,
Tink

Last edited by Tinkster; 02-04-2003 at 05:22 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Executing program as non-root arip Programming 4 12-01-2005 05:41 AM
executing a program as root funkymunky Linux - General 2 05-06-2005 12:48 PM
How executing c program with php? payal_shah Programming 6 04-08-2005 10:44 PM
executing a program in new terminal? kashifbilal Programming 7 04-26-2004 04:52 AM
Executing a program with out system() in c++ sobdk Programming 2 11-02-2002 07:45 AM


All times are GMT -5. The time now is 11:26 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration