logo logo

 Back to main page

The NWNX Community Forum

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Resman stability and dynamic .jrl file
Goto page Previous  1, 2, 3, 4, 5, 6  Next
 
Post new topic   Reply to topic    nwnx.org Forum Index -> Linux development
View previous topic :: View next topic  
Author Message
elven



Joined: 28 Jul 2006
Posts: 259
Location: Germany

PostPosted: Mon Aug 18, 2014 0:18    Post subject: Reply with quote

leo_x wrote:
I agree with everything you've suggested. When I make these changes, should I rename this plugin, so that people aren't confused? I'm guessing that sending them upstream will not be appropriate.


physfs? Uh, fine by me what it's called now, considering that's exactly what it does. We can just list it in the plugin doc (on GH wiki) and call it a day.

At some point I really want to produce some more good documentation for the whole thing; but I dont think the name is a confusing showstopper.

n
Back to top
View user's profile Send private message
leo_x



Joined: 25 Aug 2010
Posts: 75

PostPosted: Mon Aug 18, 2014 0:29    Post subject: Reply with quote

Sorry, I meant the changes to resman. If the hardcoded directory was cut out it will not be backward compatible.
_________________
the awakening (PW Action)
Back to top
View user's profile Send private message
elven



Joined: 28 Jul 2006
Posts: 259
Location: Germany

PostPosted: Mon Aug 18, 2014 0:31    Post subject: Reply with quote

leo_x wrote:
Sorry, I meant the changes to resman. If the hardcoded directory was cut out it will not be backward compatible.


Ah, heh. Maybe better that way. Myself, I'm not too worried about backwards compatibility (since we're not even versioning and you can't reasonably expect to keep a stable API that way), but other folks are. So renaming that if you remove the resman-dir might be a good idea. resman2 ..?

I really dont know right now. :)

n
Back to top
View user's profile Send private message
elven



Joined: 28 Jul 2006
Posts: 259
Location: Germany

PostPosted: Sun Aug 24, 2014 20:35    Post subject: Reply with quote

Alright, one more thing -

Apparently, nwnx_physfs doesn't reload script files for me in a physfs dir. I just copy them in, but any ExecScript in nwserver still runs the old code. Is this because of the ncs cache? Still haven't gotten my head around that. :(
Back to top
View user's profile Send private message
leo_x



Joined: 25 Aug 2010
Posts: 75

PostPosted: Mon Aug 25, 2014 8:27    Post subject: Reply with quote

Yea, sorry... the physfs was whipped up quick to test the resman events. So it only returns something once and will never invalidate the cache. I'll work on fixing all this tonight. As to the physfs directories, I might have to expose the write directory. Since physfs is for games it might expect everything to be static excepting the write directory.
_________________
the awakening (PW Action)
Back to top
View user's profile Send private message
leo_x



Joined: 25 Aug 2010
Posts: 75

PostPosted: Mon Aug 25, 2014 10:07    Post subject: Reply with quote

I uploaded an update. I renamed the version of resman i was working on to nwnx_resources and have updated physfs to use it's new event code.

See here: https://github.com/jd28/nwnx2-linux/tree/ta/plugins/resources
and here: https://github.com/jd28/nwnx2-linux/tree/ta/plugins/physfs

There is no more resman dir. I only tested basic functionality. Physfs was able to serve script files from a directory, no memory leak, and no crashes. I wasn't able to test hot patching files, since I don't have a module on this computer. I exposed the PhysFS write director via nwnx2.ini setting 'write_dir', but I'm not sure that it will be necessary.

I will test more when I get home and have access to a module.
_________________
the awakening (PW Action)
Back to top
View user's profile Send private message
elven



Joined: 28 Jul 2006
Posts: 259
Location: Germany

PostPosted: Mon Aug 25, 2014 14:36    Post subject: Reply with quote

Thanks for your quick reply! I've just tested your new code.

With the same setup (just load0 = /path in nwnx2.ini) and resources + physfs, no script reloading happens if file mtime changes. Not sure what the "physfs write directory" is - I'll ask google later.

Exists doesn't seem to be called - I sprinkled it with some log entries to try and debug this and they never appeared. Then I've added debug logs to DemandRes and it looks looks like PHYSFS_getLastModTime(resref) always returns 0.
Back to top
View user's profile Send private message
leo_x



Joined: 25 Aug 2010
Posts: 75

PostPosted: Mon Aug 25, 2014 15:54    Post subject: Reply with quote

In the phsyfs library it looks like an getLastModTime should resolve to stat on posix systems... and should return -1 on error. But then it does the same if a zip file is mounted too... I'll have to take a closer look. The next version is supposed to have a stat style function.

Hmm, that is odd. I don't see anything obviously wrong with the event hook stuff. It's no printing an error that it wasn't able to connect. It's interesting, I wonder if resource existance check just doesn't get called for all types...and nwserver just bails on a NULL resource data. I see some GIT's are being tested but no NCS or 2da. I never looked closely enought at resman to see notice if it did the same. If that's the case then I think the architecture will have to change again to do some generic query event before any demand...
_________________
the awakening (PW Action)
Back to top
View user's profile Send private message
elven



Joined: 28 Jul 2006
Posts: 259
Location: Germany

PostPosted: Mon Aug 25, 2014 16:05    Post subject: Reply with quote

That's a bugger. Not sure what to do about this - I have no clue about resman internals and a very big list of things that needs doing before digging into that some more.

Let me know if I can help you test stuff, at least (and you can catch me on irc - irc.nwn2source.net/#nwn2cr - too if you want).
Back to top
View user's profile Send private message
leo_x



Joined: 25 Aug 2010
Posts: 75

PostPosted: Mon Aug 25, 2014 16:24    Post subject: Reply with quote

Just looked through the dissamebly and it looks like CExoResMan::Exists is called in very few places. CopyItemAndModify, LoadGIT, some DM messages, and module load... so it is important that it exists in the plugin, but it's not called every Demand unless it got inlined everywhere else...

Thanks, I'll keep working on it.

I've been meaning to give the IRC a try. When are people most active?
_________________
the awakening (PW Action)
Back to top
View user's profile Send private message
elven



Joined: 28 Jul 2006
Posts: 259
Location: Germany

PostPosted: Mon Aug 25, 2014 16:26    Post subject: Reply with quote

They're not. :) It's more kind of a connect-and-lurk thing. Activity happens all the time, but sporadically - there's about 10-20 people in, give or take.

But it's a good place to lurk, set some highlight notifications and catch people if something comes up.
Back to top
View user's profile Send private message
leo_x



Joined: 25 Aug 2010
Posts: 75

PostPosted: Mon Aug 25, 2014 18:09    Post subject: Reply with quote

I'll definitely check it out.

I just pushed an update. I was able to get it load updated NCS files... The issue isn't super clear to me but I think some the resref buffers were ill-formed. There will some weird prints in the logs too. Switching to std::string cured all that.

One weird thing remains... The mtime is getting set properly and prints correctly on the nwnx_resource side, but on the nwnx_physfs side it still prints 0. I forget the proper format thing for long long, maybe that's why?

In any case, it worked with both directories and zip files.
_________________
the awakening (PW Action)
Back to top
View user's profile Send private message
elven



Joined: 28 Jul 2006
Posts: 259
Location: Germany

PostPosted: Thu Sep 04, 2014 17:16    Post subject: Reply with quote

Found another small bug. Not sure where it's coming from:

I'm trying to load an area via nwnx_areas from physfs. Says this in the log:

[Thu Sep 4 15:06:59 2014] File: anr_n001o001u00.are exists 0

area resref is anr_n001o001u000.are, which is within spec (16 chars).

Can confirm it's not nwnx_areas, which reads:

[Thu Sep 4 15:05:16 2014] Creating area 'anr_n001o001u000'
[Thu Sep 4 15:05:16 2014] Loading area 'anr_n001o001u000'
[Thu Sep 4 15:05:16 2014] Load failed: 'anr_n001o001u000'

Had a quick look at the code in resman (and physfs), but didn't find any issues that would point at that. It's also happening in nwnx_redis or any other provider. You got an idea why it's cutting of the last char?
Back to top
View user's profile Send private message
elven



Joined: 28 Jul 2006
Posts: 259
Location: Germany

PostPosted: Thu Sep 04, 2014 18:50    Post subject: Reply with quote

Also, I'm seeing the occasional crash when replacing script resources inside physfs.

Not sure what's up with that either:

Code:
#6  0xe41cd28d in CNWNXResources::DemandRes(CExoResMan*, CRes*, std::string const&, NwnResType) () from ./nwnx_resources.so
#7  0xe41cb5a0 in DemandRes(CExoResMan*, CRes*) () from ./nwnx_resources.so
#8  0x082b3704 in CRes::Demand(void) ()
#9  0x08261cba in CVirtualMachine::ReadScriptFile(CExoString *) ()
#10 0x08262942 in CVirtualMachine::SetUpScriptSituation(CVirtualMachineScript *) ()
#11 0x082625cc in CVirtualMachine::RunScriptSituation(void *, unsigned long, int) ()
#12 0x081c848b in CNWSObject::AIActionDoCommand(CNWSObjectActionNode *) ()
#13 0x081c2838 in CNWSObject::RunActions(unsigned long, unsigned long, unsigned long long) ()
#14 0x08119285 in CNWSCreature::AIUpdate(void) ()
#15 0x08096161 in CServerAIMaster::UpdateState(void) ()
#16 0x080a0530 in CServerExoAppInternal::MainLoop(void) ()
#17 0xe4ec21fb in Hook_MainLoopInner(void*) () from ./nwnx_coreevents.so
#18 0x0804bbe7 in main ()


Can provide the complete core dump if you want to follow this up.
Back to top
View user's profile Send private message
leo_x



Joined: 25 Aug 2010
Posts: 75

PostPosted: Thu Sep 04, 2014 19:24    Post subject: Reply with quote

There's something definitely wrong with what's in the repo at this moment. I was getting double frees at shutdown myself. Not had much chance to work on it tho...

As for the truncated character, I did see that issue before. I think it's even in the orignal resman: https://github.com/NWNX/nwnx2-linux/blob/master/plugins/resman/NWNXResMan.cpp#L84 could be wrong about that tho. If not, I probably copied it over. In this new stuff I was just going to say screw it and use std::string.
_________________
the awakening (PW Action)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Linux development All times are GMT + 2 Hours
Goto page Previous  1, 2, 3, 4, 5, 6  Next
Page 2 of 6

 
Jump to:  
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