Page 1 of 2

[DONE] Porting GetLegitUsers from 3.2.x to 4.x

Posted: Fri Sep 09, 2016 6:18 pm
by ivp
It would be of great help if someone could port this module (attached) to Unreal 4. Many thanks in advance.

Re: Porting GetLegitUsers from 3.2.x to 4.x

Posted: Sun Sep 11, 2016 12:05 pm
by Gottem

Re: Porting GetLegitUsers from 3.2.x to 4.x

Posted: Sun Sep 11, 2016 5:04 pm
by ivp
Awesome, many thanks Gottem!

I've added module and reloaded IRC. Is it possible that it has something to do with crash after 2 hours:

kernel: unrealircd[11298]: segfault at 9c48f0 ip 00000000009c48f0 sp 00007ffdc4a09f58 error 15

It was stable 3 days before this.

Re: Porting GetLegitUsers from 3.2.x to 4.x

Posted: Sun Sep 11, 2016 5:37 pm
by Gottem
No, it shouldn't do that; my own IRCd has been running fine all day. And if you didn't execute /getlegitusers right before the crash, the module wasn't doing anything anyway. Do you have any other (third party) mods loaded?

Re: Porting GetLegitUsers from 3.2.x to 4.x

Posted: Mon Sep 12, 2016 7:04 am
by ivp
Yes, using one custom module from Syzop.

Is it possible to dump core or find the cause different way next time it happens?

Re: Porting GetLegitUsers from 3.2.x to 4.x

Posted: Mon Sep 12, 2016 6:09 pm
by Gottem
Well, you can probably fiddle around with GNU debugger (gdb). Just attach it to the unrealircd process (gdb -p <pid>) and use the "continue" command. Then when it crashes you should be able to get a backtrace with "bt". =]

Just out of curiosity: What were you/was the server doing at the time of the crash (and just before)? Any users present on the network (both people and services bots) besides you?

Re: Porting GetLegitUsers from 3.2.x to 4.x

Posted: Tue Sep 13, 2016 9:47 am
by ivp
The server was full, I wasn't around.

Now it happened again when I was there, nobody did anything special:

Code: Select all

kernel: unrealircd[41776]: segfault at 4841e349 ip 000000004841e349 sp 00007ffe44191158 error 14 in 8EF21E.jointhrottle.so[7ff2ec4c3000+2000]
Two days ago:

Code: Select all

kernel: unrealircd[11298]: segfault at 9c48f0 ip 00000000009c48f0 sp 00007ffdc4a09f58 error 15
Tried now gdb -p <pid> and continue, then Ctrl+Z to send it to background, but after some time gdb process vanished from memory.

Re: Porting GetLegitUsers from 3.2.x to 4.x

Posted: Tue Sep 13, 2016 1:44 pm
by Gottem
The latest segfault refers to jointhrottle, so at least it's not this module causing it. Not sure if you did, but you're supposed to attach gdb prior to the crash, otherwise it can't give you a backtrace anyways since it wasn't around when it happened. And I'm not certain if you're "allowed" to send gdb to background, don't think so tbh. =]

Also, apparently you can do "/home/<USER>/<unreal installation dir>/unrealircd backtrace" as well.

Re: Porting GetLegitUsers from 3.2.x to 4.x

Posted: Tue Sep 13, 2016 1:52 pm
by ivp
Right, but the crash happens every 2 days, so I need to launch it in background and log off somehow?

"unrealircd backtrace" doesn't seem to work, it just prints out "Usage: unrealircd [-f <config>] [-h <servername>] [-p <port>] [-x <loglevel>] [-t] [-F]"

Re: Porting GetLegitUsers from 3.2.x to 4.x

Posted: Tue Sep 13, 2016 2:03 pm
by Gottem
Are you familiar with screen/tmux? They allow you to start a shell and detach from it while the process keeps running. May wanna check out: http://aperiodic.net/screen/quick_reference

And it seems you're calling the binary directly, not the wrapper script. You need the one you use to start, rehash and croncheck etc.

Alternatively, try forcing a crash by doing a bunch of /joins perhaps.

Re: Porting GetLegitUsers from 3.2.x to 4.x

Posted: Tue Sep 13, 2016 2:25 pm
by ivp
Many thanks Gottem, got it now with "unrealircd backtrace". Is such report different than the one gdb would create directly?

I've opened the bug report, hopefully Syszop will solve this issue.

Re: Porting GetLegitUsers from 3.2.x to 4.x

Posted: Tue Sep 13, 2016 3:44 pm
by Syzop
Just to confirm this has nothing to do with this module.

We're handling it now at Unreal..

Re: Porting GetLegitUsers from 3.2.x to 4.x

Posted: Tue Sep 13, 2016 4:57 pm
by Gottem
You're welcome ivp. =] I think the backtrace from Unreal and gdb are pretty much the same, as Unreal just reads a core dump it makes after a crash.

Re: Porting GetLegitUsers from 3.2.x to 4.x

Posted: Wed Sep 14, 2016 12:48 pm
by Syzop
"unrealircd backtrace" doesn't seem to work, it just prints out "Usage: unrealircd [-f <config>] [-h <servername>] [-p <port>] [-x <loglevel>] [-t] [-F]"
You are running the wrong 'unrealircd' :)

Normally people have a setup like this:
/home/irc/unrealircd-4.0.6: this is where you compile UnrealIRCd from and this contains src, include, etc...
Then you install UnrealIRCd to somewhere, like:
/home/irc/unrealircd

Then /home/irc/unrealircd will have directories like 'bin', 'data', 'logs' etc and also a script called 'unrealircd'.
Then, to start UnrealIRCd:
cd /home/irc/unrealircd
./unrealircd start
To stop
./unrealircd stop
To backtrace
./unrealircd backtrace

This is a key difference between 3.2.x and 4.0.x (it was optional in 3.2.x and is mandatory in 4.0.x). I tried to mention it at several places such as the release notes and all email announcements, but I can't blame you overlooked if you are so used to 3.2.x :)

I always suggest to use the script. If you would have used the script it would also have seen UnrealIRCd has crashed and offered you to send the backtrace and core files to the UnrealIRCd team.. so much simpler.

***
As for the difference between a manual gdb session (just for reference):
UnrealIRCd will fix the (temporary) modules in tmp if you use ./unrealircd backtrace. If you don't do this and UnrealIRCd has been restarted after the crash and run gdb manually then your backtrace will be missing crucial information since it can't find the .so files and thus will output many ?????? instead of line numbers and function names. Best always to just run './unrealircd backtrace'

Re: Porting GetLegitUsers from 3.2.x to 4.x

Posted: Wed Sep 14, 2016 1:09 pm
by ivp
Of course we are using: ./unrealircd start

Also using ~/unrealircd croncheck in crontab and found that after the crash there is crond process hanging with postdrop trying to send some email.

Anyway, not sure how does UnrealIRCd "offers me" to send anything, since I am not always logged on ;)