Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum Goto page Previous  1, 2
Arde Posted: Sun Sep 09, 2007 10:18 am
[2.03] CMUD neither save new settings nor delete old ones
Dumas
Enchanter


Joined: 11 Feb 2003
Posts: 511
Location: USA

PostPosted: Wed Sep 26, 2007 1:52 pm   
 
Arminas wrote:
As for the xml tab being open. It was not. In fact I have been completely unable to edit any of my settings in the xml tab. This is why I resorted to the export, change delete, import mentioned above.


Odd, this was a bug in 2.02 that was brought up and fixed. Editing xml on the xml tab works for me now. As does exporting and importing.
Reply with quote
Arde
Enchanter


Joined: 09 Sep 2007
Posts: 605

PostPosted: Wed Sep 26, 2007 4:18 pm   
 
Zugg wrote:
I'm not sure the CDATA problem is causing this, unless it's some problem with having the Settings Editor in the XML tab view when stuff happens in the background.

Yes, in my case CDATA is only an indicator that bad things may happen. Or may not. May be it is better to track in what cases CDATA can appears in xml file? If you already substitute angle brackets with &lt/&gt, why this tag still writes to XML?

What is up to XML tab in Settings Editor - I used it mainly with buttons to understand why I still have already deleted states active, not with triggers. I prefer regularly export all settings to xml-file and work with it. So I don't think that there is a problem with XML view tab.

Zugg wrote:
Arde: It would also be useful to know more about your settings. For example, are you using multiple sessions, or multiple modules/windows/packages?

My settings:
1 session only, 1 main window + 3 tabbed child windows (originally created by #CAPTURE command), 3 toolbars with buttons (1 with gauges, 1 with push buttons and 1 where I fight with multistate button bugs Smile), status line, status window (docked), mapper window (docked).
3 packages: 2 default + 1 main package

I gonna send you my old .xml file, may be this help. It is xml of that package I struggled some settings to delete from (i.e. bug type 1). My current settings evolved from it. Meanwhile I'll try to create some triggers online and see if they saved.
Reply with quote
Arde
Enchanter


Joined: 09 Sep 2007
Posts: 605

PostPosted: Wed Sep 26, 2007 5:13 pm   
 
I confirm that settings created while connected to MUD is not saved at all. Just connect to MUD, add a gauge, some triggers and variables. Disconnect from MUD. Edit StatusBar content. Close session, close CMUD. Run CMUD. StatusBar saves all changes. All other newly added settings have gone without a trace.

And I mention earlier text flickering bug - I failed to reproduce it, although I've repeat all steps. Sad Another hard-to-find bug.
_________________
My personal bug|wish list:
-Wrong Priority when copy-paste setting
-1 prompt trigger for Mapper, Session and General Options, not 3 different!
-#SECTION can terminate threads
-Buttons can't start threads
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Wed Sep 26, 2007 5:14 pm   
 
You definitely should not store raw control codes within any settings field. These can likely cause problems with the SQL text that is generated to save records to the database. If you need a control character, use the %char() function instead of a raw character. Or, for ESC use %e and for CR use %cr and for LF use %lf.

The way the CDATA is "supposed" to work is that first CMUD tries converting angle brackets < and > to &lt; and &gt; If the length of this new value is more than 10 characters longer than the original string, then CMUD converts the string to a CDATA string instead. So, it depends upon the number of angle brackets as to whether or not CDATA is used.

But I can't think of any reason why this would effect the background saving. The CDATA stuff is only used for XML export/import. None of the XML stuff is used for the saving in the SQL database itself. I can see where control characters might cause the SQL save to fail, but I can't see where extra angle brackets would have any effect.


Last edited by Zugg on Thu Sep 27, 2007 7:28 pm; edited 1 time in total
Reply with quote
Arde
Enchanter


Joined: 09 Sep 2007
Posts: 605

PostPosted: Wed Sep 26, 2007 5:20 pm   
 
Heh, Zugg answer almost same time than I. Just pull this topic on top in order to Zugg read my post
_________________
My personal bug|wish list:
-Wrong Priority when copy-paste setting
-1 prompt trigger for Mapper, Session and General Options, not 3 different!
-#SECTION can terminate threads
-Buttons can't start threads
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Wed Sep 26, 2007 5:36 pm   
 
Quote:
Just connect to MUD, add a gauge, some triggers and variables.

Are you adding these in the settings editor, or from the command line? If you add something from the command line (like using #TRIGGER) does that save? Can you reproduce this starting with a new session so that we can be sure it isn't a problem with your existing package file?

Also, when you are connected to the MUD, do you have any triggers or alarms that are firing in the background while you are in the settings editor? Does it help if you go to a quiet area on the MUD where nothing is triggering, or if you turn off the triggers?
Reply with quote
Arde
Enchanter


Joined: 09 Sep 2007
Posts: 605

PostPosted: Wed Sep 26, 2007 6:58 pm   
 
I add new settings in the settings editor, not from the command line.
What I tried to check:
1) Clean session, all triggers are off. Add/save everything - OK.
2) My session, all triggers are off. Add/save everything - OK.
3) Clean session, all triggers are ON. Add prompt trigger/parser. - OK
4) My session, all triggers are ON. MXP prompt parser ON (currently, it only send #TAG prompt command, I plan to add more commands to it later). Add/save everything - OK
5) My session, all triggers are ON. Old-style prompt parser ON. Triggers fires, passive (just parse info from MUD: set new values to variables, capture lines to other windows) and interactive (send commands to MUD, like eat/drink, etc). Add/save everything - OK.
6) I turn back ON MXP prompt parser.

7) Now I decide to do a trick. I repeat some steps from my previous post.
a) My statusBar (currently I use it for scripts debug, displaying variables values, so here dirty and ugly expressions) shows my unused experience points stored in @CurrEXP variable. While online, I change this value to MXP variable %mud.CurrentXP. Add some triggers while all other triggers are continue to fire as it was in 5)
b) Disconnect from MUD
c) In offline mode edit statusBar back to use of CMUD variable @CurrEXP.
d) Close session, close CMUD. Run CMUD. StatusBar save my changes, but all other changes have gone.

Just for information - here is what my StatusBar expression looks like:
MXP: @CurrEXP *CharState: @CharState

I must point that yesterday, when my screen starts to flick (and I also lost all changes), I've made the same changes: %mud.CurrentXP instead of @CurrEXP.

Ok, what else I should report about?
Reply with quote
Arde
Enchanter


Joined: 09 Sep 2007
Posts: 605

PostPosted: Wed Sep 26, 2007 7:17 pm   
 
I repeat step 7 in the clean session. Everything looks normal there...
_________________
My personal bug|wish list:
-Wrong Priority when copy-paste setting
-1 prompt trigger for Mapper, Session and General Options, not 3 different!
-#SECTION can terminate threads
-Buttons can't start threads
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Wed Sep 26, 2007 7:27 pm   
 
Let me make sure I understand...

In steps 1-6, were you connected to the MUD. When you say "OK" do you mean that you were connected to the MUD and then closed CMUD and then ran CMUD again and everything was saved properly?

I'm trying to understand what the difference is between step (5) (which you said was OK) and step (7). Looks like in step 7 you just edited a status bar item, but somehow the triggers that you saved are gone?

What happens if you make some other change to your status bar? In other words, does it only happen when adding %mud.CurrentXP, or does it happen when making any other change?

In step 7d you say "Close session, close CMUD". Does it make any difference if you just close CMUD without first closing the session?
Reply with quote
Arde
Enchanter


Joined: 09 Sep 2007
Posts: 605

PostPosted: Wed Sep 26, 2007 8:06 pm   
 
Zugg wrote:
Let me make sure I understand...
In steps 1-6, were you connected to the MUD. When you say "OK" do you mean that you were connected to the MUD and then closed CMUD and then ran CMUD again and everything was saved properly?

Yes. I made all the changes, disconnect and restart CMUD.

Zugg wrote:
I'm trying to understand what the difference is between step (5) (which you said was OK) and step (7). Looks like in step 7 you just edited a status bar item, but somehow the triggers that you saved are gone?

Yes, it was the only difference.

Zugg wrote:
What happens if you make some other change to your status bar? In other words, does it only happen when adding %mud.CurrentXP, or does it happen when making any other change?

Hmm, I didn't think about it... After you post I've check it - you right, any changes to the status bar setting made online, results in lost of all subsequent changes of any setting. Not only newly added, but deleted settings after CMUD restart appears on their places. There is the only exeption: the status bar element itself. It remembers all changes I done to him, online and offline. In my last check I even did not edit existing variables in st.bar, I just add another variable.
And I must say that I have 3 status bar settings, they go one after another: current experience tracking (I post it text in previous message), exp. to next level tracking, target tracking. I perform all my checks and made changes only to the first of these settings. And all status settings have checked options to show them in status bar and in status window.

Zugg wrote:
In step 7d you say "Close session, close CMUD". Does it make any difference if you just close CMUD without first closing the session?

All these problems with lost settings for the last weeks have teach me to click on every Save button I see like crazy and close carefully window by window - to be sure that I've done everything from my side to save my work. So I always close session first and only then close CMUD. I have nothing to say for other "exit styles" Rolling Eyes
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Wed Sep 26, 2007 9:45 pm   
 
Quote:
any changes to the status bar setting made online, results in lost of all subsequent changes of any setting

So only changes made *after* editing the Status Bar are lost? In other words, if you add a variable, and then change your status bar, does the variable get saved? I think we are getting closer and closer to figuring this one out.
Reply with quote
Arde
Enchanter


Joined: 09 Sep 2007
Posts: 605

PostPosted: Thu Sep 27, 2007 4:07 am   
 
I can't reproduce it any more. Sad But for your question - yes, it was so: adding variable or anything before changing the st.bar saves that variable normally. I just make 2 tries - everything was saved, regardless of what I did with status bar.
Same thing was with buttons editor - I can't reproduce later one of the bugs I had previously. Looks like something must happen before these bugs get active.
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Thu Sep 27, 2007 4:29 am   
 
I stand corrected, I AM able to make changes in XML in 2.03.

Thanks Zugg, I'll remember to be good and use %char %e %cr %lf in the future.

I just thought that since the behavior sounded similar it might be somehow relevant. It's been a long day I'm off to bed.
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
Arde
Enchanter


Joined: 09 Sep 2007
Posts: 605

PostPosted: Thu Sep 27, 2007 4:58 pm   
 
Zugg wrote:
The way the CDATA is "supposed" to work is that first CMUD tries converting angle brackets to </&gt. If the length of this new value is more than 10 characters longer than the original string, then CMUD converts the string to a CDATA string instead. So, it depends upon the number of angle brackets as to whether or not CDATA is used.

Sorry, I don't understand your explanation about bracket conversion: I see different results in different browsers. Confused Can you please write it by words without using "<" or "&gt"? Do you convert angle brackets to slash (1 character), to slash in brackets (3 characters) or to "bracket-slash-amp-gt" (5 characters)? Do you use your own converting algorithm or you rely on third-party libraries? Only angle brackets converted or something else? How about double quotes, slashes and quotes? Why I've get CDATA for
Code:

play_magic;
#ECHO "^^^^^^^^^^^TOKEN!!!!^^^^^^^^^^";
#ECHO "^^^^^^^^^^^TOKEN!!!!^^^^^^^^^^";

??? There is no angle brackets? Why even I've get CDATA for this trigger comment:
Code:

This is LESS ACCURATE version of "{A|An} (*) {spellbook|book|tome|manual|digest} (*)" trigger and it should be run AFTER it. 2 versions of least accurate trigger "{A|An} {spellbook|book|tome|manual|digest} (*)" with 1 (*) parameter should be run after.


Zugg wrote:
But I can't think of any reason why this would effect the background saving. The CDATA stuff is only used for XML export/import. None of the XML stuff is used for the saving in the SQL database itself. I can see where control characters might cause the SQL save to fail, but I can't see where extra angle brackets would have any effect.

I do not think that backgroud saving (at least, saving thread) not work. Why? When I run my test yesterday the settings saves in the beginning of the test and in the end. So writing thread works. Think about CDATA tag as of float, but we need get a fish. I want to remind you that there were lost settings made online, earlier there were lost settings made offline only. With editing of status bar and without. And there was the only common in all cases: settings data goes from Editor to DB and from DB to XML, with 3 conversions (Editor->DB, DB->Editor, ???->XML and that why I asked you about your conversion algorithms). We need to check what actually DB receives from Editor, what Editor receives from DB if it try to read saved data, both before and after conversion.

Ok, what I need for further tests is CMUD 2.04, with some sort of log feature. What I think it should log:
1) Editor -> DB converter (type, name or pattern)
2) DB converter -> DB: What it saves (type, name or pattern), query result from DB (OK or failed transaction)
3) Immediately after 2): DB Read: re-read saved parameter back (type, pattern, result)
4) DB -> Editor conversion result (type, pattern, result)

==or even better==
output right on the CMUD screen, may be in child window. With CMUD' scroll buffer and Search command it will be quite comfortable.

Now it is up to you to make a decision: will you implement such a feature or will test it yourself.
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Thu Sep 27, 2007 7:27 pm   
 
There isn't any "Editor -> DB converter". The contents of the Script field in the Editor is sent directly to the Value field in the database via SQL. The only "conversion" done is to double any quotes in the script to make it into a value SQL value. XML is not involved at all in the database. A failed SQL transaction in the background saving thread already will cause an error message to be shown. So the SQL isn't the problem here...there is something else happening.

I don't know why it's using CDATA for the cases that you show. I can confirm that it is using CDATA when it shouldn't, and I'll look at the code to see why it is doing this.

The normal conversion for XML is to convert a < character to a "amp lt semicolon" &lt; and a > character to "amp gt semicolon" &gt; ... No "slashes" are involved. I updated my above forum post to make it clearer (the forum bbcode was messing it up a bit)

I'm still going to do some more testing myself to see if I can reproduce the problem. If not, then I'll add a logging function. But since the logging will be done in a background thread, all I can do is write it to a file. I cannot display it in any kind of user interface (since that can only be done in the main thread).
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Thu Sep 27, 2007 7:50 pm   
 
OK, the reason it is using CDATA in your cases above is that it was also trying to convert the " quotes into &quot; and that was triggering the CDATA conversion. Still doesn't explain why it isn't saving stuff yet, and why it matters whether you are online or not, so I'm still looking into that.
Reply with quote
Arde
Enchanter


Joined: 09 Sep 2007
Posts: 605

PostPosted: Thu Sep 27, 2007 8:12 pm   
 
Heh, I have a lot #SAY "blah-blah" or #ECHO "blah-blah" quoted commands in triggers, but they never get enclosed with CDATA... And I was cursed with "cant save" bug for a week until I get rid of one variable with CDATA tag around its value. I delete only that variable, but all start to work. May be it's not explained anything, or may be it does - I wish I know it...
_________________
My personal bug|wish list:
-Wrong Priority when copy-paste setting
-1 prompt trigger for Mapper, Session and General Options, not 3 different!
-#SECTION can terminate threads
-Buttons can't start threads
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Thu Sep 27, 2007 8:29 pm   
 
Found it!

At least, I found one of the problems. It was related to deleting settings. Arde sent me his XML file and indicated a variable that he could not delete. I imported his XML and tried to delete the variable and had the same problem. When I traced the background thread that was saving the SQL, it was crashing when trying to access the deleted setting. The database record was marked as deleted, but the cached record in memory was already freed. So when the background thread tried to access the cached record to check a property, it was getting an access violation and crashing the background update thread.

This particular crash wasn't being caught by the background thread error handler. So what was happening is that any setting stored *after* the deleted setting in memory wasn't getting updated on disk (because the thread would crash at the deleted setting and never get to the ones after it). So this depended heavily upon where the deleted setting was in the database. And certainly any *new* settings (which get added to the end of the database) wouldn't get saved. But editing a setting *before* the deleted setting would get saved properly.

The reason you sometimes couldn't reproduce it is that you needed to try deleting a setting first. Once you had deleted a setting, then this would trigger the problem to start occurring.

I believe that this happens any time you delete any setting. So this would definitely make it really flaky when trying to save changes to your settings, and it would effect a lot of people. So I think this bug is responsible for most of the problems with saving changes to settings. I have also modified the background thread so that something like this will properly trigger the error handler in the future.

This is a very serious bug and really makes it impossible to use v2.03 for any real playing or testing. This bug has been in all of the 2.0x versions, so it is probably responsible for a lot of the problems people are having.

I'm going to work on the problem with the screen going blank and MUD output not displaying, since I think that is also a serious problem. Then I might release a new version tomorrow with these major fixes just so people can do more productive beta testing.

Arde: Thanks for your patience in all of this. I know it was a tough and frustrating problem to work on.
Reply with quote
Arde
Enchanter


Joined: 09 Sep 2007
Posts: 605

PostPosted: Thu Sep 27, 2007 8:32 pm   
 
Twisted Evil SMASH that bug, Zugg! Mr. Green
_________________
My personal bug|wish list:
-Wrong Priority when copy-paste setting
-1 prompt trigger for Mapper, Session and General Options, not 3 different!
-#SECTION can terminate threads
-Buttons can't start threads
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Thu Sep 27, 2007 8:32 pm   
 
Quote:
I have a lot #SAY "blah-blah" or #ECHO "blah-blah" quoted commands in triggers

Right. As I said, it was only using CDATA if the length of the encoded string was more than 12 characters longer than the original string (when I checked the code, it was 12 and not 10 characters as in my post above, sorry). In the above case, the encoded string is:

#SAY & quot;blah-blah& quot;

And since this is 12 characters longer than the original, it wasn't getting converted to a CDATA. But if you looked at the XML, you would see the unnecessary & quot; entities.
Reply with quote
Seb
Wizard


Joined: 14 Aug 2004
Posts: 1269

PostPosted: Fri Sep 28, 2007 12:01 am   
 
Nice one, Zugg!
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum All times are GMT
Goto page Previous  1, 2
Page 2 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

© 2009 Zugg Software. Hosted by Wolfpaw.net