

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
6 messages in net.java.dev.jna.usersRe: JNA (fork and exec)| From | Sent On | Attachments |
|---|---|---|
| Timothy Wall | Aug 27, 2007 12:59 pm | |
| Wayne Meissner | Aug 27, 2007 5:28 pm | |
| Jagadeeswaran Rajendiran | Aug 28, 2007 4:56 pm | |
| Timothy Wall | Aug 28, 2007 6:51 pm | |
| Jagadeeswaran Rajendiran | Aug 29, 2007 5:49 pm | |
| Timothy Wall | Aug 29, 2007 8:48 pm |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread Paste this link in email or IM: |
| Atom feed for this thread Paste this URL into your reader: |
| Subject: | Re: JNA (fork and exec) | Actions... |
|---|---|---|
| From: | Timothy Wall (twal...@dev.java.net) | |
| Date: | Aug 27, 2007 12:59:13 pm | |
| List: | net.java.dev.jna.users | |
On Aug 24, 2007, at 8:33 PM, Jagadeeswaran Rajendiran wrote:
Hi,
We are trying to use JNA to get some of the platform-specific functions done in our java-based project.
In one such situation, one of my threads forks and execs a script (using JNA), say forked_executable to be run on the local machine. The behaviour we are observing is as follows:
Machine : i686 OS : Linux (Ubuntu)
Summary: Sometimes we see the forked_executable running successfully and everything is fine. Occassionally (3times out of 5) we see two instances of our original program running, which leads us to conclude that execv failed or wasn't executed for some reason.
If the execv fails, errno is set. You need to determine the state of the VM when you wind up with two instances of the original (java) process. What does a stack dump show? Has the forked process reached the execv call? Is it stuck in the execv call? What does a system strace (or other system monitoring log) show?
-- Relevant Code --
//linux is the libc.INSTANCE
if((childPid = linux.fork()) == 0){ try{ System.out.println(Thread.currentThread ().getName() + " - execing right now"); Thread.currentThread().setName("New_Execed Thread"); System.out.println(Thread.currentThread ().getName() + " - just before exec"); System.out.println("return value" + linux.execv ("/bin/sleep", testArray)); }catch(Exception e){ System.out.println("exception in abs"); e.printStackTrace(); } } else{ System.out.println(Thread.currentThread().getName() + " - I am the parent"); }
-- Relevant Code --
Have you guys encountered anything related to this? Is there a possibility of a race condition somewhere? Any help is appreciated!
Thanks, -Jags







