Java Multithreaded application gives -1 as PID
Posted in 2008
Summary
A user on IDS 10 asked why 'onstat -g ses' shows a PID of -1 for sessions created by a multithreaded Java application, and whether it can be made to show the real process ID. One reply suggested remote connections were the cause (only local network/shared-memory connections report valid PIDs), but the poster's own retest showed a remote connection with a valid PID, so that explanation was withdrawn. Another contributor noted that -1 appears to be normal for Java/JDBC clients, possibly because the client libraries can't determine the process, while ESQL/C clients report PIDs correctly. No resolution or workaround was recorded.
Auto-generated by DrWatson from the posts below — may be imperfect; read the full thread.
Version: IDS 10
I have a java application that is multithreaded and each thread
creates a new DB connection. But when I look at onstat -g ses I see
PID as -1. Could somebody tell me if this could be changed to reflect
actual PID of the application ?
↪ replying to mohitanchlia@gmail.com
On Feb 18, 3:01 pm, mohitanch...@gmail.com wrote:
> Version: IDS 10
>
> I have a java application that is multithreaded and each thread
> creates a new DB connection. But when I look at onstat -g ses I see
> PID as -1. Could somebody tell me if this could be changed to reflect
> actual PID of the application ?
Where is the application connecting from? Is it connecting from a
remote machine or local to the database server? If it's a remote
machine, if I remember correctly, that is why the PID gets set to -1,
and only local network connections and local shared memory connections
have valid PIDs.
↪ replying to jprenaut@yahoo.com
On Feb 18, 3:22 pm, jpren...@yahoo.com wrote:
> On Feb 18, 3:01 pm, mohitanch...@gmail.com wrote:
>
> > Version: IDS 10
>
> > I have a java application that is multithreaded and each thread
> > creates a new DB connection. But when I look at onstat -g ses I see
> > PID as -1. Could somebody tell me if this could be changed to reflect
> > actual PID of the application ?
>
> Where is the application connecting from? Is it connecting from a
> remote machine or local to the database server? If it's a remote
> machine, if I remember correctly, that is why the PID gets set to -1,
> and only local network connections and local shared memory connections
> have valid PIDs.
Hmm, doing a quick tests between machines and I was able to get a
remote network connection to show up with a valid PID. It seems like
that used to be the case, I'll see about doing more checking to see
what the PID of -1 means now.
↪ replying to jprenaut@yahoo.com
jprenaut@yahoo.com wrote:
> On Feb 18, 3:22 pm, jpren...@yahoo.com wrote:
>> On Feb 18, 3:01 pm, mohitanch...@gmail.com wrote:
>>
>>> Version: IDS 10
>>> I have a java application that is multithreaded and each thread
>>> creates a new DB connection. But when I look at onstat -g ses I see
>>> PID as -1. Could somebody tell me if this could be changed to reflect
>>> actual PID of the application ?
>> Where is the application connecting from? Is it connecting from a
>> remote machine or local to the database server? If it's a remote
>> machine, if I remember correctly, that is why the PID gets set to -1,
>> and only local network connections and local shared memory connections
>> have valid PIDs.
>
> Hmm, doing a quick tests between machines and I was able to get a
> remote network connection to show up with a valid PID. It seems like
> that used to be the case, I'll see about doing more checking to see
> what the PID of -1 means now.
AFAIK, PIS -1 happens always with Java applications... I didn't test it, but
that's what I'm used to see. I have no idea if there is any valid reason for
this... like some technical difficulty for the client libraries to find out the
process that are running them...
--
Fernando Nunes
Portugal
http://informix-technology.blogspot.com
My email works... but I don't check it frequently...
↪ replying to Fernando Nunes
On Feb 18, 2:08 pm, Fernando Nunes <s...@onlinedomus.net> wrote:
> jpren...@yahoo.com wrote:
> > On Feb 18, 3:22 pm, jpren...@yahoo.com wrote:
> >> On Feb 18, 3:01 pm, mohitanch...@gmail.com wrote:
>
> >>> Version: IDS 10
> >>> I have a java application that is multithreaded and each thread
> >>> creates a new DB connection. But when I look at onstat -g ses I see
> >>> PID as -1. Could somebody tell me if this could be changed to reflect
> >>> actual PID of the application ?
> >> Where is the application connecting from? Is it connecting from a
> >> remote machine or local to the database server? If it's a remote
> >> machine, if I remember correctly, that is why the PID gets set to -1,
> >> and only local network connections and local shared memory connections
> >> have valid PIDs.
>
> > Hmm, doing a quick tests between machines and I was able to get a
> > remote network connection to show up with a valid PID. It seems like
> > that used to be the case, I'll see about doing more checking to see
> > what the PID of -1 means now.
>
> AFAIK, PIS -1 happens always with Java applications... I didn't test it, but
> that's what I'm used to see. I have no idea if there is any valid reason for
> this... like some technical difficulty for the client libraries to find out the
> process that are running them...
>
> --
> Fernando Nunes
> Portugal
>
> http://informix-technology.blogspot.com
> My email works... but I don't check it frequently...- Hide quoted text -
>
> - Show quoted text -
Yes. All java applications show PID as -1. However, ESQL/C
applications show PID correctly. Is there a way to get the correct PID
information to Informix for Java Applications ?
Related threads