agora inbox for pljava-dev@postgresql.org  
help / color / mirror / Atom feed
[Pljava-dev] Java VM stalls during
10+ messages / 0 participants
[nested] [flat]

* [Pljava-dev] Java VM stalls during
@ 2010-12-06 05:58 
  2010-12-07 10:20 ` [Pljava-dev] Java VM stalls during 
  0 siblings, 1 reply; 10+ messages in thread

From:  @ 2010-12-06 05:58 UTC (permalink / raw)


>>> PS:

>>>      Before moving to FreeBSD OS, i have tested the same in UBUNTU OS
>>> (2.6.31-

>>>  14-server #48-Ubuntu SMP). I could install jar, could create pljava
>>> function

>>> and execute through "psql".)

One more additional information is, in UBUNTU testing i have used JDK
pre-built release from Oracle jun Java website. Whereas in FreeBSD, i find
diablo-jdk1.5 amd64 pre-built package did not  work (in libjvm.so has
reference to "pthread_create" function, but "ldd" showed no dependancy
libpthread.so library). Due to this pljava install failed. So i have
download jdk sources using FreeBSD ports and built JDK1.5. In this version,
i could install pljava, but install_jar fails. 
I am blocked due to this bug. Any help on this issue is grealy appreciated!

Thanks again!





-- 
View this message in context: http://postgresql.1045698.n5.nabble.com/Java-VM-stalls-during-install-jar-tp3290754p3293612.html
Sent from the PL/Java mailing list archive at Nabble.com.




^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* [Pljava-dev] Java VM stalls during
  2010-12-06 05:58 [Pljava-dev] Java VM stalls during 
@ 2010-12-07 10:20 ` 
  2010-12-08 04:52   ` [Pljava-dev] Java VM stalls during 
  0 siblings, 1 reply; 10+ messages in thread

From:  @ 2010-12-07 10:20 UTC (permalink / raw)

Hi,

On Mon, Dec 6, 2010 at 5:58 AM, Anantha <chantanand at gmail.com> wrote:
>
>>>> PS:
>
>>>> ? ? ?Before moving to FreeBSD OS, i have tested the same in UBUNTU OS
>>>> (2.6.31-
>
>>>> ?14-server #48-Ubuntu SMP). I could install jar, could create pljava
>>>> function
>
>>>> and execute through "psql".)
>
> One more additional information is, in UBUNTU testing i have used JDK
> pre-built release from Oracle jun Java website. Whereas in FreeBSD, i find
> diablo-jdk1.5 amd64 pre-built package did not ?work (in libjvm.so has
> reference to "pthread_create" function, but "ldd" showed no dependancy
> libpthread.so library). Due to this pljava install failed. So i have
> download jdk sources using FreeBSD ports and built JDK1.5. In this version,
> i could install pljava, but install_jar fails.
> I am blocked due to this bug. Any help on this issue is grealy appreciated!

Please provide all relevant errors from the log, if any.

Does

CREATE FUNCTION getsysprop(VARCHAR)
  RETURNS VARCHAR
  AS 'java.lang.System.getProperty'
  LANGUAGE java;

SELECT getsysprop('user.home');

work?


Johann




^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* [Pljava-dev] Java VM stalls during
  2010-12-06 05:58 [Pljava-dev] Java VM stalls during 
  2010-12-07 10:20 ` [Pljava-dev] Java VM stalls during 
@ 2010-12-08 04:52   ` 
  2010-12-10 05:32     ` [Pljava-dev] Java VM stalls during 
  0 siblings, 1 reply; 10+ messages in thread

From:  @ 2010-12-08 04:52 UTC (permalink / raw)


>>> Please provide all relevant errors from the log, if any
--------------------------------------------------
DEBUG:  00000: find_in_dynamic_libpath: trying
"/usr/local/pljava/lib/pljava.so"
LOCATION:  find_in_dynamic_libpath, dfmgr.c:642
STATEMENT:  select
sqlj.install_jar('file:///data1/home/bakumar/Work/Java/classes/Haribol.jar','test_jar',false)
    ;
DEBUG:  00000: Using integer_datetimes
LOCATION:  checkIntTimeType,
/usr/local/src/PLJava/org.postgresql.pljava/src/C/pljava/Backend.c:543
STATEMENT:  select
sqlj.install_jar('file:///data1/home/bakumar/Work/Java/classes/Haribol.jar','test_jar',false)
    ;
DEBUG:  00000: Added JVM option string "-XX:+UseAltSigs"
LOCATION:  JVMOptList_add,
/usr/local/src/PLJava/org.postgresql.pljava/src/C/pljava/Backend.c:436
STATEMENT:  select
sqlj.install_jar('file:///data1/home/bakumar/Work/Java/classes/Haribol.jar','test_jar',false)
    ;
DEBUG:  00000: Added JVM option string
"-Djava.class.path=/usr/local/pljava/pljava.jar"
LOCATION:  JVMOptList_add,
/usr/local/src/PLJava/org.postgresql.pljava/src/C/pljava/Backend.c:436
STATEMENT:  select
sqlj.install_jar('file:///data1/home/bakumar/Work/Java/classes/Haribol.jar','test_jar',false)
    ;
DEBUG:  00000: Added JVM option string
"-Dsqlj.defaultconnection=jdbc:default:connection"
LOCATION:  JVMOptList_add,
/usr/local/src/PLJava/org.postgresql.pljava/src/C/pljava/Backend.c:436
STATEMENT:  select
sqlj.install_jar('file:///data1/home/bakumar/Work/Java/classes/Haribol.jar','test_jar',false)
    ;
DEBUG:  00000: Added JVM option string "vfprintf"
LOCATION:  JVMOptList_add,
/usr/local/src/PLJava/org.postgresql.pljava/src/C/pljava/Backend.c:436
STATEMENT:  select
sqlj.install_jar('file:///data1/home/bakumar/Work/Java/classes/Haribol.jar','test_jar',false)
    ;
DEBUG:  00000: Added JVM option string "-Xrs"
LOCATION:  JVMOptList_add,
/usr/local/src/PLJava/org.postgresql.pljava/src/C/pljava/Backend.c:436
STATEMENT:  select
sqlj.install_jar('file:///data1/home/bakumar/Work/Java/classes/Haribol.jar','test_jar',false)
    ;
DEBUG:  00000: Creating JavaVM
LOCATION:  initializeJavaVM,
/usr/local/src/PLJava/org.postgresql.pljava/src/C/pljava/Backend.c:675
STATEMENT:  select
sqlj.install_jar('file:///data1/home/bakumar/Work/Java/classes/Haribol.jar','test_jar',false)
    ;
DEBUG:  00000: my backend id is 5
LOCATION:  SharedInvalBackendInit, sinvaladt.c:316
DEBUG:  00000: StartTransaction
--------------------------------------------------


>>> CREATE FUNCTION getsysprop(VARCHAR) 
>>>   RETURNS VARCHAR 
>>>   AS 'java.lang.System.getProperty' 
>>>   LANGUAGE java; 
I could create function.

>>> SELECT getsysprop('user.home'); 

>>> work? 
No it did not work. When i send SELECT query, "psql" hangs. Please refer
below:
-----------------------------------------
=# SELECT getsysprop('user.home');
^CCancel request sent
^CCancel request sent



-- 
View this message in context: http://postgresql.1045698.n5.nabble.com/Java-VM-stalls-during-install-jar-tp3290754p3296921.html
Sent from the PL/Java mailing list archive at Nabble.com.




^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* [Pljava-dev] Java VM stalls during
  2010-12-06 05:58 [Pljava-dev] Java VM stalls during 
  2010-12-07 10:20 ` [Pljava-dev] Java VM stalls during 
  2010-12-08 04:52   ` [Pljava-dev] Java VM stalls during 
@ 2010-12-10 05:32     ` 
  2010-12-15 16:09       ` [Pljava-dev] Java VM stalls during 
  0 siblings, 1 reply; 10+ messages in thread

From:  @ 2010-12-10 05:32 UTC (permalink / raw)


I have tested with pljava-1.4.1 release too, but still same issue (please see
the log below).

--------------
>>> DEBUG:  00000: Added JVM option string "-Xrs" 
>>> LOCATION:  JVMOptList_add,
>>> /usr/local/src/PLJava/org.postgresql.pljava/src/C/pljava/Backend.c:436 
>>> STATEMENT:  select
>>> sqlj.install_jar('file:///data1/home/bakumar/Work/Java/classes/Haribol.jar','test_jar',false) 
    ; 
>>> DEBUG:  00000: Creating JavaVM 
>>> LOCATION:  initializeJavaVM,
>>> /usr/local/src/PLJava/org.postgresql.pljava/src/C/pljava/Backend.c:675 
>>> STATEMENT:  select
>>> sqlj.install_jar('file:///data1/home/bakumar/Work/Java/classes/Haribol.jar','test_jar',false) 
--------------

When i check the code with log,  "initializeJavaVM" function makes the call
to JNI_createVM which calls "JNI_CreateJavaVM" function and looks like
control waits there in loop indefinitely.  As "JNI_CreateJavaVM" function is
in "libjvm.so", could it be JDK issue? I have followed build procedures
stated by FreeBSD ports makefile, compiled and installed JDK-1.5 (64bit
version). Would there be any issue in FreeBSD JDK source?

We badly need your help on this issue. Thanks in advance!

-- 
View this message in context: http://postgresql.1045698.n5.nabble.com/Java-VM-stalls-during-install-jar-tp3290754p3299847.html
Sent from the PL/Java mailing list archive at Nabble.com.




^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* [Pljava-dev] Java VM stalls during
  2010-12-06 05:58 [Pljava-dev] Java VM stalls during 
  2010-12-07 10:20 ` [Pljava-dev] Java VM stalls during 
  2010-12-08 04:52   ` [Pljava-dev] Java VM stalls during 
  2010-12-10 05:32     ` [Pljava-dev] Java VM stalls during 
@ 2010-12-15 16:09       ` 
  2010-12-16 17:05         ` [Pljava-dev] Java VM stalls during 
  0 siblings, 1 reply; 10+ messages in thread

From:  @ 2010-12-15 16:09 UTC (permalink / raw)

Hi,

On Fri, Dec 10, 2010 at 5:32 AM, Anantha <chantanand at gmail.com> wrote:

> When i check the code with log, ?"initializeJavaVM" function makes the call
> to JNI_createVM which calls "JNI_CreateJavaVM" function and looks like
> control waits there in loop indefinitely. ?As "JNI_CreateJavaVM" function is
> in "libjvm.so", could it be JDK issue? I have followed build procedures
> stated by FreeBSD ports makefile, compiled and installed JDK-1.5 (64bit
> version). Would there be any issue in FreeBSD JDK source?

Unfortunately, I can't run amd64 FreeBSD in VirtualBox since my CPU
doesn't have VT-x (or whatever it's called) so I'm flying blind here.

I can help further/faster with shell access to amd64 FreeBSD machine.
I don't need root, only Postgres 9 sources (maybe not if it's
installed) as well as PL/Java and what it takes to build it.

Does the following JNI application work?  You'll need to adjust the
Makefile.  And please excuse the cut&paste instead of attachments.


Johann

# File: Makefile

# Adjust these for your system.
STUDIO_HOME=/opt/myrkraverk/solstudio12.2
JAVA_HOME=/opt/myrkraverk/jdk1.5.0_22/

# Adjust these for your compiler.
# -m64 is for amd64 binaries on Solaris, whether compiled with
# Studio or GCC.
CC=${STUDIO_HOME}/bin/cc
CFLAGS=-I${JAVA_HOME}/include -I${JAVA_HOME}/include/solaris -m64

# This may need to be adjusted for non-Solaris platforms.
# For GCC you can try -rpath.
# Another option is to pass it directly to the linker with -Wl for example.
RPATH=-R${JAVA_HOME}/jre/lib/amd64/server

# This should not need to be modified
JAVAC=${JAVA_HOME}/bin/amd64/javac
JAVA=${JAVA_HOME}/bin/amd64/java

invoke: invoke.c Prog.class
	${CC} -o invoke ${CFLAGS} invoke.c -L${JAVA_HOME}/jre/lib/amd64 \
	-R${JAVA_HOME}/jre/lib/amd64 \
	-L${JAVA_HOME}/jre/lib/amd64/server ${RPATH} \
	-L${JAVA_HOME}/jre/lib/amd64/native_threads
-R${JAVA_HOME}/jre/lib/amd64\native_threads \
	-ljvm

Prog.class: Prog.java
	${JAVAC} -g Prog.java


# End of File: Makefile

// File: Prog.java

public class Prog {

    public static void main(String[] args)
    {
	System.out.println("Hello World " + args[0]);
    }
}

// End of file: Prog.java

/* File: invoke.c */
#include <jni.h>

#define PATH_SEPARATOR ':' /* define it to be ';' on Windows */
#define USER_CLASSPATH "." /* where Prog.class is */

int main( int argc, char *argv[] )
{
  JNIEnv *env;
  JavaVM *jvm;
  jint res;
  jclass cls;
  jmethodID mid;
  jstring jstr;
  jclass stringClass;
  jobjectArray args;

  JavaVMInitArgs vm_args;
  JavaVMOption options[1];
  options[0].optionString =
    "-Djava.class.path=" USER_CLASSPATH;
  vm_args.version = 0x00010002;
  vm_args.options = options;
  vm_args.nOptions = 1;
  vm_args.ignoreUnrecognized = JNI_TRUE;
  /* Create the Java VM */
  res = JNI_CreateJavaVM(&jvm, (void**)&env, &vm_args);


  if (res < 0) {
    fprintf(stderr, "Can't create Java VM\n");
    exit(1);
  }
  cls = (*env)->FindClass(env, "Prog");
  if (cls == NULL) {
    goto destroy;
  }

  mid = (*env)->GetStaticMethodID(env, cls, "main",
				  "([Ljava/lang/String;)V");
  if (mid == NULL) {
    goto destroy;
  }
  jstr = (*env)->NewStringUTF(env, " from C!");
  if (jstr == NULL) {
    goto destroy;
  }
  stringClass = (*env)->FindClass(env, "java/lang/String");
  args = (*env)->NewObjectArray(env, 1, stringClass, jstr);
  if (args == NULL) {
    goto destroy;
  }
  (*env)->CallStaticVoidMethod(env, cls, mid, args);

 destroy:
  if ((*env)->ExceptionOccurred(env)) {
    (*env)->ExceptionDescribe(env);
  }
  (*jvm)->DestroyJavaVM(jvm);
}

/* End of file: invoke.c */




^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* [Pljava-dev] Java VM stalls during
  2010-12-06 05:58 [Pljava-dev] Java VM stalls during 
  2010-12-07 10:20 ` [Pljava-dev] Java VM stalls during 
  2010-12-08 04:52   ` [Pljava-dev] Java VM stalls during 
  2010-12-10 05:32     ` [Pljava-dev] Java VM stalls during 
  2010-12-15 16:09       ` [Pljava-dev] Java VM stalls during 
@ 2010-12-16 17:05         ` 
  2010-12-17 09:52           ` [Pljava-dev] Java VM stalls during 
  0 siblings, 1 reply; 10+ messages in thread

From:  @ 2010-12-16 17:05 UTC (permalink / raw)




>> Does the following JNI application work?  You'll need to adjust the 
>> Makefile.  And please excuse the cut&paste instead of attachments. 
This worked for me. Now, please guide what should i do? Thanks in advance!


-- 
View this message in context: http://postgresql.1045698.n5.nabble.com/Java-VM-stalls-during-install-jar-tp3290754p3308239.html
Sent from the PL/Java mailing list archive at Nabble.com.




^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* [Pljava-dev] Java VM stalls during
  2010-12-06 05:58 [Pljava-dev] Java VM stalls during 
  2010-12-07 10:20 ` [Pljava-dev] Java VM stalls during 
  2010-12-08 04:52   ` [Pljava-dev] Java VM stalls during 
  2010-12-10 05:32     ` [Pljava-dev] Java VM stalls during 
  2010-12-15 16:09       ` [Pljava-dev] Java VM stalls during 
  2010-12-16 17:05         ` [Pljava-dev] Java VM stalls during 
@ 2010-12-17 09:52           ` 
  2010-12-17 12:45             ` [Pljava-dev] Java VM stalls during 
  0 siblings, 1 reply; 10+ messages in thread

From:  @ 2010-12-17 09:52 UTC (permalink / raw)

Hi Anantha,

I've just started to work for 2ndquadrant.com and if you need prompt
support you may be able to work out a contract through them.
Otherwise/until then I'll help you out as much as I can through email.

On Thu, Dec 16, 2010 at 5:05 PM, Anantha <chantanand at gmail.com> wrote:
>>> Does the following JNI application work? ?You'll need to adjust the
>>> Makefile. ?And please excuse the cut&paste instead of attachments.
> This worked for me. Now, please guide what should i do? Thanks in advance!

Ok, we then know that 64 bit applications can create virtual machines.
 You can of course double check that with something like

asuka% file invoke
invoke:		ELF 64-bit LSB executable AMD64 Version 1 [SSE FXSR FPU],
dynamically linked, not stripped
asuka% ./invoke
Hello World  from C!

When the JNI_CreateJavaVM() stalls/hangs, what does pldd say?  You can

johann=# SELECT PG_BACKEND_PID();
 pg_backend_pid
----------------
           2980
(1 row)

and get the pid before you try to run any Java code to feed it to pldd
(or BSD equivalent).  You may have to do this as the user (id) that
runs the server.

postgres9 at asuka:~$ pldd 2980
2980:	/opt/myrkraverk/postgresql-9.0.1/bin/amd64/postgres

<snip>

/export/home/johann/src/external/pljava-head/build/objs/pljava.so
/opt/myrkraverk/jdk1.5.0_22/jre/lib/amd64/server/libjvm.so

<snip>

/opt/myrkraverk/jdk1.5.0_22/jre/lib/amd64/native_threads/libhpi.so
/opt/myrkraverk/solstudio12.2/lib/dbx/amd64/runtime/libdbx_agent.so
/opt/myrkraverk/jdk1.5.0_22/jre/lib/amd64/libverify.so
/opt/myrkraverk/jdk1.5.0_22/jre/lib/amd64/libjava.so
/opt/myrkraverk/jdk1.5.0_22/jre/lib/amd64/libzip.so

<snip>

That is, are you linking agains the libjvm you expect to?  Note that
although in my example above it links to JRE 1.5 it also works to link
at run time with JRE 1.6.  It is only at compile time you have to use
1.4 or 1.5.


Johann




^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* [Pljava-dev] Java VM stalls during
  2010-12-06 05:58 [Pljava-dev] Java VM stalls during 
  2010-12-07 10:20 ` [Pljava-dev] Java VM stalls during 
  2010-12-08 04:52   ` [Pljava-dev] Java VM stalls during 
  2010-12-10 05:32     ` [Pljava-dev] Java VM stalls during 
  2010-12-15 16:09       ` [Pljava-dev] Java VM stalls during 
  2010-12-16 17:05         ` [Pljava-dev] Java VM stalls during 
  2010-12-17 09:52           ` [Pljava-dev] Java VM stalls during 
@ 2010-12-17 12:45             ` 
  2010-12-17 15:03               ` [Pljava-dev] Java VM stalls during 
  0 siblings, 1 reply; 10+ messages in thread

From:  @ 2010-12-17 12:45 UTC (permalink / raw)



>>> and get the pid before you try to run any Java code to feed it to pldd
(or BSD equivalent).  You may have to do this as the user (id) that
runs the server.

I tried the above, but it didn't work for me (tried as same user of postgres
server). Please see log below:

postgres=# SELECT PG_BACKEND_PID();
 pg_backend_pid 
----------------
          74638
(1 row)

$ ldd 74638
ldd: 74638: No such file or directory

do you see any mistake in the above commands? Do you have any other method
to find back end process environment? Please give reply. 

-- 
View this message in context: http://postgresql.1045698.n5.nabble.com/Java-VM-stalls-during-install-jar-tp3290754p3309361.html
Sent from the PL/Java mailing list archive at Nabble.com.




^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* [Pljava-dev] Java VM stalls during
  2010-12-06 05:58 [Pljava-dev] Java VM stalls during 
  2010-12-07 10:20 ` [Pljava-dev] Java VM stalls during 
  2010-12-08 04:52   ` [Pljava-dev] Java VM stalls during 
  2010-12-10 05:32     ` [Pljava-dev] Java VM stalls during 
  2010-12-15 16:09       ` [Pljava-dev] Java VM stalls during 
  2010-12-16 17:05         ` [Pljava-dev] Java VM stalls during 
  2010-12-17 09:52           ` [Pljava-dev] Java VM stalls during 
  2010-12-17 12:45             ` [Pljava-dev] Java VM stalls during 
@ 2010-12-17 15:03               ` 
  2010-12-27 11:58                 ` [Pljava-dev] Java VM stalls during 
  0 siblings, 1 reply; 10+ messages in thread

From:  @ 2010-12-17 15:03 UTC (permalink / raw)

Hi,

On Fri, Dec 17, 2010 at 12:45 PM, Anantha <chantanand at gmail.com> wrote:
>
> $ ldd 74638
> ldd: 74638: No such file or directory

The command is pldd, process ldd.  On FreeBSD you may need to do
something like lsof -p <pid>.  And there are possibly other methods.
Using lsof you may want to pipe it through grep lib: lsof -p <pid> |
grep lib


Johann




^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* [Pljava-dev] Java VM stalls during
  2010-12-06 05:58 [Pljava-dev] Java VM stalls during 
  2010-12-07 10:20 ` [Pljava-dev] Java VM stalls during 
  2010-12-08 04:52   ` [Pljava-dev] Java VM stalls during 
  2010-12-10 05:32     ` [Pljava-dev] Java VM stalls during 
  2010-12-15 16:09       ` [Pljava-dev] Java VM stalls during 
  2010-12-16 17:05         ` [Pljava-dev] Java VM stalls during 
  2010-12-17 09:52           ` [Pljava-dev] Java VM stalls during 
  2010-12-17 12:45             ` [Pljava-dev] Java VM stalls during 
  2010-12-17 15:03               ` [Pljava-dev] Java VM stalls during 
@ 2010-12-27 11:58                 ` 
  0 siblings, 0 replies; 10+ messages in thread

From:  @ 2010-12-27 11:58 UTC (permalink / raw)



>>> On FreeBSD you may need to do
>>> something like lsof -p <pid>.  And there are possibly other methods.
>>> Using lsof you may want to pipe it through grep lib: lsof -p <pid> |
>>> grep lib 

i don't have "lsof" in system and could not install because of build issue.
But, "ldd" shows "pljava.so" uses "/usr/local/lib/libjvm.so" (which is
symbolic link to "libjvm.so" of jdk1.5.0). 

ldd /usr/local/pljava/pljava.so:
<snip>
        libjvm.so => /usr/local/lib/libjvm.so (0x800c00000)

file /usr/local/lib/libjvm.so 
/usr/local/lib/libjvm.so: symbolic link to
`/usr/local/jdk1.5.0/jre/lib/amd64/server/libjvm.so'

I have tested "invoke" binary (simple JNI test given by you already) by
linking the same "libjvm.so" and it works.  I am not sure why JNI call fail
during "install_jar" from "postgres db" client. Please give your guidance.

Thanks
Ananth


-- 
View this message in context: http://postgresql.1045698.n5.nabble.com/Java-VM-stalls-during-install-jar-tp3290754p3319259.html
Sent from the PL/Java mailing list archive at Nabble.com.




^ permalink  raw  reply  [nested|flat] 10+ messages in thread


end of thread, other threads:[~2010-12-27 11:58 UTC | newest]

Thread overview: 10+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2010-12-06 05:58 [Pljava-dev] Java VM stalls during 
2010-12-07 10:20 ` 
2010-12-08 04:52   ` 
2010-12-10 05:32     ` 
2010-12-15 16:09       ` 
2010-12-16 17:05         ` 
2010-12-17 09:52           ` 
2010-12-17 12:45             ` 
2010-12-17 15:03               ` 
2010-12-27 11:58                 ` 

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox