Page 1 of 1

Error: A critical error occurred when registering ModData

Posted: Wed May 03, 2017 9:04 pm
by HeXiLeD
Problem:

Happens when X amount of custom modules are added:
Currently with me was after 17 extra modules.

Code: Select all

error: A critical error occurred when registering ModData for m_modname
No space available & error: Error loading m_modname: Mod_Init returned -1
Gottem wrote:Apparently that's caused when the available ModData slots are all used up. =] You can increase these if you want, but I'm not really sure if it's supported lel. You also have to do this on every server. Inside include/struct.h there are a few defines:


Solution seems to be found when increasing these values:

Code: Select all

#define MODDATA_MAX_CLIENT 8
#define MODDATA_MAX_CHANNEL 8
#define MODDATA_MAX_MEMBER 4
#define MODDATA_MAX_MEMBERSHIP 4
Complain:
Why are the values so low ? Why are there problems adding more extra modules after a certain amount ?

Expectations:
Fix on the next unrealircd release 4.0.12

Conclusion:
:mrgreen: If so, thumbs up

Re: Error: A critical error occurred when registering ModData

Posted: Wed May 10, 2017 6:16 pm
by Syzop
Which limitation are you hitting? Which of the 4?

The reason there is a limitation at all is because of the way the system works. It will waste space if the slots are unused. This was chosen above dynamically allocated space because a static slot system is a lot faster (same memory block, will be in L2 cache) and causes less memory fragmentation (=waste too). Anyway, tech talk :D

When the numbers were decided, nobody other than me was using the moddata system yet. In fact there were few 4.x third party modules at all. Now with Gottem and others this is changing, so it could well be that it needs some updating.. but I have to be careful with defaults for all 4.x users.

Oh and yes, you can safely change the values in struct.h yourself. Just be sure to recompile UnrealIRCd (make clean; make). Just would like to have the information from above so I can consider raising one of the limits for everyone or at least look if it's necessary ;)

Re: Error: A critical error occurred when registering ModData

Posted: Sat May 13, 2017 12:28 pm
by Gottem
Well, if you're using enough of my modules, eventually you'll use 7 CLIENT slots (plus 1 for CHANNEL) and as far as I can tell you need all of them. There are 2 instances where MEMBERSHIP ones seem more logical, but they interfere with actual functionality (in case of m_kickjoindelay the moddata is destroyed after a kick, rendering the entire module useless). Figured that's by design so I went ahead and used CLIENT. =]

Re: Error: A critical error occurred when registering ModData

Posted: Wed Sep 06, 2017 2:31 pm
by Syzop
Just rememberd this one (next time best to use bugs.unrealircd.org :D), so committed:

Code: Select all

* Bump MODDATA_MAX_CLIENT from 8 to 12: needed if you have a lot of
  3rd party modules loaded. Also moved MODDATA_MAX_* to include/config.h
https://github.com/unrealircd/unrealirc ... a9734949a7
Will be in UnrealIRCd 4.0.14.

Re: Error: A critical error occurred when registering ModData

Posted: Wed Sep 06, 2017 4:49 pm
by Gottem
Could've sworn I filed a bug for it too, but apparently not. :> But yeah, 12 slots should be enough for a while. =]