View previous topic :: View next topic |
Author |
Message |
-Seeker-
Joined: 13 Dec 2009 Posts: 3
|
Posted: Sun Nov 08, 2015 18:35 Post subject: |
|
|
Of course!
I have tested the build below against my own test setup, with the following results:
SCO: Ok (creature persisted to file)
RCO: Ok (creature retrieved from previously created file)
ResMan-hooks (using the new exists/demand methods): Ok (tested for 2da file)
NWScript interactions from default TestRunner: All ok - However, I noticed that the effect returned from getEffects, does not have the same effect id as the originally created effect. I don't know if this is a bug or not (the test case is from the standard TestRunner functionality).
getObjectType, getName, get2DAString, effectDeaf, getEffectId, applyEffectToObject, getEffects, getArea, getObjectsInArea, getFactionMembers, getPosition, getObjectId
Additional NWScript interactions: All ok
getWaypointByTag, getLocation, createObject
I don't have a test at hand for specifically testing the Scheduler functionality, but for the other tests, all seems fine! |
|
Back to top |
|
|
elven
Joined: 28 Jul 2006 Posts: 259 Location: Germany
|
Posted: Tue Nov 10, 2015 16:41 Post subject: |
|
|
Okay then!
Patch is merged upstream and a supposedly-working version can be grabbed off IC if you don't want to build yourself. _________________ silm.pw, a player-driven Forgotten Realms NWN1 persistent world for tinkerers. |
|
Back to top |
|
|
Baaleos
Joined: 02 Sep 2007 Posts: 830
|
Posted: Fri Nov 20, 2015 16:55 Post subject: |
|
|
Anyone able to lend me a hand?
Quote: |
[Dynamic-linking native method java.util.zip.ZipFile.getEntryMethod ... JNI]
[Dynamic-linking native method java.util.zip.ZipFile.getEntryBytes ... JNI]
[Dynamic-linking native method java.util.zip.ZipFile.freeEntry ... JNI]
[Dynamic-linking native method java.util.zip.Inflater.initIDs ... JNI]
[Dynamic-linking native method java.util.zip.Inflater.init ... JNI]
[Dynamic-linking native method java.util.zip.Inflater.inflateBytes ... JNI]
[Dynamic-linking native method java.util.zip.ZipFile.read ... JNI]
[Dynamic-linking native method java.util.zip.Inflater.reset ... JNI]
Exception in thread "main" [Dynamic-linking native method java.io.FileOutputStream.writeBytes ... J NI]
java.lang.NoClassDefFoundError: org/nwnx/nwnx2/jvm/TestRunner
[Dynamic-linking native method java.lang.Throwable.getStackTraceDepth ... JNI]
[Dynamic-linking native method java.lang.Throwable.getStackTraceElement ... JNI]
Caused by: java.lang.ClassNotFoundException: org.nwnx.nwnx2.jvm.TestRunner
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
FATAL ERROR in native method: while executing native code FindClass(initListener)
|
What am I missing?
I am using bog standard - straight from the box.
Quote: |
[JVM]
# Specify your classpath here.
# You will at least need the org.nwnx bundle jar and all the
# custom classes you intend to load. If you're using some fancy
# framework, you can load org.nwnx.nwnx2.java in setup() too.
classpath="/home/ubuntu/jar/org.nwnx.nwnx2.java.jar"
# You can specify additional options to your VM here.
# The defaults are probably only useful for developers and
# will spam your server console.
vmOptions="-verbose:jni -Xcheck:jni"
# To attach a remote debugger:
# With Eclipse, just load your project code, and add a new remote debug session
# to the given host and port. Set a breakpoint, and watch it stop there.
# vmOptions="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000"
# Print each event and token to the console as it occurs.
# Useful to see what is going on, but makes the server console
# otherwise unusable on any busy server.
printEvents=1
# Prints each NWScript call to stdout as it occurs.
# For really bad cases of WTF-is-going-on (Thouch attaching a debugger
# to the JVM will be of more help).
debugNWScriptCalls=0
# This is a class that has the following methods:
# static void setup() // Called immediately after JVM initialisation.
# static void init() // Called AFTER resolving all classes and methods.
# static void shutdown() // Called immediately before exit, after module unload (NO NWN context).
# Visibility of methods does not matter, nwnx_jvm finds them anyways.
# The provided jar contains a TestRunner which does various sanity tests.
# It is suggested to run it at least once with that.
initListener=org/nwnx/nwnx2/jvm/TestRunner
# This is a class that has the following methods:
# static void event(NWObject objSelf, String event)
# Visibility of methods does not matter, nwnx_jvm finds them anyways.
# The provided jar contains a event listener. You can listen for events
# by calling Scheduler.addSchedulerListener and implementing the interface.
eventListener=org/nwnx/nwnx2/jvm/Scheduler
# This is a class that has the following methods:
# static void token(NWObject objSelf, String token)
# Visibility of methods does not matter, nwnx_jvm finds them anyways.
# The provided jar file implements a token listener. See the README for details
# as to what this actually is for.
tokenListener=org/nwnx/nwnx2/jvm/Scheduler
# This is a class that has the following methods:
# static void sco(String key, byte[] gffData)
# static byte[] rco(String key)
# Visibility of methods does not matter, nwnx_jvm finds them anyways.
# The provided jar implements a Observer pattern. Register with
# SCORCO.addSCORCOListener(...) to handle SCO/RCO-events.
# The provided TestRunner tests SCO/RCO *IF* your module publishes
# a event named "creature_hb". (Don't test on creature spawn, infinite loop).
scorcoListener=org/nwnx/nwnx2/jvm/SCORCO
# This is a class that has the following methods:
# static byte[] demandRes(String resRef)
# Visibility of methods does not matter, nwnx_jvm finds them anyways.
# The provided jar implements a Observer pattern. Register with
# ResMan.addResManListener(...) to handle ResMan-events.
# The provided TestRunner tests ResMan.
resmanListener=org/nwnx/nwnx2/jvm/ResMan
# The String conversation class. You can set
# your used charset at runtime there or write your own. It's usually
# safe to just keep it as-is if you're in ISO-8859-1.
convClass=org/nwnx/nwnx2/jvm/Conv
|
and
Quote: |
#!/bin/sh
export LD_PRELOAD=./nwnx2.so
export LD_LIBRARY_PATH=lib/:/usr/lib/jvm/java-7-openjdk-i386/jre/lib/i386/client:$LD_LIBRARY_PATH
./nwserver \
-publicserver 1 \
-servername ServerName \
-dmpassword mYpASS \
-oneparty 0 \
-pvp 0 \
-difficulty 2 \
-elc 1 \
-reloadwhenempty 0 \
-module "MyPW" \
-maxclients 64 \
-servervault 1 \
-maxlevel 40 \
-gametype 0 \
-autosaveinterval 0 \
"$@"
|
|
|
Back to top |
|
|
elven
Joined: 28 Jul 2006 Posts: 259 Location: Germany
|
Posted: Fri Nov 20, 2015 18:20 Post subject: |
|
|
Baaleos wrote: | Anyone able to lend me a hand?
Quote: |
Caused by: java.lang.ClassNotFoundException: org.nwnx.nwnx2.jvm.TestRunner
|
What am I missing?
|
this looks like it cant find the testrunner class. make sure classpath is correct (check if running in a chroot) _________________ silm.pw, a player-driven Forgotten Realms NWN1 persistent world for tinkerers. |
|
Back to top |
|
|
Baaleos
Joined: 02 Sep 2007 Posts: 830
|
Posted: Fri Nov 20, 2015 18:59 Post subject: |
|
|
Looks like there was a typo, but correcting it didnt fix it.
I had
classpath="/home/ubuntu/jar/org.nwnx.nwnx2.java.jar"
When the filename is actually:
classpath="/home/ubuntu/jar/org.nwnx.nwnx2.jvm.jar"
Im not an expert with Ubuntu, I did recently convert this ubuntu server from a paravirtual to hypervirtual, and one of the commands I did during the conversion was chroot - but I don't use chroot during normal operations - unless it gets done automatically during startup??
Quote: |
[Dynamic-linking native method java.util.zip.Inflater.init ... JNI]
[Dynamic-linking native method java.util.zip.Inflater.inflateBytes ... JNI]
[Dynamic-linking native method java.util.zip.ZipFile.read ... JNI]
[Dynamic-linking native method java.util.zip.Inflater.reset ... JNI]
Exception in thread "main" [Dynamic-linking native method java.io.FileOutputStream.writeBytes ... JNI]
java.lang.NoClassDefFoundError: org/nwnx/nwnx2/jvm/TestRunner
[Dynamic-linking native method java.lang.Throwable.getStackTraceDepth ... JNI]
[Dynamic-linking native method java.lang.Throwable.getStackTraceElement ... JNI]
Caused by: java.lang.ClassNotFoundException: org.nwnx.nwnx2.jvm.TestRunner
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
FATAL ERROR in native method: while executing native code FindClass(initListener
|
Is there dependencies I need to worry about?
Does the jar file need to be with specific permissions?
I am executing the startup script with sudo - so permisions I would think are satisfied.
I also applied +rwx to the jar file. |
|
Back to top |
|
|
elven
Joined: 28 Jul 2006 Posts: 259 Location: Germany
|
Posted: Fri Nov 20, 2015 19:02 Post subject: |
|
|
Baaleos wrote: |
I am executing the startup script with sudo - so permisions I would think are satisfied. |
Never EVER run nwserver as root. This cannot be overstated.
Try without and see if the jvm then wants to load your jarfile. If not, make sure the path is correct and you aren't running in a chroot. _________________ silm.pw, a player-driven Forgotten Realms NWN1 persistent world for tinkerers. |
|
Back to top |
|
|
Baaleos
Joined: 02 Sep 2007 Posts: 830
|
Posted: Fri Nov 20, 2015 19:07 Post subject: |
|
|
I renamed the jar file and it worked:
Didnt like the old file name:
Quote: |
Registering JNI native method org.nwnx.nwnx2.jvm.NWScript.getEffects]
[Registering JNI native method org.nwnx.nwnx2.jvm.NWScript.getItemProperties]
[Registering JNI native method org.nwnx.nwnx2.jvm.NWScript.getItemsInInventory]
[Registering JNI native method org.nwnx.nwnx2.jvm.NWScript.getObjectsInArea]
[Registering JNI native method org.nwnx.nwnx2.jvm.NWScript.getObjectsInShape]
[Registering JNI native method org.nwnx.nwnx2.jvm.NWScript.getFactionMembers]
[Registering JNI native method org.nwnx.nwnx2.jvm.NWScript.getObjectsInPersistentObject]
[Dynamic-linking native method java.io.FileOutputStream.writeBytes ... JNI]
Initializing TestRunner. This class runs various sanity tests and benchmarks.
If anything in this class makes your server crash, something is wrong and NEEDs to be fixed!
You need to load a module that has at least one event firing on a creature sometime.
JVM plugin registered.
|
|
|
Back to top |
|
|
Baaleos
Joined: 02 Sep 2007 Posts: 830
|
Posted: Fri Nov 20, 2015 19:38 Post subject: |
|
|
Yeah - I just do sudo anytime I need to debug permissions etc
I have it running as the default ubuntu user
This machine runs in AWS anyway, so its completely disposable. |
|
Back to top |
|
|
elven
Joined: 28 Jul 2006 Posts: 259 Location: Germany
|
Posted: Sat Nov 21, 2015 13:26 Post subject: |
|
|
Baaleos wrote: | Yeah - I just do sudo anytime I need to debug permissions etc
I have it running as the default ubuntu user
This machine runs in AWS anyway, so its completely disposable. |
Glad you got it working. _________________ silm.pw, a player-driven Forgotten Realms NWN1 persistent world for tinkerers. |
|
Back to top |
|
|
Baaleos
Joined: 02 Sep 2007 Posts: 830
|
Posted: Sat Nov 21, 2015 21:26 Post subject: |
|
|
Any idea what this means?
Quote: |
[Registering JNI native method org.nwnx.nwnx2.jvm.NWScript.getObjectsInArea]
[Registering JNI native method org.nwnx.nwnx2.jvm.NWScript.getObjectsInShape]
[Registering JNI native method org.nwnx.nwnx2.jvm.NWScript.getFactionMembers]
[Registering JNI native method org.nwnx.nwnx2.jvm.NWScript.getObjectsInPersistentObject]
[Dynamic-linking native method java.io.FileOutputStream.writeBytes ... JNI]
Initializing TestRunner. This class runs various sanity tests and benchmarks.
If anything in this class makes your server crash, something is wrong and NEEDs to be fixed!
You need to load a module that has at least one event firing on a creature sometime.
JVM plugin registered.
FUNCTIONS plugin registered.
NAMES plugin registered.
* NWNX2 activated.
Neverwinter Nights Server
Build:8109
Copyright BioWare Corp 1998-2004
Server: Loading...
Checked JNI functions are being used to validate JNI usage
FATAL ERROR in native method: Bad global or local ref passed to JNI
Aborted (core dumped)
|
|
|
Back to top |
|
|
Baaleos
Joined: 02 Sep 2007 Posts: 830
|
Posted: Mon Nov 23, 2015 15:20 Post subject: Ok, so exceptions are gone |
|
|
So got the module up and running.
I am just confused about how one goes about writing functionality in Java and invoking it from nwn.
Also
I see that a ruby script creates NWScript.java from NWScript.nss
Is it possible to add extra include files to the generation, so my own custom include files have Java equivalents?
Would I need to edit fids.rb (to add my method to static IDs)
And then add my method declarations to NWScript.nss or something?
Somehow I dont think that would work- I don't think it would be able to resolve the method definitions?
At the moment I would settle for a short guide on how to actually call Java from within nwn or vice versa.
Eg: Pull a lever, call some Java.
Is it possible to get return values into nwn?
Oh... wait - hold on
I see whats going on now:
Its designed so the whole nwn experience is done in Java.
No returning to nwn, because its intended to be a fully fledged replacement for nwscript.
Thats why the lower level methods are all done in Java, so authors can then rebuild their include files completely in java.
Then they can interact with their nwn objects from inside java, but they still remain within the java context.
I have a module with a single creature in an area:
The test runner class does not seem to be firing any events for that creature:
I would assume that heartbeat or on-spawn would be firing at least?
This is my jvm log:
Quote: |
NWNXJVM
Plugin link: F77614C0
All functions set
* Module loaded successfully.
Fetching & setting default VM Initialization args...
Constructing classpath...
-Djava.class.path=/home/ubuntu/jar/nwnx.jar
Creating the Virtual Machine...
Looking for initListener: org/nwnx/nwnx2/jvm/TestRunner...
Looking up setup method...
Looking up init method...
Looking up shutdown method...
Calling setup method...
Looking for class org/nwnx/nwnx2/jvm/NWScript...
Registering custom functions...
Registering addon functions...
Looking for SCORCOListener: org/nwnx/nwnx2/jvm/SCORCO...
Looking up SCO method...
Looking up RCO method...
Looking for resmanListener: org/nwnx/nwnx2/jvm/ResMan...
Looking up demandRes method...
Looking for class org/nwnx/nwnx2/jvm/NWObject...
Looking for class org/nwnx/nwnx2/jvm/NWVector...
Looking for class org/nwnx/nwnx2/jvm/NWLocation...
Looking for class org/nwnx/nwnx2/jvm/NWEffect...
Looking for class org/nwnx/nwnx2/jvm/NWItemProperty...
Looking for class org/nwnx/nwnx2/jvm/NWvNotInContextException...
Looking for class org/nwnx/nwnx2/jvm/NWInvalidObjectException...
Looking for class org/nwnx/nwnx2/jvm/NWInvalidEffectException...
Looking for class org/nwnx/nwnx2/jvm/NWInvalidItemPropertyException...
Looking for eventListener: org/nwnx/nwnx2/jvm/Scheduler...
Looking up event method...
Looking for tokenListener: org/nwnx/nwnx2/jvm/Scheduler...
Looking up token method...
Looking for convClass: org/nwnx/nwnx2/jvm/Conv...
Calling init method...
Java VM Created and running!
|
|
|
Back to top |
|
|
elven
Joined: 28 Jul 2006 Posts: 259 Location: Germany
|
Posted: Mon Nov 23, 2015 16:39 Post subject: Re: Ok, so exceptions are gone |
|
|
Baaleos wrote: | So got the module up and running.
I am just confused about how one goes about writing functionality in Java and invoking it from nwn. |
You can't invoke nwscript functions from the outside, at least not yet.
Compiled functions are just bytecode in ncs files, and they don't carry symbol information. Additionally, includes don't get compiled into object files but are inlined into whatever script uses them.
The only way to do this right now would be to create wrapper functions or scripts and call from from the JVM side with ExecuteScript() or similar. This is obviously quite ugly and I really wouldn't recommend it.
nwnx_jvm isn't neccessarily designed to completely replace nwscript, this is just a limitation that still exists until someone foolish enough comes along to write a parser/transpiler from nwscript to java so you can at least generate includes without rewriting them by hand.
Calling into JVM is easy - see JVMEVENT() (or similarily named, I forget) to trigger a event in nwnx_jvm. Calling out is easy too, but you need to marshal it into the main thread with Scheduler.assign() or similar (unless you already are inside a event). This is a thread-related restriction that prevents you from breaking the VM stack.
The Testrunner class depends on a module calling any event like this, otherwise nwnx_jvm never sees any activity.
Baaleos wrote: | Would I need to edit fids.rb (to add my method to static IDs)
And then add my method declarations to NWScript.nss or something? |
fids.rb references builtins - that is, script commands the VM exposes that do actual stuff inside nwserver. You can't change or amend that list and just have it work. It has nothing to do with includes written in nwscript. _________________ silm.pw, a player-driven Forgotten Realms NWN1 persistent world for tinkerers. |
|
Back to top |
|
|
Baaleos
Joined: 02 Sep 2007 Posts: 830
|
Posted: Mon Nov 23, 2015 16:55 Post subject: |
|
|
Ah, I get it now - sorta
JVM_EVENT(string ev, object caller = OBJECT_SELF);
This called from nwscript would be the entry point into the Java universe.
I did notice that the NWScript.java does not get a 'getModule' method.
Was this intentional?
I suppose its easily resolved from nwscript :
JVM_EVENT("EntryPointToMyAwesomeJavaFunction",GetModule());
Out of curiosity - Since the JVM persists for the runtime of the nwserver process, I assume accessing static objects etc should be persistent between calls etc
eg: Setting a static bool to be true, then 30 minutes later, it should still exist as a bool. |
|
Back to top |
|
|
elven
Joined: 28 Jul 2006 Posts: 259 Location: Germany
|
Posted: Mon Nov 23, 2015 16:57 Post subject: |
|
|
Baaleos wrote: | Ah, I get it now - sorta
JVM_EVENT(string ev, object caller = OBJECT_SELF);
This called from nwscript would be the entry point into the Java universe.
I did notice that the NWScript.java does not get a 'getModule' method.
Was this intentional?
I suppose its easily resolved from nwscript :
JVM_EVENT("EntryPointToMyAwesomeJavaFunction",GetModule());
Out of curiosity - Since the JVM persists for the runtime of the nwserver process, I assume accessing static objects etc should be persistent between calls etc
eg: Setting a static bool to be true, then 30 minutes later, it should still exist as a bool. |
Module is ALWAYS object ID 0, so there was no point in making you go through a roundtrip. You can just do new NWObject(0) or similar. I think the library already defines this somewhere but I might be wrong. :)
static variables persist as long as the JVM GC doesn't reap them, yes. _________________ silm.pw, a player-driven Forgotten Realms NWN1 persistent world for tinkerers. |
|
Back to top |
|
|
Baaleos
Joined: 02 Sep 2007 Posts: 830
|
Posted: Wed Nov 25, 2015 12:47 Post subject: |
|
|
Getting a sporadic segfault on the jvm
Quote: |
(gdb) where
#0 0xf76e6430 in __kernel_vsyscall ()
#1 0xf74abe0f in ?? ()
#2 0xf7622ff4 in ?? ()
|
Quote: |
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00000000, pid=23088, tid=4147926784
#
# JRE version: OpenJDK Runtime Environment (7.0_85-b01) (build 1.7.0_85-b01)
# Java VM: OpenJDK Client VM (24.85-b03 mixed mode, sharing linux-x86 )
# Derivative: IcedTea 2.6.1
# Distribution: Ubuntu 12.04 LTS, package 7u85-2.6.1-5ubuntu0.12.04.1
# Problematic frame:
# C 0x00000000
#
# Core dump written. Default location: /home/ubuntu/core or core.23088
#
# If you would like to submit a bug report, please include
# instructions on how to reproduce the bug and visit:
# http://icedtea.classpath.org/bugzilla
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
--------------- T H R E A D ---------------
Current thread (0x0df76400): JavaThread "Thread-0" [_thread_in_native, id=23088, stack(0xff83f000,0xff88f000)]
siginfo:si_signo=SIGSEGV: si_errno=0, si_code=1 (SEGV_MAPERR), si_addr=0x00000000
Registers:
EAX=0x0e0557a0, EBX=0x8e834868, ECX=0x00000000, EDX=0x00000000
ESP=0xff88c66c, EBP=0xff88c688, ESI=0x8e834864, EDI=0x0df76400
EIP=0x00000000, EFLAGS=0x00010296, CR2=0x00000000
Top of Stack: (sp=0xff88c66c)
0xff88c66c: f71575af 0e0557a0 00000000 ff88c69c
0xff88c67c: 00000000 ff88c730 ff88c70c ff88c6b8
0xff88c68c: f7175f69 00000000 ff88c70c 0df3121c
0xff88c69c: ff88c70c 8e834868 8e834864 0df76400
0xff88c6ac: 00000000 f460a156 0df76400 ff88c6fc
0xff88c6bc: f460a25b 0df76528 ff88c704 ff88c70c
0xff88c6cc: f4602207 ff88c6d4 00000001 6f656870
0xff88c6dc: ff88c6d4 8e834864 ff88c70c 8e843960
Instructions: (pc=0x00000000)
0xffffffe0:
Register to memory mapping:
EAX=0x0e0557a0 is an unknown value
EBX=0x8e834868 is an oop
{method}
- klass: {other class}
ECX=0x00000000 is an unknown value
EDX=0x00000000 is an unknown value
ESP=0xff88c66c is pointing into the stack for thread: 0x0df76400
EBP=0xff88c688 is pointing into the stack for thread: 0x0df76400
ESI=0x8e834864 is pointing into object: 0x8e834838
{constMethod}
- klass: {other class}
- constants: 0x8e828758 constant pool [1007] for 'org/nwnx/nwnx2/jvm/NWScript' cache=0x8e843960
EDI=0x0df76400 is a thread
Stack: [0xff83f000,0xff88f000], sp=0xff88c66c, free space=309k
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j org.nwnx.nwnx2.jvm.NWScript.getIsObjectValid(Lorg/nwnx/nwnx2/jvm/NWObject;)Z+0
j org.nwnx.nwnx2.jvm.NWObject.apply(I)Lorg/nwnx/nwnx2/jvm/NWObject;+24
v ~StubRoutines::call_stub
--------------- P R O C E S S ---------------
Java Threads: ( => current thread )
=>0x0df76400 JavaThread "Thread-0" [_thread_in_native, id=23088, stack(0xff83f000,0xff88f000)]
0x0df50800 JavaThread "Service Thread" daemon [_thread_blocked, id=23094, stack(0xf3ba5000,0xf3bf6000)]
0x0df4e800 JavaThread "C1 CompilerThread0" daemon [_thread_blocked, id=23093, stack(0xf3bf6000,0xf3c77000)]
0x0df4d000 JavaThread "Attach Listener" daemon [_thread_blocked, id=23092, stack(0xf3f0d000,0xf3f5e000)]
0x0df37800 JavaThread "Finalizer" daemon [_thread_blocked, id=23091, stack(0xf3f5e000,0xf3faf000)]
0x0df35c00 JavaThread "Reference Handler" daemon [_thread_blocked, id=23090, stack(0xf3faf000,0xf4000000)]
Other Threads:
0x0df34400 VMThread [stack: 0xf4116000,0xf4197000] [id=23089]
0x0df53000 WatcherThread [stack: 0xf3b24000,0xf3ba5000] [id=23095]
VM state:not at safepoint (normal execution)
VM Mutex/Monitor currently owned by a thread: None
Heap
def new generation total 4800K, used 1050K [0x6f600000, 0x6fb30000, 0x79c00000)
eden space 4288K, 24% used [0x6f600000, 0x6f706a08, 0x6fa30000)
from space 512K, 0% used [0x6fa30000, 0x6fa30000, 0x6fab0000)
to space 512K, 0% used [0x6fab0000, 0x6fab0000, 0x6fb30000)
tenured generation total 10624K, used 0K [0x79c00000, 0x7a660000, 0x8e800000)
the space 10624K, 0% used [0x79c00000, 0x79c00000, 0x79c00200, 0x7a660000)
compacting perm gen total 12288K, used 335K [0x8e800000, 0x8f400000, 0x92800000)
the space 12288K, 2% used [0x8e800000, 0x8e853eb0, 0x8e854000, 0x8f400000)
ro space 10240K, 58% used [0x92800000, 0x92de2e40, 0x92de3000, 0x93200000)
rw space 12288K, 59% used [0x93200000, 0x9391bb10, 0x9391bc00, 0x93e00000)
Card table byte_map: [0xf445a000,0xf457f000] byte_map_base: 0xf40df000
Polling page: 0xf66b2000
Code Cache [0xf45ff000, 0xf469f000, 0xf65ff000)
total_blobs=168 nmethods=31 adapters=75 free_code_cache=32150Kb largest_free_block=32921600
Compilation events (10 events):
Event: 2.991 Thread 0x0df4e800 27 java.lang.AbstractStringBuilder::ensureCapacityInternal (16 bytes)
Event: 2.991 Thread 0x0df4e800 nmethod 27 0xf4698b08 code [0xf4698c10, 0xf4698cbc]
Event: 2.996 Thread 0x0df4e800 28 java.lang.AbstractStringBuilder::append (48 bytes)
Event: 2.997 Thread 0x0df4e800 nmethod 28 0xf4698d48 code [0xf4698e60, 0xf4698f84]
Event: 3.007 Thread 0x0df4e800 29 java.lang.StringBuilder::append (8 bytes)
Event: 3.008 Thread 0x0df4e800 nmethod 29 0xf46990c8 code [0xf46991c0, 0xf469925c]
Event: 3.025 Thread 0x0df4e800 30 java.nio.Buffer::limit (5 bytes)
Event: 3.025 Thread 0x0df4e800 nmethod 30 0xf46992c8 code [0xf46993c0, 0xf4699440]
|
The information goes on extensively -
It is a sporadic crash onMod load
(I am calling JVM_EVENT on the mod load script.
Sometimes it works, other times it results in the above crash.
Code: |
@Override
public void event(NWObject objSelf, String event) {
//Scheduler.assign(objSelf, null);
int objType = NWScript.getObjectType(objSelf);
String name = NWScript.getName(objSelf, false);
NWScript.printString("This is a string from inside Java!");
NWScript.printString("Executing the Module Stress Tests!");
long startbench = System.currentTimeMillis();
String modName = "";
for (int i = 0; i < 100000; i++){
modName = NWScript.getModuleName();
}
long timebench = System.currentTimeMillis() - startbench;
NWScript.printString("100000 times getModuleName() took " + timebench + " ms: "+ modName);
System.out.println("event on " + objSelf.getObjectId() + ": " + event + ", name = " + name + ", type = " + objType);
String testResman = NWScript.get2DAString("resmantest", "A", 1);
if (!testResman.equals("a2"))
throw new RuntimeException("ResMan not working; expected 'a2', got '" + testResman + "'");
System.out.println("Tested Resman hook: " + testResman);
if (objType == ObjectType.CREATURE) {
System.out.println("Testing placing a temporary effect and retrieving it.");
System.out.println("Creating a effect.");
NWEffect e = NWScript.effectDeaf();
System.out.println("Applying effect: " + e.getEffectId());
NWScript.applyEffectToObject(1, e, objSelf, 7f);
System.out.println("Retrieving effects.");
NWEffect[] e2 = NWScript.getEffects(objSelf);
String ret = ""; for (NWEffect ee : e2) ret += ee.getEffectId() + " ";
System.out.println("The creature has " + e2.length + " effects on himself: " + ret);
System.out.println("Testing retrieving all objects in that area.");
NWObject area = NWScript.getArea(objSelf);
NWObject[] objInArea = NWScript.getObjectsInArea(area);
System.out.println("There are " + objInArea.length + " objects in that area.");
System.out.println("Testing retrieving all faction members.");
NWObject[] members = NWScript.getFactionMembers(objSelf,false);
System.out.println("There are " + members.length + " members.");
System.out.println("Running a generic useless benchmark (Should be around 150ms, give or take)");
long start = System.currentTimeMillis();
for (int i = 0; i < 100000; i++)
NWScript.getPosition(objSelf);
long time = System.currentTimeMillis() - start;
System.out.println("100000 times getPosition() took " + time + " ms");
if (event.equals("creature_hb")) {
System.out.println("Testing SCO/RCO on oid " + objSelf.getObjectId());
byte[] data = SCORCO.saveObject(objSelf);
System.out.println("got " + data.length + " bytes.");
NWObject rco = SCORCO.loadObject(data, NWScript.getLocation(objSelf), null);
if (rco != null) {
System.out.println("RCO worked, name of duplicated object is: " + NWScript.getName(rco, true));
System.out.println("RCO worked, oid of duplicated object is: " + rco.getObjectId());
NWScript.destroyObject(rco, 0f);
} else {
throw new RuntimeException("RCO failed.");
}
}
System.out.println("Press Ctrl+C when you're bored. You should see the shutdown handler print a farewell message.");
}
}
|
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|