View previous topic :: View next topic |
Author |
Message |
highv priest
Joined: 01 Mar 2013 Posts: 111
|
Posted: Thu Apr 18, 2013 10:47 Post subject: NWNX Chat crashes Server |
|
|
The command NWNX!CHAT!GETID is the one causing the crash(I've determined this 100%). I've been trying to figure out why that is for a while now.
Is anyone familiar with this problem?
I would greatly appreciate any help with this situation! |
|
Back to top |
|
|
highv priest
Joined: 01 Mar 2013 Posts: 111
|
Posted: Sun Apr 21, 2013 3:26 Post subject: |
|
|
Are there no more experts left? :/ |
|
Back to top |
|
|
virusman
Joined: 30 Jan 2005 Posts: 1020 Location: Russia
|
Posted: Sun Apr 21, 2013 11:25 Post subject: |
|
|
Never heard about this..
Are you sure you're running GetID on player character? _________________ In Soviet Russia, NWN plays you! |
|
Back to top |
|
|
highv priest
Joined: 01 Mar 2013 Posts: 111
|
Posted: Tue Apr 23, 2013 10:13 Post subject: |
|
|
Yes I apologize I should of posted the log of what it displays the moment of the crash.
I posted it to BioWare, but oddly forgot to post the log here.
NWNX Chat version 0.3.5 for Windows.
(c) 2005-2006 by dumbo (dumbo@nm.ru)
(c) 2006-2008 virusman (virusman@virusman.ru)
Settings:
chat_script: fky_chat2
server_script: fky_chat_srv
max_msg_len: 1024
processnpc: 0
ignore_silent: 0
! ChatProc hooked at 43ca00.
! RunProc located at 5bf9d0.
! GetIDProc located at 452f70.
o ignore_silent = 1
o CHAT: mode=5, from_oID=7F000000, msg='You are now in a No PVP area.', to_ID=00000000
o GETID: oID='7fffffff ', ID=0
I don't particularly care what my players say in tells to each other, but I want the functions capability of using party and tell channels as command able speak channels for NPCs to direct to players :/
One of my passions is AI and I want the players henchmen to be able to speak to them in party and I want to use tells as a means for NPCs to call for help to players.
object oPlayer = OBJECT_SELF;
if( !GetIsObjectValid(oPlayer) ) return;
object oMod = GetModule();
SetLocalString(oPlayer, "NWNX!CHAT!GETID", ObjectToString(oPlayer) + " ");
I commented out everything else to make certain it wasn't anything else. That's the code the runs that causes the crash.
EDIT= There is much more spaces after ObjectToString, but the forums seems to truncate it.
The script runs after 5 seconds as an executescript on the player. I've tested other means however and they all have similar results. I activated it with no delay, changed the delay to 30 seconds, gave them an item to do it themselves, and regardless of the situation it will always cause a crash and never explains why. Judging from the log it's not that nwnx didn't get a result. |
|
Back to top |
|
|
virusman
Joined: 30 Jan 2005 Posts: 1020 Location: Russia
|
Posted: Tue Apr 23, 2013 11:24 Post subject: |
|
|
Try to remove spaces after ObjectToString. _________________ In Soviet Russia, NWN plays you! |
|
Back to top |
|
|
addicted2rpg
Joined: 01 Aug 2008 Posts: 106
|
Posted: Thu Jun 20, 2013 3:04 Post subject: |
|
|
I'm looking into this issue.
Mind if I ask if you open up your nwnx.txt and post your NWNX version? |
|
Back to top |
|
|
NessTea
Joined: 06 Jun 2013 Posts: 9
|
Posted: Thu Jun 20, 2013 22:50 Post subject: |
|
|
Can I get the 0.35 plugin to test it? |
|
Back to top |
|
|
addicted2rpg
Joined: 01 Aug 2008 Posts: 106
|
Posted: Fri Jun 21, 2013 2:06 Post subject: |
|
|
Even I don't have the 0.35 plugin lol. But I have the exact same problem in my .34 which is using my own version of NWNX. I haven't released it yet since its not release tested; since we had the exact same problem and virusman hasn't seen this before until now I am wondering if someone was stalking my github and downloaded it. I strongly doubt that's the reason, since I have been able to get 5 other plugins to run smoothly with it.
I've been able to "bandaid" the original posters problem (aka, not the greatest solution but it stops crashes) - by making some code (DLL side) and script (NWN side) changes, but I'm still doing other enhancements to the chat plugin before putting it up here.
The actual changes were with the return values in the OnRequest() function, copying my results into the Parameters argument and returning NULL instead. The script side changes were to make sure the wrappers called OnRequest with an appropriate amount of memory located. This portion of the NWNX code dealing with return values is literally unchanged from Ingmar Stieger's and virusman's original, so I have no idea why that is a problem. It also passes a simple visual inspection test; its flawless. I don't know why NWN gets unhappy with it. I assumed the problem was related to some of my other experimental features going haywire, until I saw the original post. |
|
Back to top |
|
|
addicted2rpg
Joined: 01 Aug 2008 Posts: 106
|
Posted: Fri Jun 21, 2013 2:21 Post subject: |
|
|
Ah, what the hell, talk is cheap. I'll just show you guys what I'm talking about.
DLL Side, NWNXChat.cpp
Code: |
if (strncmp(Request, "GETID", 5) == 0)
{
unsigned long OID;
unsigned long retrievedID;
for(retrievedID=0; retrievedID < 17;retrievedID++) {
if(Parameters[retrievedID] == ' ') {
Parameters[retrievedID] = 0;
break;
}
}
OID = strtol(Parameters, NULL, 16);
if (m_LogLevel >= logScripter) Log("o GETID: sOID='%s' =? iOID='%x'\n", Parameters, OID);
if (!OID) {
strcpy_s(Parameters, 17, "-1");
}
else {
retrievedID = GetID(OID);
sprintf_s(Parameters, 17, "%ld", retrievedID);
}
if (m_LogLevel >= logScripter) Log("o GETID: ID=%s\n", Parameters);
return NULL;
}
|
NWScript side
Code: |
// 17 chars. Ok, thats actually unchanged :P
SetLocalString(oPC, "NWNX!CHAT!GETID", ObjectToString(oPC)+" ");
|
|
|
Back to top |
|
|
NessTea
Joined: 06 Jun 2013 Posts: 9
|
Posted: Mon Jun 24, 2013 0:17 Post subject: |
|
|
should a module crash without any scripts set in place? i loaded one of the base modules and it dies on load. everything else works fine. |
|
Back to top |
|
|
highv priest
Joined: 01 Mar 2013 Posts: 111
|
Posted: Wed Jun 26, 2013 12:08 Post subject: |
|
|
Ah I'm sorry I had long since forgotten of this topic and moved on, but I come back now it seems o.o. My NWNx version is 2.6.0.1, it's the latest from Zebransky.
No spaces might solve the problem, I haven't tried it yet. In the mean time I can answer Nesstea's question in that if your server crashes upon loading it's most likely using Fast French which executes a mySQL check upon loading that causes the crash. |
|
Back to top |
|
|
NessTea
Joined: 06 Jun 2013 Posts: 9
|
Posted: Fri Jun 28, 2013 0:53 Post subject: |
|
|
we stopped using FF loooong ago. I can have you look at the setup, if you like. |
|
Back to top |
|
|
highv priest
Joined: 01 Mar 2013 Posts: 111
|
Posted: Wed Jul 24, 2013 0:56 Post subject: |
|
|
Sadly the removing of spaces didn't fix it. This is quite the conundrum. The server is utilizing a vast array of already existing functions(almost everything for windows), but regardless of circumstance it seems impossible to stop the chat function from crashing.
o CHAT: mode=14, from_oID=7FFFFFFF, msg='Hmm', to_ID=00000001
I said that to one of the players with complete logging active. I'm presently
on DM does that change anything?
o CHAT: mode=4, from_oID=7FFFFFDC, msg='Need buffs?', to_ID=00000003
o CHAT: mode=5, from_oID=7F000000, msg='You are now in a Full PVP Area.', to_ID=00000002
o CHAT: mode=4, from_oID=7FFFFFDF, msg='sure but i need to regain my levels', to_ID=00000000
o CHAT: mode=5, from_oID=7F000000, msg='You are now in a No PVP area.', to_ID=00000001
o CHAT: mode=D, from_oID=000026AD, msg='NW_I_WAS_ATTACKED', to_ID=FFFFFFFF
o CHAT: mode=D, from_oID=000026B0, msg='NW_I_WAS_ATTACKED', to_ID=FFFFFFFF
o CHAT: mode=D, from_oID=000026B0, msg='NW_ATTACK_MY_TARGET', to_ID=FFFFFFFF
o CHAT: mode=D, from_oID=000026B0, msg='NW_I_WAS_ATTACKED', to_ID=FFFFFFFF
o CHAT: mode=4, from_oID=7FFFFFDC, msg='Ok', to_ID=00000003
Does this information reveal anything that I'm missing? I noticed how it always shows lots of F's for the message sender. |
|
Back to top |
|
|
addicted2rpg
Joined: 01 Aug 2008 Posts: 106
|
Posted: Sat Jul 27, 2013 7:52 Post subject: |
|
|
You are right. Its broke. I've looked on it till my eyes bled and I've given it a rest for awhile. I might take it up again later on.
Even with setting up / organizing the stack perfectly identical to a 'real' call, the chat message function crashes. The ecx register is often used as a parameter in addition to things pushed on, but nothing jumps out at me. I'm thinking there is something about the program state itself that has to be right as a precondition to the call for it to work.
I'll take a look at it (again) next week |
|
Back to top |
|
|
Terra_777
Joined: 27 Jun 2008 Posts: 216 Location: Sweden
|
Posted: Sat Jul 27, 2013 15:40 Post subject: |
|
|
I looked some of the source for chat 0.3.4 and it'll crash in 64bit environments because its allocating memory outside of nwserver and passing it back to nwserver, nwserver doesnt like that.
IE:
Code: | if (strncmp(Request, "GETID", 5) == 0)
{
int OID = strtol(Parameters, 0, 16);
->char *LastID = (char *) malloc(32);
if (!OID)
strcpy(LastID, "-1");
else
sprintf(LastID, "%ld", GetID(OID));
if (m_LogLevel >= logScripter)
Log("o GETID: oID='%s', ID=%s\n", Parameters, LastID);
->return LastID;
} |
Its not just done in GETID either, new/delete is also used in SendMessage and probably in more places. _________________ I dun have any signature, I'm happy anyway. |
|
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
|