OpenArena Message Boards

OpenArena => Technical Snafus => Topic started by: 7 on June 28, 2010, 01:12:41 PM



Title: Error: Too many cvars, cannot create a new one!
Post by: 7 on June 28, 2010, 01:12:41 PM
OA 0.8.5 crashes on me when I join or start a mod game like E+. I know this happens because I define a lot of cvars in my scripts, but up until version OA 0.8.5 this never was a problem so I guess OA itself defines a lot more cvars than previous versions did.

From the crashlog:
Code:
----- CL_Shutdown -----
OpenAL capture device closed.
RE_Shutdown( 1 )
-----------------------
----- Server Shutdown (Server fatal crashed: Error: Too many cvars, cannot create a new one!) -----
==== ShutdownGame ====
AAS shutdown.
---------------------------
Error: Too many cvars, cannot create a new one!

I have removed all unnecessary stuff from my scripts already, but they are still too big to play the mods. I've been using these scripts for years and I'd very much like to be able to keep using them.

I've glanced over the OA source briefly and I think this is just a matter of cranking up the value of the MAX_CVARS macro in code/qcommon/cvar.c, so please, please, pretty please developers, could you fix this in the next release?


Title: Re: Error: Too many cvars, cannot create a new one!
Post by: Gig on June 28, 2010, 02:16:28 PM
As a workaround, have you already tried to start the mod from the command line (openarena.exe +set fs_game modfolder), instead of using the "Mods" menu? Once it worked for me...


Title: Re: Error: Too many cvars, cannot create a new one!
Post by: sago007 on June 28, 2010, 02:24:54 PM
The 0.8.5 binaries should have an equal or higher limit than before. Also the binaries should clean cvars during mod change.

Previously we was a rather long way from the number limit, it was always the 16 kiB limit that was the problem. That limit was increased to 128 kiB in 0.8.5. 


Title: Re: Error: Too many cvars, cannot create a new one!
Post by: Gig on June 28, 2010, 02:45:02 PM
Anyway, once I had this problem with Alternatefire mod. A first workaround was to start it from command line, and I resolved the problem deleting its quake3.cfg file and let it recreate it. I don't know exactly what it didn't like...


Title: Re: Error: Too many cvars, cannot create a new one!
Post by: 7 on June 28, 2010, 03:30:29 PM
Anyway, once I had this problem with Alternatefire mod. A first workaround was to start it from command line, and I resolved the problem deleting its quake3.cfg file and let it recreate it. I don't know exactly what it didn't like...

I've tried starting from the command line before but that makes no difference, deleting the q3config.cfg first doesn't either. The problem really is an abundance of cvars. In a default q3config.cfg there are 408 cvars already:
Code:
grep -c 'seta ' ~/.openarena/baseoa/q3config.cfg 
408
With the E+ mod the count is up to 442 cvars.

I wrote scripts so I can in- and decrease net related parameters like cg_projectilenudge in 5 ms steps using keyboard keys and this takes a lot of cvars (one for each possible cg_projectilenudge value for instance). Having 408 cvars to start with, it's not difficult to bump into the 1024 maximum this way.

edit:
I have checked a default ioquake3 v1.36 q3config.cfg also, and it contains 262 cvars, so OA has 146 cvars more.


Title: Re: Error: Too many cvars, cannot create a new one!
Post by: GrosBedo on July 01, 2010, 02:12:35 PM
The limit concerns only one file, so just split up your config amongst multiple files using /exec mainconfig1.cfg, /exec mainconfig2.cfg etc...

You can find an example of a config that is spit up in several parts :
http://superbots.co.cc/modules.php?name=Downloads&op=getit&lid=16


Title: Re: Error: Too many cvars, cannot create a new one!
Post by: 7 on July 02, 2010, 06:40:01 AM
My config is already split up into 10 different modules/files and one master file to exec them all. I really hit the maximum number of cvars because OA defines so many of them to start with.


Title: Re: Error: Too many cvars, cannot create a new one!
Post by: GrosBedo on July 02, 2010, 01:33:34 PM
My config is already split up into 10 different modules/files and one master file to exec them all. I really hit the maximum number of cvars because OA defines so many of them to start with.

Then the question is : why do you need so many cvars ? If that's for different mods, you can avoid calling them at start, and call when needed with exec.

But indeed, I never saw this error and I think it could be cool to see if it can be patched in the engine, but then you should report that to ioquake3.


Title: Re: Error: Too many cvars, cannot create a new one!
Post by: 7 on July 03, 2010, 03:02:19 AM
Then the question is : why do you need so many cvars ?

Because I want to be able to change parameters like r_gamma and cg_projectilenudge without dropping the console each time. This takes a lot of cvars because for every possible value you have to define one.

Let me state again: these scripts worked for years without errors in OA, but with version 0.8.5 they don't because AO says I define too many cvars. In reality its not me defining more cvars than before but OA. I've cut down the number of cvars in my scripts by more than 10% already and I can't shave off more without crippling the scripts.


Title: Re: Error: Too many cvars, cannot create a new one!
Post by: fromhell on July 05, 2010, 03:56:28 AM
This bug sucks for playing UIEnhanced. Agreed, engine patch.

*cough*limits on excessive bot files(ignoring bot entries from more files requiring merging botfiles into little 8kb .bot files to get around this), player models and shaders could be lifted too*cough* though for player models, that's a different topic


Title: Re: Error: Too many cvars, cannot create a new one!
Post by: Falkland on July 05, 2010, 10:48:43 AM
ioquake3 uses 16KB for the command buffer ; UrT and defrag engine use 64KB ; OA use 128KB but since it doesn't seem to be enough the buffer can be expanded to 1MB for example :

Code:
--- ioquake3/code/qcommon/cmd.c	2009-09-15 15:38:49.000000000 +0200
+++ ioquake3_oa/code/qcommon/cmd.c 2010-04-25 18:46:46.000000000 +0200
@@ -24,7 +24,7 @@
 #include "q_shared.h"
 #include "qcommon.h"
 
-#define MAX_CMD_BUFFER 16384
+#define MAX_CMD_BUFFER 0x100000 // 1MB
 #define MAX_CMD_LINE 1024
 
 typedef struct {

Or a more sofisticated code with a new cvar could make it dynamically expandable starting by the actual OA value . Anyway in this case it should be also defined a high limit for obvious reasons.


Title: Re: Error: Too many cvars, cannot create a new one!
Post by: fromhell on July 05, 2010, 11:11:07 AM
no 1mb buffer. if uie can't get through on a big buffer yet can on a small one (stock q3) there's no reason for it


Title: Re: Error: Too many cvars, cannot create a new one!
Post by: Falkland on July 05, 2010, 11:34:56 AM
no 1mb buffer. if uie can't get through on a big buffer yet can on a small one (stock q3) there's no reason for it

- The topic is about the reached limit for creating new cvars
- The buffer limit is responsable for this error
- 128KB which is the default OA engine value is not enough
- "This bug sucks for playing UIEnhanced. Agreed, engine patch." : fromhell©
- How do you think to solve it if not by expanding the buffer ?


Title: Re: Error: Too many cvars, cannot create a new one!
Post by: GrosBedo on July 07, 2010, 02:05:28 PM
- How do you think to solve it if not by expanding the buffer ?

It seems not related to buffer since it was expanded in this release, and the bug happens in the new release, but not the older ones.


Title: Re: Error: Too many cvars, cannot create a new one!
Post by: Falkland on July 07, 2010, 03:52:10 PM
- How do you think to solve it if not by expanding the buffer ?

It seems not related to buffer since it was expanded in this release, and the bug happens in the new release, but not the older ones.

It could be probably related to this since cvars management is changed a bit because of the 2 ioquake3 fixes against mod cvars pollution and the READONLY cvars not writeable anymore.

I guess cvars are now managed separately for every mod , even if they or part of them are the same of baseoa or of the previous loaded mod.

My suggestion is to increase a bit more the size of the buffer , recompile the engine and see if it solves this problem. If not , then the buffer is not the cause of the bug.


Title: Re: Error: Too many cvars, cannot create a new one!
Post by: sago007 on July 07, 2010, 05:03:44 PM
It should be noted that the count limit is increased in the latest test binaries... you might try it to see if it is the problem.

http://openarena.ws/board/index.php?topic=1933.0


Title: Re: Error: Too many cvars, cannot create a new one!
Post by: Neon_Knight on March 14, 2011, 01:31:23 PM
Bump!

It happens with Threewave (http://planetquake.gamespy.com/View.php?view=MOTW.Detail&id=184) CTF (http://www.quakeunity.com/file=1137). Any time I want to start a match, it closes and shows this error.