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 
 
NWNX ODBC2 object storage engine
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8  Next
 
Post new topic   Reply to topic    nwnx.org Forum Index -> General Discussion
View previous topic :: View next topic  
Author Message
Papillon
x-man


Joined: 28 Dec 2004
Posts: 1060
Location: Germany

PostPosted: Fri Jan 21, 2005 18:27    Post subject: Reply with quote

Senalaya wrote:
Are you sure, that it's the malloc() of nwnx_odbc that causes the trouble? Or could it be the memory allocation of the intergrated MySQL/SQLite libaries?

I havn't had any crashes with the ODBC part.


It is no different with the ODBC connection:

Code:

      AllocatePointer(columnSizePtr);
      SQLGetData(hstmt, 1, SQL_C_BINARY, pReturn, columnSizePtr, &cbData);


The AllocatePointer() causes the troubles, apparently.
_________________
Papillon
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Makzimia De Graf



Joined: 31 Dec 2004
Posts: 55
Location: San Diego CA.

PostPosted: Fri Jan 21, 2005 18:30    Post subject: Reply with quote

What objects are we talking about here Pap? per player? per item? per transaction? just trying to clarify please.
_________________
Makzimia De Graf

DM/Creator Island of Fredian
fredian.game-host.org:5123
Forums at http://castille.us/fredian/Forums
Back to top
View user's profile Send private message
Papillon
x-man


Joined: 28 Dec 2004
Posts: 1060
Location: Germany

PostPosted: Fri Jan 21, 2005 18:44    Post subject: Reply with quote

Per call to RetrieveCampaignObject.

Btw, I just tested the whole stuff with a ODBC connection: It is true that the call to RCO suceeds, but the server crashes upon exit - another sure sign of heap / stack corruption.
_________________
Papillon
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Papillon
x-man


Joined: 28 Dec 2004
Posts: 1060
Location: Germany

PostPosted: Fri Jan 21, 2005 18:47    Post subject: Reply with quote

Now who's the geek to explain me what is going on here ?
_________________
Papillon
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Makzimia De Graf



Joined: 31 Dec 2004
Posts: 55
Location: San Diego CA.

PostPosted: Fri Jan 21, 2005 18:52    Post subject: Reply with quote

*chuckles* Salandra walked off into the bedroom shaking her head at us. RCO calls in Fredian are none existant, if I am understanding what you are saying... so... total loss on this. Again, as it stand ODBC via layer driver is still standing now after 12 hours of no crashes... *throws hands in air* I am sorry Pap, something for you coders to mull over and tear apart.
_________________
Makzimia De Graf

DM/Creator Island of Fredian
fredian.game-host.org:5123
Forums at http://castille.us/fredian/Forums
Back to top
View user's profile Send private message
Papillon
x-man


Joined: 28 Dec 2004
Posts: 1060
Location: Germany

PostPosted: Fri Jan 21, 2005 18:57    Post subject: Reply with quote

Makzimia De Graf wrote:
RCO calls in Fredian are none existant, if I am understanding what you are saying...


Well, I am talking exclusively about RCO/SCO calls and the associated crashes here.
_________________
Papillon
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Makzimia De Graf



Joined: 31 Dec 2004
Posts: 55
Location: San Diego CA.

PostPosted: Fri Jan 21, 2005 19:01    Post subject: Reply with quote

Ok, well when you sort this out, which I am sure you will, can we expect that this will impact the fact that it's effecting something else also, since I have none of this RCO SCO thing going on? sorry to have hijacked this thread.
_________________
Makzimia De Graf

DM/Creator Island of Fredian
fredian.game-host.org:5123
Forums at http://castille.us/fredian/Forums
Back to top
View user's profile Send private message
Senalaya



Joined: 29 Dec 2004
Posts: 82
Location: Germany

PostPosted: Fri Jan 21, 2005 19:07    Post subject: Reply with quote

Could be silly me, but as far as I see in the original 0.92.2, you create a 'new BYTE[size]' on each RCO call, where does it get released again? Does NWN do the clean up with the original RCO?

db.h:
Code:
void AllocatePointer(int size)
   {
      if (size > returnSize)
      {
         if (pReturn)
            delete[] pReturn;
         pReturn = new BYTE[size];
         returnSize = size;
      }
   }


Last edited by Senalaya on Fri Jan 21, 2005 19:22; edited 2 times in total
Back to top
View user's profile Send private message
Papillon
x-man


Joined: 28 Dec 2004
Posts: 1060
Location: Germany

PostPosted: Fri Jan 21, 2005 19:18    Post subject: Reply with quote

Senalaya wrote:
Could be silly me, but as far as I see in the original 0.92.2, you create a 'new BYTE[size]' on each RCO call, where does it get released again? Does NWN do the clean up with the original RCO?


See, this is a very interesting question. I have not been able to prove the one nor the other, so this remains an open question! Welcome to the wonderful world of reversed engineered assembler code hooked via a DLL into some executable that right from the start did not want to have anything to do with database stuff Smile
_________________
Papillon
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Papillon
x-man


Joined: 28 Dec 2004
Posts: 1060
Location: Germany

PostPosted: Fri Jan 21, 2005 19:21    Post subject: Reply with quote

One fact I know for sure is that the crashing did not go away when I do NOT release memory, but just malloc'ed more of it. This seems to point to the fact that NWServer does not want to free() it, but just does a memcopy() on it.

The questions remains why a simple call to malloc (or new) messes up the whole server. I have even tried to allocate 100KB of memory in the odbc constructor beforehand, resulting in the same problem.

Oh, and my ICQ is 169824305
_________________
Papillon
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
crusaderky



Joined: 13 Jan 2005
Posts: 2

PostPosted: Fri Jan 21, 2005 19:23    Post subject: Reply with quote

Senalaya wrote:
Could be silly me, but as far as I see in the original 0.92.2, you create a 'new BYTE[size]' on each RCO call, where does it get released again? Does NWN do the clean up with the original RCO?


a good code profiler IMHO should be able to detect any eventual memory leaks of this type.....

....I repeat, IMHO. Most likely I'm talking without knowing things.
_________________
I Sette Sigilli - Shard Italiano Full GdR
Back to top
View user's profile Send private message
Senalaya



Joined: 29 Dec 2004
Posts: 82
Location: Germany

PostPosted: Fri Jan 21, 2005 19:28    Post subject: Reply with quote

Hmm, the blockwise transfer of SQL blobs from and into columns usually takes some time. I asume (too lazy to read), that nwnx_odbc uses only one instance of the CDB/CODBC object, to handle all RCO calls.
Would it be possible, that if 2 RCOs are fired shortly after eachother, that the 2nd call destroys ('delete[] pReturn;') the pReturn pointer, while the 1st call is still working with it?
Back to top
View user's profile Send private message
Papillon
x-man


Joined: 28 Dec 2004
Posts: 1060
Location: Germany

PostPosted: Fri Jan 21, 2005 19:32    Post subject: Reply with quote

No, it is single threaded.
_________________
Papillon
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Senalaya



Joined: 29 Dec 2004
Posts: 82
Location: Germany

PostPosted: Fri Jan 21, 2005 19:37    Post subject: Reply with quote

ignore! Missed the point, that it also crashed, when no 'delete' is used.
Back to top
View user's profile Send private message
Earandel



Joined: 29 Dec 2004
Posts: 6

PostPosted: Sat Jan 22, 2005 5:32    Post subject: Reply with quote

Pap,

I actually ran into something very similar when I was working on extending the SCO module. I tracked it down to the same AllocatePointer type call ( a new one I added in the code I sent you ages ago). It seemed to me that NWServer did not overly like the pointer to be reused. I tried removing the size check - taking the performance hit of deleting and re-allocating the pointer each time, regardless of the size. This will be slower, but it seemed to be significantly more stable.

Ear
Back to top
View user's profile Send private message Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> General Discussion All times are GMT + 2 Hours
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8  Next
Page 6 of 8

 
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