View previous topic :: View next topic |
Author |
Message |
elven
Joined: 28 Jul 2006 Posts: 259 Location: Germany
|
Posted: Wed Nov 25, 2015 13:59 Post subject: |
|
|
Baaleos wrote: | Getting a sporadic segfault on the jvm
(gdb) where
#0 0xf76e6430 in __kernel_vsyscall ()
#1 0xf74abe0f in ?? ()
#2 0xf7622ff4 in ?? ()
|
Check the other threads in gdb too, maybe they're more informative.
(info threads, thread x, bt) _________________ 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 16:36 Post subject: |
|
|
Quote: |
(gdb) info threads
Id Target Id Frame
11 LWP 23098 0xf7737430 in __kernel_vsyscall ()
10 LWP 23097 0xf7737430 in __kernel_vsyscall ()
9 LWP 23096 0xf7737430 in __kernel_vsyscall ()
8 LWP 23095 0xf7737430 in __kernel_vsyscall ()
7 LWP 23094 0xf7737430 in __kernel_vsyscall ()
6 LWP 23093 0xf7737430 in __kernel_vsyscall ()
5 LWP 23092 0xf7737430 in __kernel_vsyscall ()
4 LWP 23091 0xf7737430 in __kernel_vsyscall ()
3 LWP 23090 0xf7737430 in __kernel_vsyscall ()
2 LWP 23089 0xf7737430 in __kernel_vsyscall ()
* 1 LWP 23088 0xf7737430 in __kernel_vsyscall ()
thread 1
[Switching to thread 1 (LWP 23088)]
#0 0xf7737430 in __kernel_vsyscall ()
(gdb) bt
#0 0xf7737430 in __kernel_vsyscall ()
#1 0xf74fce0f in ?? ()
#2 0xf7673ff4 in ?? ()
(gdb) thread 2
[Switching to thread 2 (LWP 23089)]
#0 0xf7737430 in __kernel_vsyscall ()
(gdb) bt
#0 0xf7737430 in __kernel_vsyscall ()
#1 0xf7682d13 in ?? ()
#2 0x00000000 in ?? ()
(gdb) thread 3
[Switching to thread 3 (LWP 23090)]
#0 0xf7737430 in __kernel_vsyscall ()
(gdb) bt
#0 0xf7737430 in __kernel_vsyscall ()
#1 0xf768296b in ?? ()
#2 0x00000000 in ?? ()
Got this far and realized they were all the same?
|
|
|
Back to top |
|
|
elven
Joined: 28 Jul 2006 Posts: 259 Location: Germany
|
Posted: Wed Nov 25, 2015 16:49 Post subject: |
|
|
Baaleos wrote: | Quote: |
Got this far and realized they were all the same?
|
|
That looks kind of broken to me. I suspect there might be some deeper issue. Is the crash 100% reproducible (i.e. does it happen every time?)
It's definitely a NULL deref causing this. Might be some bug/issue I introduced when porting it to the new API. What did you do to get around the JNI Xcheck errors?
Either way, I'll have to have a look myself but I really can't promise a timeline on this. :( _________________ 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 16:56 Post subject: |
|
|
To get the error to occur - I do have to start , stop and restart the ./nwnstartup.sh a few times to get it to occur.
It seems to be like 1/5 times causes a crash.
Code: |
#include "nwnx_haks"
#include "inc_jvm"
void SetHakHiddenVoid(string hak, int level=1)
{
SetHakHidden(hak,level);
}
void SetFallbackTLKVoid(string tlk)
{
SetFallBackTLK(tlk);
}
void DelayedStart()
{
ExecuteScript("aps_onload",GetModule());
PrintString("Attempting to call OnModuleLoad Java method");
JVM_EVENT("OnModuleLoad", OBJECT_SELF);
ExecuteScript("x2_mod_def_load",OBJECT_SELF);
DelayCommand(1.00,SetEnhanceScript("pl_load_enhance"));
DelayCommand(1.00,SetHakHiddenVoid("cep2_top_2_60",5));
DelayCommand(1.00,SetHakHiddenVoid("cep2_core7",5));
DelayCommand(1.00,SetHakHiddenVoid("cep2_core6",5));
DelayCommand(1.00,SetHakHiddenVoid("cep2_core5",5));
DelayCommand(1.00,SetHakHiddenVoid("cep2_core4",5));
DelayCommand(1.00,SetHakHiddenVoid("cep2_core3",5));
DelayCommand(1.00,SetHakHiddenVoid("cep2_core2",5));
DelayCommand(1.00,SetHakHiddenVoid("cep2_core1",5));
DelayCommand(1.00,SetHakHiddenVoid("cep2_core0",5));
DelayCommand(1.00,SetHakHiddenVoid("cep2_add_phenos5",5));
DelayCommand(1.00,SetHakHiddenVoid("cep2_add_phenos4",5));
DelayCommand(1.00,SetHakHiddenVoid("cep2_add_phenos3",5));
DelayCommand(1.00,SetHakHiddenVoid("cep2_add_phenos2",5));
DelayCommand(1.00,SetHakHiddenVoid("cep2_add_phenos1",5));
DelayCommand(1.00,SetHakHiddenVoid("cep2_build",5));
DelayCommand(1.00,SetHakHiddenVoid("cep2_add_tiles2",5));
DelayCommand(1.00,SetHakHiddenVoid("cep2_add_tiles1",5));
DelayCommand(1.00,SetHakHiddenVoid("cep2_add_skies",5));
DelayCommand(1.00,SetHakHiddenVoid("cep2_add_loads",5));
DelayCommand(1.00,SetHakHiddenVoid("cep2_add_doors",5));
DelayCommand(1.00,SetFallbackTLKVoid(""));
}
void main()
{
SetLocalString(GetModule(), "NWNX!INIT", "1");
GetLocalObject(GetModule(),"NWNX!INIT");
DelayCommand(5.00,DelayedStart());
}
|
This is my onModLoad script - which then calls the TestRunner
The JNI Xcheck errors - I googled them, found a thread in the forums where someone (possibly yourself? - I cant remember) suggested removing that from the Java args
My vmArgs are:
Quote: |
# 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"
|
On an occasion when it does not crash:
Quote: |
Server: Module loaded
Demand ResRef: _mod_load.ncs
INIT(S): valid ret=0x082041ec
INIT(O): valid ret=0x08203e79
Demand ResRef: _mod_load.ncs
Demand ResRef: aps_onload.ncs
* Library ODBC!SPACER does not exist.
event on 0: OnModuleLoad, name = CEP - Starter 2.60, type = 0
Demand ResRef: resmantest.2da
Returning our own 2da table!
Got data from Hook, returning (size = 40): 2DA V2.0
A B
0 a1 b1
1 a2 b2
H
Tested Resman hook: a2
E 0 OnModuleLoad 0 s 209123 u 100006 calls (d: 0)
Demand ResRef: x2_mod_def_load.ncs
Demand ResRef: _mod_load.ncs
Demand ResRef: _mod_load.ncs
Demand ResRef: _mod_load.ncs
Demand ResRef: _mod_load.ncs
Demand ResRef: _mod_load.ncs
Demand ResRef: _mod_load.ncs
Demand ResRef: _mod_load.ncs
Demand ResRef: _mod_load.ncs
Demand ResRef: _mod_load.ncs
Demand ResRef: _mod_load.ncs
Demand ResRef: _mod_load.ncs
Demand ResRef: _mod_load.ncs
Demand ResRef: _mod_load.ncs
Demand ResRef: _mod_load.ncs
Demand ResRef: _mod_load.ncs
Demand ResRef: _mod_load.ncs
Demand ResRef: _mod_load.ncs
Demand ResRef: _mod_load.ncs
Demand ResRef: _mod_load.ncs
Demand ResRef: _mod_load.ncs
Demand ResRef: _mod_load.ncs
Demand ResRef: _mod_load.ncs
|
Just restarted the server 4 times and eventually got this again:
Quote: |
Demand ResRef: phod_fx_gehenna1.pw
Demand ResRef: plc_v03.pwk
Demand ResRef: plc_s01.pwk
.
Server: Module loaded
Demand ResRef: _mod_load.ncs
INIT(S): valid ret=0x082041ec
INIT(O): valid ret=0x08203e79
Demand ResRef: _mod_load.ncs
Demand ResRef: aps_onload.ncs
* Library ODBC!SPACER does not exist.
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00000000, pid=27243, tid=4148451072
#
# 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
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumpi ng, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /home/ubuntu/hs_err_pid27243.log
#
# 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.
#
Aborted (core dumped)
|
I don't know if this matters
The server instance I am using :
It was originally a Linux 32bit Paravirtual VM with 32bit JDK/JAVA installed
I then ported that system to a hypervirtual system
Using the below steps:
http://serverfault.com/questions/439976/create-an-aws-hvm-linux-ami-from-an-existing-paravirtual-linux-ami
So technically - the OS I am using is a 32bit Ubuntu, with 32bit Java runtime, but the hardware on the HVM instance is likely to be 64bit.
Should I perhaps try reinstalling my Java runtime - see if it installs the 64bit one.
uname -p picks up the 64bit arch
Code: |
ubuntu@ip-10-0-0-58:~$ uname -p
x86_64
|
But technically I still have the 32bit installs - which allows me to do builds for nwnx on the system.
Last edited by Baaleos on Wed Nov 25, 2015 17:06; edited 1 time in total |
|
Back to top |
|
|
elven
Joined: 28 Jul 2006 Posts: 259 Location: Germany
|
Posted: Wed Nov 25, 2015 17:04 Post subject: |
|
|
Quote: | /home/ubuntu/hs_err_pid27243.log |
Can you upload the full .log somewhere and link it for me please? _________________ silm.pw, a player-driven Forgotten Realms NWN1 persistent world for tinkerers. |
|
Back to top |
|
|
Baaleos
Joined: 02 Sep 2007 Posts: 830
|
|
Back to top |
|
|
Baaleos
Joined: 02 Sep 2007 Posts: 830
|
Posted: Wed Nov 25, 2015 17:30 Post subject: |
|
|
Tried installing a 64bit jdk - but it wont let me cause the Ubuntu is 32bit or something
Its weird - uname gives me
Code: |
ubuntu@ip-10-0-0-58:~$ uname --all
Linux ip-10-0-0-58 3.13.0-48-generic #80-Ubuntu SMP Thu Mar 12 11:16:15 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
ubuntu@ip-10-0-0-58:~$ uname -m
x86_64
ubuntu@ip-10-0-0-58:~$ uname -p
x86_64
ubuntu@ip-10-0-0-58:~$ uname -o
GNU/Linux
ubuntu@ip-10-0-0-58:~$ uname --version
uname (GNU coreutils) 8.13
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by David MacKenzie.
|
So - It thinks its 64bit, even though it started as a 32bit OS.
Everything in nwnx builds (mostly)
- When using make
Not when using ./install.sh |
|
Back to top |
|
|
Baaleos
Joined: 02 Sep 2007 Posts: 830
|
Posted: Wed Nov 25, 2015 18:39 Post subject: |
|
|
Seems to be here:
Quote: |
Stack: [0xffb4f000,0xffb9f000], sp=0xffb9d28c, free space=312k
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
|
Something inside :NWScript.getIsObjectValid(o);
Is causing issues?
Code: |
/**
* Creates a new NWObject by walking the registered class handlers
* and returning the first one that matches.
* Throws an exception if no object matches, or returns null when
* no handlers have been registered.
* @param oid
* @return a NWObject
*/
public static NWObject apply(int oid) {
if (objectInvalidIsNull && oid == 0x7f000000)
return null;
NWObject o = new NWObject(oid);
boolean valid = NWScript.getIsObjectValid(o);
int objType = NWScript.getObjectType(o);
String resref = NWScript.getResRef(o);
String tag = NWScript.getTag(o);
NWObject ret = null;
try {
for (ApplyListener a : applyListeners)
if ((ret = a.preApply(oid, valid, objType, resref, tag, o)) != null)
break;
if (ret == null)
if (classHandlers.size() > 0) {
for (ObjectHandler e : classHandlers) {
ret = e.handleObjectClass(o, valid, objType, resref, tag);
if (ret != null) {
for (ApplyListener a : applyListeners)
a.newObject(valid, objType, resref, tag, ret);
break;
}
}
if (ret == null)
throw new RuntimeException("No class handler that matches " + oid + " registered.");
} else
return null;
for (ApplyListener a : applyListeners)
a.postApply(oid, valid, objType, resref, tag, ret);
} catch (RuntimeException e) {
for (ExceptionHandler h : exceptionHandlers)
if (h.handleException(e))
return null;
throw e;
}
return ret;
}
|
|
|
Back to top |
|
|
Baaleos
Joined: 02 Sep 2007 Posts: 830
|
Posted: Tue Dec 01, 2015 13:36 Post subject: |
|
|
Is the absence of GetFirstPC and GetNextPC intentional?
Is there a better way of getting the PC's in the server?
I am attempting to create a heartbeat / loop segment in JVM.
So getting the player list while in java would be better than jumping back into NWScript each time for each player. |
|
Back to top |
|
|
elven
Joined: 28 Jul 2006 Posts: 259 Location: Germany
|
Posted: Tue Dec 01, 2015 15:29 Post subject: |
|
|
Baaleos wrote: | Is the absence of GetFirstPC and GetNextPC intentional?
Is there a better way of getting the PC's in the server?
I am attempting to create a heartbeat / loop segment in JVM.
So getting the player list while in java would be better than jumping back into NWScript each time for each player. |
Check org_nwnx_nwnx2_jvm_registerNWScript_addon.cpp (java natives in http://ci.swordcoast.net/job/nwnx2-linux/ws/plugins/jvm/java/src/org/nwnx/nwnx2/jvm/NWScript.java)
All the GetFirst/GetNext iterators have been collapsed into functions that return arrays.
This may not be the best approach though and I was thinking about bringing the iterator functions back, so you can break out of them; otherwise there is needless overhead when retrieving large object lists (like all in a area). This isn't as huge a deal though as it feels like at first glance. _________________ silm.pw, a player-driven Forgotten Realms NWN1 persistent world for tinkerers. |
|
Back to top |
|
|
Baaleos
Joined: 02 Sep 2007 Posts: 830
|
Posted: Tue Dec 01, 2015 16:09 Post subject: |
|
|
Cheers,
I didn't realize there was a java method there for it.
getPCs() - see it now.
I thought it might have been refactored - as I noticed a lot of the iterators were gone.
I was working on a work-around for its absence - to capture the NWObject for players on login, and add to a static collection - then loop through the collection.
Now I don't need to. |
|
Back to top |
|
|
elven
Joined: 28 Jul 2006 Posts: 259 Location: Germany
|
Posted: Tue Dec 01, 2015 16:13 Post subject: |
|
|
Baaleos wrote: | Cheers,
I didn't realize there was a java method there for it.
getPCs() - see it now.
I thought it might have been refactored - as I noticed a lot of the iterators were gone.
I was working on a work-around for its absence - to capture the NWObject for players on login, and add to a static collection - then loop through the collection.
Now I don't need to. |
The thought of doing that makes me cringe!
But if you were crazy enough, you could just loop player object IDs to see which one has TURDs and stop when you get bored (0x7ffffffe downto 0x7fff0000).
Back in sanity land, I'll put real enumerables on my mental list, but it's more tricky than it seems at first. GetFirst/Next is really brittle when used in the context of multiple fibers/threads, so just making it a atomic op seemed the best thing to do in the face of naive users. The only case where it is really wasteful is when retrieving huge lists (like all objects in an area).
If performance ever becomes an issue it would be trivial to rewrite it to bypass the VM altogether. The current implementation is rather crude. _________________ silm.pw, a player-driven Forgotten Realms NWN1 persistent world for tinkerers. |
|
Back to top |
|
|
Baaleos
Joined: 02 Sep 2007 Posts: 830
|
Posted: Tue Dec 01, 2015 18:01 Post subject: |
|
|
Ok, Makes sense
I am looking at making some specific special types for my version of nwn jvm.
Eg: NWPlayer etc which would extend NWCreature, Extending NWObject etc
NWGod which extends NWPlayer etc
I am using this primarily for the redesign and release of my NWN Player based God System.
The system in my windows PW IS very heavily reliant on a Loop which does lots of calculations to determine divine energy gain for the God in question.
Eg: Is the player invulnerable - if so, thats a drain of 20 energy per minute.
What level are they raised to (they can raise and lower their nwn level at will) - 5 energy per level etc
So I was working out the combined income of their energy (which involved counting all of their followers)
And then subtracting the energy they are spending per minute from their income.
This determines the amount to add or subtract per minute.
So I am trying to refactor this entire calculation phase to be entirely java based - Hopefully even get it to run in a parallel thread.
The only thing that the calculation method needs to do is determine positive or negative number, then Set a local or persistent int for the God (player) to say how much energy they now have.
I would imagine that such a simple thing could be done in a parallel thread without causing too much hassle - I saw that Scheduler.Assign needs to be called - I assume this injects back into MainLoop to preserve stack? |
|
Back to top |
|
|
elven
Joined: 28 Jul 2006 Posts: 259 Location: Germany
|
Posted: Wed Dec 02, 2015 18:00 Post subject: |
|
|
Baaleos wrote: | ..gods..
I would imagine that such a simple thing could be done in a parallel thread without causing too much hassle - I saw that Scheduler.Assign needs to be called - I assume this injects back into MainLoop to preserve stack? |
That god system sounds intriguing. How are you managing power gain/followers for players? Is that other players, NPCs, or a number defined by the DMs?
re: threads. You should be able to assign from other threads, yes. It has been a looong time since I looked at that though.
My advice would be to write it singlethreaded at first and then use the nwn scheduler to trigger events instead - much simpler this way. _________________ silm.pw, a player-driven Forgotten Realms NWN1 persistent world for tinkerers. |
|
Back to top |
|
|
Baaleos
Joined: 02 Sep 2007 Posts: 830
|
Posted: Wed Dec 02, 2015 18:47 Post subject: |
|
|
In the original version that I was using - It was able to handle npcs and players at the same time. (for followers)
For players - it was a simple persistent int that mapped the player in pwdata (follower) to a god (in the gods table)
Gods when they ascend get added in there with a unique incrementing ID field.
As for NPC's
It worked on a basis of tag / resref to determine if the npc had already devoted itself to a god.
The god players could actually place Missionaries around the server (imagine a town crier)
They spout religious nonsense and their goal is to convert NPC's nearby to your faith periodically.
With this in mind - a God could actually be at war with another god, for the hearts and minds of NPC's in a market place.
Eg: One minute he has 30 NPC's following him, but then another God places his missionary in the same area.
This would cause the follower count to fluctuate for both gods.
Because being a God is almost as powerful as being a DM, one of those Gods could theoretically teleport to rival Missionaries and kill them - but then the other God could do the same.
So the idea is that the tag usually indicates a unique NPC.
However for the instances where one tag is shared across many NPC's - it does however only count as a single NPC. This being the case - you cannot convert 20 monsters and mobs of the same type to your faith and expect +20 followers, it would count as a single follower, only scripted NPCs, guards or anything that has a unique Tag gets counted as a +1.
As far as the power gain goes.
Gods can choose to be strong magically - casters
or
If they want to be strong physically - Combat oriented
For a caster - they don't need to worry much about gaining nwn levels, they can for all its worth, be level 1, and just have immortality toggled on.
Toggles such as immortality would cost X faith per minute.
Each nwn level that they give themselves, also costs something like 5 faith per level.
So being level 1 = 5 faith required (their own character counts as a follower supplying the faith required for this)
For immortality, they might need 5 or 10 or something faith to use that.
So other toggles can be used too: Infinite spellcasting?
this can also consume faith/energy.
So - after all the taxes are done for energy, any positive energy is then added to a reservoir of energy.
Playertool / feats are used to do other caster oriented abilities.
Such as teleport (point and click)
Opening portals (point and click between locations)
Shooting energy blasts (point and click)
Summoning creatures (you get the picture)
So the point here is - that the more energy they have in their reservoir of energy, the more of these godly powers they can cast in succession.
So - being weak physically, means they can spam the energy blasts, at the expense of not being all that accurate with a sword.
If however, they don't wana rely on energy blasts
They can use all that incoming faith/energy to enhance their physical form.
They can increase their nwn level at a cost of something like 5 faith per level.
They can also increase ability scores and skills at a 1 faith per point.
This way they can level up as 1 Level Sorc, with 39 levels or more as warrior and still achieve a 40 spellcraft and high charisma.
The idea here is that they have used the faith of their followers to give themselves super strength.
So the lesson here is that newbie gods will not be able to have their cake and eat it.
If they want to have level 40 and be a caster - they need to get a lot of followers.
Keep those followers, and protect them like an oil well of energy from opposing gods.
The God system also lets Gods change their biographies, set their portfolios.
Eg:
Primary, Secondary and Tertiary realms of influence.
Eg: I am the God of Death, Time and Decay
The way this is reflected in the system design is that there are 10 DM Tool feats.
I create 5 scripts for each portfolio.
Ranging from 1 weak power, to 5 the strongest power in that area.
Eg: Death level 1 - weak damage over time that heals ally's near the enemy being affected for damage sustained.
Death Level 5 - summons zombie minions that recover after death unless killed by divine or holy or fire.
So - if we have 5 powers per portfolio, and 3 portfolio, it occurs to me that
you should have 5 (all) of your main portfolio, 3 of your secondary, and 2 of your tertiary.
This adds you to 10 powers specific to your combination of Realms of Influence.
Meaning that
The God of Death, Time and Decay can do the most powerful of necromatic feats, but cannot do the most powerful Time miracles.
To do the most powerful of Time feats, they would need to be a God of Time (primary)
And once again- these abilities cost faith/energy to use.
In any case-
I had a nss script that ran as a hb to calculate the energy expenditure and income for each God.
However it was buggy because I was trying to cache values to avoid constant DB queries to recount the followers.
Eg: It meant that when the hb ran, there was a chance that the energy income per minute had not updated yet.
If I can refactor the system to jvm - I hope to make use of my servers second core, and run much of the calculations on the second core, and only yield to nwn when setting locals or applying effects to characters etc. |
|
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
|