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 
 
An error occured during OnCreate of send
Goto page 1, 2  Next
 
Post new topic   Reply to topic    nwnx.org Forum Index -> Windows technical support
View previous topic :: View next topic  
Author Message
DragonTayl



Joined: 11 Aug 2007
Posts: 10

PostPosted: Sat Aug 11, 2007 16:55    Post subject: An error occured during OnCreate of send Reply with quote

Greetings,

I have been running NWNX2 for years and love the program. I recently got my first dedicated server and made a change to my network configuration, so there may be a lot of variables here. My problem is that it appears I can WRITE to my MySQL database just as I have always done, but READING from the database is not working.

I made sure to have the latest versions of NWNX2. My server is running Windows 2000.

Here are examples of my log files:

nwnx.txt =
NWN Extender V.2.6.1
(c) 2005 by Ingmar Stieger (Papillon) and Jeroen Broekhuizen
visit us at http://www.nwnx.org

* Loading plugins...
* Plugin odbc is loaded.
* An error occured during OnCreate of send
* NWNX2 activated.
* NWNX2 shutting down...
* NWNX2 shutdown successfull.

----------------------------------------------------

nwnx_odbc.txt =
NWNX ODBC2 plugin V.0.9.2.4
(c) 2005 by Ingmar Stieger (Papillon) and Jeroen Broekhuizen
visit us at http://www.nwnx.org

o Logfile maximum size limit is: 524288 bytes
o Log level: Everything will be logged.
o Using MySQL connection.
o Hooking SCO....hooked at 5d3560
o Hooking RCO....hooked at 5d3440
o Connect successful.
o Got request: SELECT value FROM nwnxtable WHERE player='~' AND tag='MyModule' AND varname='iWorldDate'
o Got request: SELECT value FROM nwnxtable WHERE player='~' AND tag='MyModule' AND varname='iTimeNow'
o Got request: SELECT player FROM nwnxtable WHERE player='~' AND tag='MyModule' AND varname='iYearNow'
o Got request: INSERT INTO nwnxtable (player, tag, varname, value) VALUES('~','MyModule','iYearNow','1500')
o Got request: SELECT player FROM nwnxtable WHERE player='~' AND tag='MyModule' AND varname='iMonthNow'
o Got request: INSERT INTO nwnxtable (player, tag, varname, value) VALUES('~','MyModule','iMonthNow','1')
o Got request: SELECT player FROM nwnxtable WHERE player='~' AND tag='MyModule' AND varname='iDayNow'
o Got request: INSERT INTO nwnxtable (player, tag, varname, value) VALUES('~','MyModule','iDayNow','1')
o Got request: SELECT player FROM nwnxtable WHERE player='~' AND tag='MyModule' AND varname='iWorldDate'
o Got request: INSERT INTO nwnxtable (player, tag, varname, value) VALUES('~','MyModule','iWorldDate','504029')
o Disconnecting from database.

--------------------------------------------------------------------------

I changed the table name and module tag for this copy/paste.

I have opened all the NWN ports (5120-5300 etc) and port 3306 on my router. Here is the nwnx.ini:

; NWNX2 configuration file
; These are the default values for NWNX2. Values specified on the command
; line take precedence.

[NWNX]
ServerPort = 5121
ModuleName = ""
WatchdogProcess = no
UpdateIntervalProcess = 5
WatchdogGamespy = no
UpdateIntervalGamespy = 20
GamespyRetries = 5
OldGamespyProtocol = no
RestartDelay = 5

[ODBC2]
; Log file
MaxLogSize = 512 ; in KByte
LogLevel = 2 ; 0=nothing, 1=only errors, 2=everything

; Use these two settings for the SQLite internal database
;source = sqlite
;file = sqlite.db

; Use these two settings for ODBC connections
;source = odbc
;dsn = nwn

; Use these five settings for MySQL connections
source = mysql
server = localhost
user = MyUser
pwd = MyPassword
db = MyDatabase

; Set hookscorco to false if you want to disable hooking of
; StoreCampaignObject and RetrieveCampaignObject entirely
hookscorco = true

[PROFILER]
MaxLogSize = 512 ; in KByte
LogLevel = 1 ; 1=overall statistics, 2=full script callstack


----------------------------------------------------------------
(Again I changed the user/pwd/db for this copy/paste)

Any help or ideas would be appreciated.

edit = I forgot to describe the full symptoms:

1) The module does not appear to be receiving any data from the database, though it does write records
2) As a result, it does not do any "updates" but always inserts new records, creating many multiple records of the data in my table.
_________________
DragonTayl
Back to top
View user's profile Send private message
Disco



Joined: 06 Dec 2006
Posts: 152

PostPosted: Mon Aug 13, 2007 14:16    Post subject: Reply with quote

http://www.nwnx.org/phpBB2/viewtopic.php?t=813

Check this. We rolled back our MySQL version. Next update also caused troubles.

You should try the same queries with a MySQL query browser (such as supplied with MySQL). I could replicate the same errors with that as NWNX2 made, which kinda hints at some MySQL bug/feature rather than a NWNX slip.
Back to top
View user's profile Send private message
DragonTayl



Joined: 11 Aug 2007
Posts: 10

PostPosted: Mon Aug 13, 2007 18:41    Post subject: Reply with quote

Thank you for the suggestion. I have now read the thread you linked. I am running v4.1.22 of MySQL.

I went into the command line tool for MySQL and was able to get perfect result sets doing a copy/paste from my log file. I am therefore unable to replicate the problem directly in MySQL.

Is there a version of MySQL that is, if not exactly recommended, at least working for you at present? I will gladly upgrade or change. I am going to check my transactions setting - it sounds like you recommend this to be "off", correct?
_________________
DragonTayl
Back to top
View user's profile Send private message
DragonTayl



Joined: 11 Aug 2007
Posts: 10

PostPosted: Mon Aug 13, 2007 19:08    Post subject: Reply with quote

I have now tried it on 5.0.18 and got the same result. What appears to be happening is that no information is being returned to NwN - I remember my log files used to say the results after each SQL statement. The select statements in my nwnx_odbc.txt are not followed by anything - not results, not even "empty set" which I believe used to be indicated before.

When I copy/paste the very same SQL statements from my nwnx_odbc.txt into the MySQL console (adding only the required ; at the end) I get messages like "empty set" or the data that I selected.

I admit to being completely baffled. This machine has hosted NwN, MySQL, and NwNX2 before and successfully.
_________________
DragonTayl
Back to top
View user's profile Send private message
Gryphyn



Joined: 20 Jan 2005
Posts: 431

PostPosted: Tue Aug 14, 2007 0:05    Post subject: Reply with quote

DragonTayl wrote:
I have now tried it on 5.0.18 and got the same result. What appears to be happening is that no information is being returned to NwN - I remember my log files used to say the results after each SQL statement. The select statements in my nwnx_odbc.txt are not followed by anything - not results, not even "empty set" which I believe used to be indicated before.

When I copy/paste the very same SQL statements from my nwnx_odbc.txt into the MySQL console (adding only the required ; at the end) I get messages like "empty set" or the data that I selected.

I admit to being completely baffled. This machine has hosted NwN, MySQL, and NwNX2 before and successfully.


It might be the ODBC driver you're using. (get the latest - paired with mySQL version)

Cheers
Gryphyn
Back to top
View user's profile Send private message
DragonTayl



Joined: 11 Aug 2007
Posts: 10

PostPosted: Tue Aug 14, 2007 0:56    Post subject: Reply with quote

Thank you for the suggestion, Gryphyn.

I have now tried with the most recent versions of the ODBC connector, mostly 3.51.19 but I also tried the 5.0.11 beta.

For the most part, however, I had been using the direct MySQL connection since it was included in the NWNX2 system (very cool, by the way). I don't know if this bypasses the MyODBC driver or not, but in any case, as mentioned above, I have tried a wide variety, including the most recent, MyODBC drivers. The results are this:

With an outdated driver I can't connect to the database properly.

With the NWNX2 direct MySQL connection, or with the most recent MyODBC drivers, I can connect to the database and I can WRITE to it, but I cannot READ from it (which was the problem in my original post, which completely baffles me as far as behavior goes).

The only significant change I made, that I am aware of, is that I am now hosting MySQL and NwN on the same machine. In the past, I hosted the game on one machine and the database on another. Is anyone else hosting both on the same machine?
_________________
DragonTayl
Back to top
View user's profile Send private message
Zebranky



Joined: 04 Jun 2006
Posts: 415

PostPosted: Tue Aug 14, 2007 2:32    Post subject: Reply with quote

Could it be quirky settings for the user MyUser@localhost, whereas MyUser@% or MyUser@theoldserver worked fine? Try this in the command-line MySQL client, logged in as root:

GRANT ALL PRIVILEGES ON 'MyDatabase'.* TO 'MyUser'@'localhost' IDENTIFIED BY 'MyPassword';
FLUSH privileges;
_________________
Win32 SVN builds: http://www.mercuric.net/nwn/nwnx/

<Fluffy-Kooshy> NWNx plugin is to this as nuclear warheads are to getting rid of fire ants.

<ThriWork> whenever I hear nwn extender, I think what does NWN need a penis extender for?
Back to top
View user's profile Send private message Visit poster's website
DragonTayl



Joined: 11 Aug 2007
Posts: 10

PostPosted: Tue Aug 14, 2007 4:37    Post subject: Reply with quote

Thank you Zebranky, I am so pleased so many people are trying to help me.

I tested using my root login with every permission set, I tested logging into the command console with the user set up for NwNX2, and I did the Grant/Flush as you suggested.

In each case I was able to run all the commands inside the MySQL console, my scripts wrote TO the database from the module, but no result sets were sent FROM the database to the log file or the game.

I have been looking at the source code for NWNX2, though I am not an expert C++ coder (I have some experience, but not a ton) and the include script for NwN. It is as though the FETCH routine is not being called, for some reason. (Looking in the NWNXOdbc.cpp - void CNWNXODBC::Execute and void CNWNXODBC::Fetch. If the request even got to the FETCH routine it would send *something* to the log, but it is not sending any FETCH log information.

I see how this routine is called from the PayLoad routine in NWNXdll.cpp (darn clever, the way the variable names are used to send requests to the libraries) but for some reason it just doesn't seem to actually be called. I know enough to kinda figure out what is going on, but not how to adjust or fix anything. I do see that the variable names are correct in the aps include, not like they got messed up or anything.
_________________
DragonTayl
Back to top
View user's profile Send private message
DragonTayl



Joined: 11 Aug 2007
Posts: 10

PostPosted: Tue Aug 14, 2007 4:42    Post subject: Reply with quote

I did notice that in the OnRequest routine for NWNXOdbc.cpp the line

Fetch (Parameters, strlen (Parameters));

is the only one with a space between Fetch and the parameters, the Execute and SetScorcoSQL are directly against their open parens, but I can't imagine that is the problem or everyone would be having the trouble I'm having. I don't really want to download and setup the whole Windows API so I can recompile this, but I suppose it would make sense to see if somehow I just have a weird copy or something.
_________________
DragonTayl
Back to top
View user's profile Send private message
DragonTayl



Joined: 11 Aug 2007
Posts: 10

PostPosted: Tue Aug 14, 2007 5:19    Post subject: Reply with quote

Well, the problem HAS to be in my module somewhere. I am dumbfounded, and apologize to anyone still reading this thread. I loaded up the aps_demo mod and it did everything perfectly - even wrote to the correct database and the log files showed the "Sent Response" lines I was looking for.

I don't know what I did or what makes the difference - I do know I have a lot of those files cached for speed - could it be that if the script is cached in memory it functions too fast for the data to go back and forth?
_________________
DragonTayl
Back to top
View user's profile Send private message
Gryphyn



Joined: 20 Jan 2005
Posts: 431

PostPosted: Tue Aug 14, 2007 5:50    Post subject: Reply with quote

Just had a look where the Error message could be originating from

NXNXdll.cpp
Code:

CNWNXBase* pBase = GetClassObject();
if (pBase)
{
  if (!pBase->OnCreate(logDir))
    fprintf(logFile, "* An error occured during OnCreate of %s\n", moduleName);
  else
    fprintf(logFile, "* Plugin %s is loaded.\n", moduleName);
  Libraries.Insert(strupr(moduleName), pBase);
}
else
fprintf(logFile, "* Could not create an instance of plugin %s", moduleName);

--Plugin created, but failed during OnCreate()
hmmm "send" seems to be your ModuleName.
(this could be some 'stray' memory allocation, as ModuleName is "" in your config file.)

Maybe providing a/the module name will resolve this?
Grasping at straws...

Cheers
Gryphyn
Back to top
View user's profile Send private message
DragonTayl



Joined: 11 Aug 2007
Posts: 10

PostPosted: Tue Aug 14, 2007 6:36    Post subject: Reply with quote

Actually, I should have mentioned that I have gone ahead and removed the Vaultster module for the moment - it was giving me that error. I don't need it yet. I have not been getting that error since I removed it, though I have still been getting the weird results.

I have really narrowed it down to something in my mod - because as I mentioned, I loaded the aps_demo mod on my same server and it not only created the table and wrote to it correctly, it read from it as well. The log file for that session showed all the feedback I was expecting too.

I don't know what it is, but it has to be in my module somewhere. I may actually "start from scratch" and import everything like we used to have to do way back in the beginning when the module got corrupted. There may be something weird lingering where I can't get at it.

I replaced my aps include and that didn't help. It simply doesn't appear to be calling the SQLFetch() routine.
_________________
DragonTayl
Back to top
View user's profile Send private message
DragonTayl



Joined: 11 Aug 2007
Posts: 10

PostPosted: Tue Aug 14, 2007 6:43    Post subject: Reply with quote

I went to a backup of my module from two weeks ago, and it worked perfectly. I am going to re-create my effort of the past two weeks and I will post what I find.
_________________
DragonTayl
Back to top
View user's profile Send private message
Disco



Joined: 06 Dec 2006
Posts: 152

PostPosted: Tue Aug 14, 2007 14:45    Post subject: Reply with quote

Perhaps an open door: mind to escape quotes and such. Should be an issue with writing, not with reading, though. On the other hand, NWN modules sometimes suicide. Make sure you do a full build (esp. palettes) now and then.
Back to top
View user's profile Send private message
DragonTayl



Joined: 11 Aug 2007
Posts: 10

PostPosted: Tue Aug 14, 2007 17:50    Post subject: Reply with quote

Okay. Put this one down to "moron". But I am going to fess up and post this here so that anyone else who comes down with this behavior can spend less time figuring out they're a moron than I did.

At one point I had commented out the module OnLoad line to initialize Vaultster - I did not have it configured yet, but wanted it in there to simply uncomment later when I got everything running and (hopefully) needed multiple machines.

Sigh.

I commented out the SQLInit() line at the same time - totally by mistake. I know what the line is for, and how important it is, and I must have looked RIGHT AT that line several times while I tried to figure this out. I wasn't looking FOR it because I figured nothing would work if that was commented out, and I was, after all, able to write TO the database.

SO: Anyone else in the future who can write to the database but can't get any results back from the database, make sure you haven't accidentally commented out (or completely omitted) the SQLInit() in your module's OnLoad script.

If you have, join the club. I've got jackets.

A whole week of my life. What a moron.

However, moron or not, I can certainly appreciate everyone giving me suggestions and trying to help. This is a great community.
_________________
DragonTayl
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Windows technical support All times are GMT + 2 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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