postgres@smadev:~> jstack 384
384: Unable to open socket file: target process not responding or HotSpot VM not loaded
The -F option can be used when the target process is not responding
Also jstack -F fails as well
postgres@smadev:~> jstack -F 384
Attaching to process ID 384, please wait...
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at sun.tools.jstack.JStack.runJStackTool(JStack.java:136)
at sun.tools.jstack.JStack.main(JStack.java:102)
Caused by: sun.jvm.hotspot.debugger.UnalignedAddressException: Trying to read at address: 0x746f705c6c4f4867 with alignment: 4
at sun.jvm.hotspot.debugger.bsd.BsdDebuggerLocal$1.checkAlignment(BsdDebuggerLocal.java:181)
at sun.jvm.hotspot.debugger.bsd.BsdDebuggerLocal.readCInteger(BsdDebuggerLocal.java:478)
at sun.jvm.hotspot.debugger.DebuggerBase.readAddressValue(DebuggerBase.java:454)
at sun.jvm.hotspot.debugger.bsd.BsdDebuggerLocal.readAddress(BsdDebuggerLocal.java:423)
at sun.jvm.hotspot.debugger.bsd.BsdAddress.getAddressAt(BsdAddress.java:74)
at sun.jvm.hotspot.HotSpotTypeDataBase.readVMTypes(HotSpotTypeDataBase.java:108)
at sun.jvm.hotspot.HotSpotTypeDataBase.<init>(HotSpotTypeDataBase.java:85)
at sun.jvm.hotspot.bugspot.BugSpotAgent.setupVM(BugSpotAgent.java:574)
at sun.jvm.hotspot.bugspot.BugSpotAgent.go(BugSpotAgent.java:495)
at sun.jvm.hotspot.bugspot.BugSpotAgent.attach(BugSpotAgent.java:333)
at sun.jvm.hotspot.tools.Tool.start(Tool.java:163)
at sun.jvm.hotspot.tools.JStack.main(JStack.java:86)
1) establish a connection with the pl/java people
2) trying to go back and forth from there and here to try to debug the problem
Lets wait for some recommendation/help from there, and then i'll get back
to this list for more.
I can write and run standalone JNI programs outside postgrsesql (even as postgres user),
but when i try to run it from within postgres, then it gets hang.
Any ideas?
Wrote a very small C postgresql function which simply calls JNI
and it hangs as well.
#include "postgres.h"
#include "utils/elog.h"
#include "utils/palloc.h"
#include "utils/array.h"
#include "utils/builtins.h"
#include "storage/bufpage.h"
#include "catalog/pg_type.h"
#include <jni.h>
PG_MODULE_MAGIC;
PG_FUNCTION_INFO_V1(jnitest);
Datum jnitest(PG_FUNCTION_ARGS);
Datum
jnitest(PG_FUNCTION_ARGS)
{
int res;
JNIEnv *env;
JavaVM *jvm;
JavaVMInitArgs vm_args;
JavaVMOption *options=NULL;
vm_args.version = 0x00010002;
vm_args.options = options;
vm_args.nOptions = 0;
vm_args.ignoreUnrecognized = JNI_TRUE;
/* Create the Java VM */
res = JNI_CreateJavaVM(&jvm, (void**)&env, &vm_args);
PG_RETURN_POINTER(res);
}
create function jnitest() RETURNS integer LANGUAGE c AS '$libdir/jnitest', 'jnitest';
dynacom=# select jnitest();
^^^ hangs, it seems the call to res = JNI_CreateJavaVM(&jvm, (void**)&env, &vm_args);
just never completes
So, this must be a FreeBSD/PostgreSQL/JNI thing.
Any help/where to go from here would be very welcome.