Page 1 of 1

[UnrealIRCd3.2.1+win32] "Fatal Error" Report!

Posted: Sat Aug 07, 2004 5:25 pm
by Eros
Get some Fatal Error when load/working on some modules.

1. Get this Error when i load m_chgswhois.dll & was testing the cmds.
Generated at Fri Aug 06 20:19:46 2004

Windows XP Service Pack 2, v.2149 (5.1.2600)
Unreal3.2.1[FinWXeOoZEmM3] (1.1.1.1.2.1.2.1.2.2234.2.88 2004/07/03 18:28:16)
-----------------
Memory Information:
Physical: (Available:109MB/Total:254MB)
Virtual: (Available:2004MB/Total:2047MB)
-----------------
Exception:
Breakpoint
-----------------
Backup Buffer:
SETSWHOIS
-----------------
Registers:
EAX=0x00000001 EBX=0x00efcaa8 ECX=0x0118a558
EDX=0x000e0000 ESI=0x7c910f97 EDI=0x0012ffb0
EIP=0x01143a28 EBP=0x0183fd98 ESP=0x0183fd88
-----------------
Stack Trace:
Module: MSVCRTD
#0 (null):0: free_dbg
#1 (null):0: free_dbg
#2 (null):0: free
Module: 7EE2DC66.m_chgswhois
#3 (null):0: Mod_Unload
Module: wircd
#4 c:\dev\unreal3.2\src\parse.c:440: parse
#5 c:\dev\unreal3.2\src\packet.c:139: dopacket
#6 c:\dev\unreal3.2\src\s_bsd.c:1477: read_packet
#7 c:\dev\unreal3.2\src\s_bsd.c:1937: read_message
#8 c:\dev\unreal3.2\src\ircd.c:1548: SocketLoop
Module: MSVCR70D
#9 c:\dev\unreal3.2\src\ircd.c:1548: beginthread
Module: kernel32
#10 c:\dev\unreal3.2\src\ircd.c:1548: GetLocaleInfoA
2. Get this Error when i load operpasswd.dll & was testing the cmds.
Generated at Sat Aug 07 10:28:44 2004

Windows XP Service Pack 2, v.2149 (5.1.2600)
Unreal3.2.1[FinWXeOoZEmM3] (1.1.1.1.2.1.2.1.2.2234.2.88 2004/07/03 18:28:16)
-----------------
Memory Information:
Physical: (Available:52MB/Total:254MB)
Virtual: (Available:2004MB/Total:2047MB)
-----------------
Exception:
Breakpoint
-----------------
Backup Buffer:
OPER Eros testpass
-----------------
Registers:
EAX=0x00000001 EBX=0x00efceb0 ECX=0x0118a558
EDX=0x000f0000 ESI=0x7c910f97 EDI=0x0012ffb0
EIP=0x01143a28 EBP=0x0184fd34 ESP=0x0184fd24
-----------------
Stack Trace:
Module: MSVCRTD
#0 (null):0: free_dbg
#1 (null):0: free_dbg
#2 (null):0: free
Module: 97BA291C.operpasswd
#3 (null):0: Mod_Unload
Module: wircd
#4 c:\dev\unreal3.2\src\s_misc.c:503: exit_client
Module: 97BA291C.operpasswd
#5 c:\dev\unreal3.2\src\s_misc.c:503: Mod_Unload
Module: wircd
#6 c:\dev\unreal3.2\src\parse.c:441: parse
#7 c:\dev\unreal3.2\src\packet.c:139: dopacket
#8 c:\dev\unreal3.2\src\s_bsd.c:1477: read_packet
#9 c:\dev\unreal3.2\src\s_bsd.c:1937: read_message
#10 c:\dev\unreal3.2\src\ircd.c:1529: SocketLoop
Module: MSVCR70D
#11 c:\dev\unreal3.2\src\ircd.c:1529: beginthread
Module: kernel32
#12 c:\dev\unreal3.2\src\ircd.c:1529: GetLocaleInfoA
3. Get this Error when i load m_banlist.dll & was testing the cmds.
Generated at Sat Aug 07 11:28:25 2004

Windows XP Service Pack 2, v.2149 (5.1.2600)
Unreal3.2.1[FinWXeOoZEmM3] (1.1.1.1.2.1.2.1.2.2234.2.88 2004/07/03 18:28:16)
-----------------
Memory Information:
Physical: (Available:145MB/Total:254MB)
Virtual: (Available:2006MB/Total:2047MB)
-----------------
Exception:
Access Violation
-----------------
Backup Buffer:
BANLIST
-----------------
Registers:
EAX=0x25ff0146 EBX=0x00efde58 ECX=0x01125060
EDX=0x25ff0112 ESI=0x7c910f97 EDI=0x0012ffb0
EIP=0x01174689 EBP=0x018bfbb8 ESP=0x018bfba0
-----------------
Stack Trace:
Module: MSVCRTD
#0 (null):0: gmtime
Module: 2AD37991.m_banlist
#1 (null):0: Mod_Unload
#2 (null):0: Mod_Unload
Module: wircd
#3 c:\dev\unreal3.2\src\parse.c:440: parse
#4 c:\dev\unreal3.2\src\packet.c:139: dopacket
#5 c:\dev\unreal3.2\src\s_bsd.c:1477: read_packet
#6 c:\dev\unreal3.2\src\s_bsd.c:1937: read_message
#7 c:\dev\unreal3.2\src\ircd.c:1548: SocketLoop
Module: MSVCR70D
#8 c:\dev\unreal3.2\src\ircd.c:1548: beginthread
Module: kernel32
#9 c:\dev\unreal3.2\src\ircd.c:1548: GetLocaleInfoA
4. Get this Error when /rehash to load randquote.dll.
Generated at Sat Aug 07 11:21:02 2004

Windows XP Service Pack 2, v.2149 (5.1.2600)
Unreal3.2.1[FinWXeOoZEmM3] (1.1.1.1.2.1.2.1.2.2234.2.88 2004/07/03 18:28:16)
-----------------
Memory Information:
Physical: (Available:115MB/Total:254MB)
Virtual: (Available:2001MB/Total:2047MB)
-----------------
Exception:
Breakpoint
-----------------
Backup Buffer:
REHASH
-----------------
Registers:
EAX=0x00000001 EBX=0x00efd858 ECX=0x0118a558
EDX=0x000f0000 ESI=0x7c910f97 EDI=0x0012ffb0
EIP=0x01143a28 EBP=0x0189fcdc ESP=0x0189fccc
-----------------
Stack Trace:
Module: MSVCRTD
#0 (null):0: free_dbg
#1 (null):0: free_dbg
#2 (null):0: free
Module: 3576B692.chansno
#3 (null):0: Mod_Unload
#4 (null):0: Mod_Unload
Module: wircd
#5 c:\dev\unreal3.2\src\modules.c:421: Unload_all_loaded_modules
#6 c:\dev\unreal3.2\src\s_conf.c:1540: init_conf
#7 c:\dev\unreal3.2\src\s_conf.c:7670: rehash_internal
#8 c:\dev\unreal3.2\src\s_conf.c:7651: rehash
#9 c:\dev\unreal3.2\src\s_serv.c:969: m_rehash
#10 c:\dev\unreal3.2\src\parse.c:440: parse
#11 c:\dev\unreal3.2\src\packet.c:139: dopacket
#12 c:\dev\unreal3.2\src\s_bsd.c:1477: read_packet
#13 c:\dev\unreal3.2\src\s_bsd.c:1937: read_message
#14 c:\dev\unreal3.2\src\ircd.c:1548: SocketLoop
Module: MSVCR70D
#15 c:\dev\unreal3.2\src\ircd.c:1548: beginthread
Module: kernel32
#16 c:\dev\unreal3.2\src\ircd.c:1548: GetLocaleInfoA
5. Get this Error when /rehash to load chansno.dll.
Generated at Sat Aug 07 11:38:30 2004

Windows XP Service Pack 2, v.2149 (5.1.2600)
Unreal3.2.1[FinWXeOoZEmM3] (1.1.1.1.2.1.2.1.2.2234.2.88 2004/07/03 18:28:16)
-----------------
Memory Information:
Physical: (Available:141MB/Total:254MB)
Virtual: (Available:2000MB/Total:2047MB)
-----------------
Exception:
Breakpoint
-----------------
Backup Buffer:
REHASH
-----------------
Registers:
EAX=0x00000001 EBX=0x00eff238 ECX=0x0118a558
EDX=0x000e0000 ESI=0x7c910f97 EDI=0x0012ffb0
EIP=0x01143a28 EBP=0x018bfcdc ESP=0x018bfccc
-----------------
Stack Trace:
Module: MSVCRTD
#0 (null):0: free_dbg
#1 (null):0: free_dbg
#2 (null):0: free
Module: 2D57AE54.chansno
#3 (null):0: Mod_Unload
#4 (null):0: Mod_Unload
Module: wircd
#5 c:\dev\unreal3.2\src\modules.c:421: Unload_all_loaded_modules
#6 c:\dev\unreal3.2\src\s_conf.c:1540: init_conf
#7 c:\dev\unreal3.2\src\s_conf.c:7670: rehash_internal
#8 c:\dev\unreal3.2\src\s_conf.c:7651: rehash
#9 c:\dev\unreal3.2\src\s_serv.c:969: m_rehash
#10 c:\dev\unreal3.2\src\parse.c:440: parse
#11 c:\dev\unreal3.2\src\packet.c:139: dopacket
#12 c:\dev\unreal3.2\src\s_bsd.c:1477: read_packet
#13 c:\dev\unreal3.2\src\s_bsd.c:1937: read_message
#14 c:\dev\unreal3.2\src\ircd.c:1529: SocketLoop
Module: MSVCR70D
#15 c:\dev\unreal3.2\src\ircd.c:1529: beginthread
Module: kernel32
#16 c:\dev\unreal3.2\src\ircd.c:1529: GetLocaleInfoA
6. UnrealIRCd now NOT even boot. when its startup with m_getinfo.dll.
Generated at Sat Aug 07 18:21:44 2004

Windows XP Service Pack 2, v.2149 (5.1.2600)
Unreal3.2.1[FinWXeOoZE] (1.1.1.1.2.1.2.1.2.2234.2.88 2004/07/03 18:28:16)
-----------------
Memory Information:
Physical: (Available:95MB/Total:254MB)
Virtual: (Available:2006MB/Total:2047MB)
-----------------
Exception:
Access Violation
-----------------
Backup Buffer:
PONG :4C477BBB
-----------------
Registers:
EAX=0x00efe640 EBX=0x00efe4d0 ECX=0x006e01eb
EDX=0x00000000 ESI=0x00000004 EDI=0x0012ffb0
EIP=0x017e2227 EBP=0x018ef314 ESP=0x018ef2e8
-----------------
Stack Trace:
Module: 12731BD9.chansno
#0 (null):0: Mod_Unload
Module: wircd
#1 c:\dev\unreal3.2\src\send.c:1776: sendto_connectnotice
#2 c:\dev\unreal3.2\src\s_user.c:1031: register_user
Module: A6D22FAD.commands
#3 c:\dev\unreal3.2\src\s_user.c:1031: m_addmotd_Load
#4 c:\dev\unreal3.2\src\s_user.c:1031: m_addmotd_Load
Module: wircd
#5 c:\dev\unreal3.2\src\parse.c:440: parse
#6 c:\dev\unreal3.2\src\packet.c:139: dopacket
#7 c:\dev\unreal3.2\src\s_bsd.c:1477: read_packet
#8 c:\dev\unreal3.2\src\s_bsd.c:1937: read_message
#9 c:\dev\unreal3.2\src\ircd.c:1548: SocketLoop
Module: MSVCR70D
#10 c:\dev\unreal3.2\src\ircd.c:1548: beginthread
Module: kernel32
#11 c:\dev\unreal3.2\src\ircd.c:1548: GetLocaleInfoA
I didnt tried all modules yet. if get more error i'll post them here.

Posted: Sat Aug 07, 2004 7:50 pm
by AngryWolf
I would tell you to stop reporting bugs of my modules here (basically this isn't the proper place, you should send them directly to me), however, because I've already seen the first error and still haven't got a clue how to fix it, I'm rather asking the official developers what they know about such crashes. Perhaps it's also a good idea to move this topic to the "Unreal3.2 modules" forum.

Posted: Sat Aug 07, 2004 7:56 pm
by AngryWolf
As an additional information, I assume these DLLs were compiled with VS 6.0, and in my opinion there seems to be a conflict between msvcrt70.dll and msvcrtd.dll. I'm not sure, because these modules are known to work fine on some Windows systems, while crashes always happen on others.

Posted: Sat Aug 07, 2004 9:16 pm
by Syzop
Most likely it's because these modules are compiled without zip links support.

While we made UnrealIRCd binary compatible with SSL/non-SSL, we did not do this for zip/non-zip since there's not really a good reason why you would want to do a non-ziplink compile (the only reason we offer distinct SSL and non-SSL versions is for legal reasons).
So, I suggest the person who compiles your mods (stealth? zell?) to compile with ziplinks enabled (just download a precompiled zlib/curl/etc library from http://www.vulnscan.org/unrealwin32dev/).
Something like:

Code: Select all

nmake -f makefile.win32 USE_ZIPLINKS=1 ZLIB_INC_DIR="c:\dev\zlib" ZLIB_LIB_DIR="c:\dev\zlib\dll32" custommodule MODULEFILE=m_getinfo
Unfortunately this was not documented anywhere...

Anyway, I noticed that making the structs ziplinks/non-ziplinks binary compatible is just a matter of adding 1 line, so I think I will do just that, so you won't have this problem anymore with 3.2.2 ;).

DETAILS:
if compiled with ziplinks disabled...
client struct...
#ifdef ZIP_LINKS
struct Zdata *zip; /* zip data */
#endif
then this is false, so everything after this item is shifted ~4 bytes (the actual data is at +4 bytes), and thus f*cked up:
This affects: (ssl,) lastrecvM, priority, receiveK, sendB, receiveB, listener, class, authfd, slot, ip, port, hostp, watches, watch, sockhost, passwd, error_str
/DETAILS

Angrywolf: When we are at it, I noticed in (at least) m_getinfo that you declared the command function (m_getinfo) as 'static int'.. this is a bit odd since the function is actually called from the outside, so instead I suggest using 'DLLFUNC int' or 'DLLFUNC CMD_FUNC(m_cmd)' [this didn't seem to cause any direct problems, but..].

*edit* I've updated the win32 compiling thread on this, also current CVS now made zip/non-zip compatible*/edit*

Posted: Sat Aug 07, 2004 9:51 pm
by AngryWolf
To Syzop: thanks for the suggestion, but I use "static" by design: it's well said that the command function is called from outside, as well as functions of command overrides, mode/snomask permission checkings, etc, however, to my best knowledge, "static int" mustn't cause any trouble, because, in case of global variables, "static" and "DLLFUNC" are only used to define scope, aren't they? I aim at keeping most of my variable and function names private to avoid symbol conflicts as much as I can. That might sound odd in case of "m_getinfo", but I simply can't see a reason to add m_getinfo to the symbol export table.

I'm not saying I can't be wrong, of course I can, and if so, I'm open to hear about cases when not using DLLFUNC can lead to bugs, and then I would immediately do the change.

[Edit: fixed my grammar mistakes. :)]

Posted: Sat Aug 07, 2004 9:54 pm
by Stealth
Syzop, if I were to recompile the win32 that I am making the modules off of with ZipLinks, would it automatically compile ZipLinks into the modules?

Posted: Sat Aug 07, 2004 11:25 pm
by Syzop
Stealth: unfortunately no :P. At *NIX yes, because we use Config and configure, but this whole step is skipped on windows and part of it is replaced by nmake parameters.
So basically, just do the ZIP_LINKS= part mentioned earlier when you want to recompile your mods.

Posted: Sun Aug 08, 2004 12:48 am
by Stealth
ok

Posted: Sun Aug 08, 2004 3:24 am
by codemastr
The DLLFUNC is not need for m_*. The win32 stuff is fun. DLLFUNC translates to __declspec(dllexport). What this does is, it adds a symbol to the dll that will be exported and stored in the dll's symbol table. With callback functions (such as a command function), this is unnecessary because you supply Unreal with a pointer to m_getinfo, you don't tell Unreal to find the symbol on its own. The only time DLLFUNC is used is for things Unreal calls GetProcAddress on. When Unreal calls GetProcAddress, it doesn't have a pointer, it just has the function name. So we're looking for the actual string name of the function in the dll. The DLLFUNC tells the dll to make that string available. The only symbols it matters for are Mod_Header, Mod_Version (that's handled internally so no need to worry about it), Mod_Test, Mod_Init, Mod_Load, and Mod_Unload. DLLFUNC is unnecessary for everything else.

Also, if you forget DLLFUNC, you won't experience any strange bugs, you'll notice the problem right away because Unreal will fail to load the module because it will say something like Mod_Init was not found (if Mod_Init lacked DLLFUNC). Or, in the case of things like Mod_Test which are not required, your Mod_Test will never be called.

Posted: Sun Aug 08, 2004 12:58 pm
by AngryWolf
Ok, thanks to Syzop and codemastr for the help, and Eros for the report, I'm much appreciated.

Posted: Sun Aug 08, 2004 2:41 pm
by Syzop
I was mainly talking about static vs non-static, I know symbols don't have to be exported (it's just a habbit of me to DLLFUNC' anything that is used by "the outside" ;p).
I've tested a bit and it doesn't cause any bugs, but this is my way of thinking:
I declare a function static because I know it's not going to be used from "the outside" (or even *don't want* it to be used from the outside), but making commands/events/.. static is a bit counter inituitive to me since.. they ARE called from "the outside" [remote, from the core], constantly, so that's a bit confusing.
Anyway, feel free to do whatever you want, this is completely off-topic and a useless discussion... which is exactly the reason why I didn't reply to you in the first place :P.

Good to hear you appreciate my effort, coz I did debug 1-2 hours on a _3rd party module not written by me_ [!!], something I won't do often, and never if requested.. this was just an exception ;p.