[bug] PtokaX 0.4.1.0 infinite loop in !tempban command
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

[bug] PtokaX 0.4.1.0 infinite loop in !tempban command

Started by dmvn, 14 June, 2008, 10:24:15

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

dmvn

PtokaX falls into infinite loop if using !tempban command. This bug was already confirmed by my friends (hub-owners) who upgraded to Px 0.4.1 RC8/final version (don't know if it happens in 0.4.0.0 ... ).

Symptoms: PtokaX falls into inf. loop immediately after !tempban execution, so it's nothing to do with it exept terminate process (alt+f4 does not work).

Please note that while banning via lua scripts, no bugs occured. This is incorrect behavior of this very command.

Probably will provide some debug info for this bug (no crashlog, only ptr to loop, probably)... Hope this helps.
Sorry if this is already reported, have no access to tracker to view... -- seems that it does not working (

PPK

Working without problems for me...
QuoteHub:   [127.0.0.1:4861]      >>   <PPK> !tempban PePeKa 1w test|
Hub:   [127.0.0.1:4861]    <<     <_@o'> *** PePeKa with IP 127.0.0.1 has been temp banned by PPK to: 7 days because: test.|
Hub:   [127.0.0.1:4861]    <<     $Quit PePeKa|
Banned user received:
QuoteHub:   [127.0.0.1:411]    <<     <_@o'> You had been temp banned to: 7 days because: test.|
And hub always running without neverending loop  ::)
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

dmvn

Mutor, I speak of !tempban command, not Lua API function, you see? I bolded in the 1st post that NO SCRIPTING is need to hang hub (moreover, using luascript function BanMan.TempBan() works PERFECTLY).

In my case, the !tempban command is sent from dc client. This occurs at not every !tempban command I use, of course, so PPK's test is not a proof yet. So we must wait until smb confirms it (I caught this bug three times, and my friend caught it a few times after upgrading to px4).

Maybe you can provide a debug version of PtokaX module so we can put it on our hub and try to catch it? Maybe add some logging to file/etc near tempban handling code?

Scanning

i am a bit curious, what version of Ptokax are you using, Windows, with or without gui, Vista, Linux...
I am tempbanning users all day long with raw from client and had 5 or 6 days without any loop whatsoever
Running on linux myself

ahh, sorry, did not see that with Alt F:4

PPK

Quote[2008-06-15 08:57:36] <_@o'> *** [CZ]Agama_Sudety with IP 85.132.169.xx has been temp banned by PPK to: 1 min because: Ignore this message please, we only testing hub software....
[2008-06-15 08:57:36] <_@o'> *** [CZ]Sarinka with IP 212.11.123.xx has been temp banned by PPK to: 1 min because: Ignore this message please, we only testing hub software....
[2008-06-15 08:57:36] <_@o'> *** [Other][SK]1000bubu1000 with IP 213.160.187.xx has been temp banned by PPK to: 1 min because: Ignore this message please, we only testing hub software....
[2008-06-15 08:57:36] <_@o'> *** [Pit Bull]-Ranger- with IP 62.140.233.xx has been temp banned by PPK to: 1 min because: Ignore this message please, we only testing hub software....
[2008-06-15 08:57:36] <_@o'> *** Alf with IP 213.226.208.xx has been temp banned by PPK to: 1 min because: Ignore this message please, we only testing hub software....
[2008-06-15 08:57:36] <_@o'> *** B.M. with IP 68.255.101.xx has been temp banned by PPK to: 1 min because: Ignore this message please, we only testing hub software....
[2008-06-15 08:57:36] <_@o'> *** Bart with IP 82.150.166.xx has been temp banned by PPK to: 1 min because: Ignore this message please, we only testing hub software....
[2008-06-15 08:57:36] <_@o'> *** Brr,12cz with IP 83.208.105.xx has been temp banned by PPK to: 1 min because: Ignore this message please, we only testing hub software....
[2008-06-15 08:57:36] <_@o'> *** cimi with IP 213.192.58.xx has been temp banned by PPK to: 1 min because: Ignore this message please, we only testing hub software....
[2008-06-15 08:57:36] <_@o'> *** Condor007 with IP 88.101.194.xx has been temp banned by PPK to: 1 min because: Ignore this message please, we only testing hub software....
[2008-06-15 08:57:36] <_@o'> *** dandy with IP 212.80.64.xx has been temp banned by PPK to: 1 min because: Ignore this message please, we only testing hub software....
[2008-06-15 08:57:36] <_@o'> *** Dekmen58 with IP 78.136.171.xx has been temp banned by PPK to: 1 min because: Ignore this message please, we only testing hub software....
[2008-06-15 08:57:36] <_@o'> *** EF with IP 93.81.28.xx has been temp banned by PPK to: 1 min because: Ignore this message please, we only testing hub software....
[2008-06-15 08:57:36] <_@o'> *** ErikKneisl with IP 90.177.55.xx has been temp banned by PPK to: 1 min because: Ignore this message please, we only testing hub software....
[2008-06-15 08:57:36] <_@o'> *** Fabko007 with IP 195.146.156.xx has been temp banned by PPK to: 1 min because: Ignore this message please, we only testing hub software....
[2008-06-15 08:57:36] <_@o'> *** feky with IP 77.247.224.xx has been temp banned by PPK to: 1 min because: Ignore this message please, we only testing hub software....
[2008-06-15 08:57:36] <_@o'> *** figi66 with IP 89.176.211.xx has been temp banned by PPK to: 1 min because: Ignore this message please, we only testing hub software....
[2008-06-15 08:57:36] <_@o'> *** Flickmasterpoint with IP 89.102.21.xx has been temp banned by PPK to: 1 min because: Ignore this message please, we only testing hub software....
[2008-06-15 08:57:36] <_@o'> *** fotacek with IP 79.98.157.xx has been temp banned by PPK to: 1 min because: Ignore this message please, we only testing hub software....
[2008-06-15 08:57:36] <_@o'> *** FoxMulderandScully with IP 217.66.174.xx has been temp banned by PPK to: 1 min because: Ignore this message please, we only testing hub software....
[2008-06-15 08:57:36] <_@o'> *** fresca with IP 71.194.110.xx has been temp banned by PPK to: 1 min because: Ignore this message please, we only testing hub software....
[2008-06-15 08:57:36] <_@o'> *** Hary01 with IP 85.248.5.xx has been temp banned by PPK to: 1 min because: Ignore this message please, we only testing hub software....
[2008-06-15 08:57:36] <_@o'> *** Hrochssssss with IP 88.102.231.xx has been temp banned by PPK to: 1 min because: Ignore this message please, we only testing hub software....
[2008-06-15 08:57:36] <_@o'> *** hugo with IP 98.26.118.xx has been temp banned by PPK to: 1 min because: Ignore this message please, we only testing hub software....
[2008-06-15 08:57:36] <_@o'> *** Jadro_Jadrovic2 with IP 88.146.251.xx has been temp banned by PPK to: 1 min because: Ignore this message please, we only testing hub software....
[2008-06-15 08:57:36] <_@o'> *** jenicccek with IP 83.208.243.xx has been temp banned by PPK to: 1 min because: Ignore this message please, we only testing hub software....
[2008-06-15 08:57:36] <_@o'> *** jimiszHU with IP 85.216.220.xx has been temp banned by PPK to: 1 min because: Ignore this message please, we only testing hub software....
[2008-06-15 08:57:36] <_@o'> *** johana with IP 78.51.9.xx has been temp banned by PPK to: 1 min because: Ignore this message please, we only testing hub software....
[2008-06-15 08:57:36] <_@o'> *** jura with IP 90.176.80.xx has been temp banned by PPK to: 1 min because: Ignore this message please, we only testing hub software....
[2008-06-15 08:57:36] <_@o'> *** karea with IP 81.153.115.xx has been temp banned by PPK to: 1 min because: Ignore this message please, we only testing hub software....
[2008-06-15 08:57:36] <_@o'> *** kikicz with IP 213.195.230.xx has been temp banned by PPK to: 1 min because: Ignore this message please, we only testing hub software....
[2008-06-15 08:57:36] <_@o'> *** KillVosa with IP 80.188.32.xx has been temp banned by PPK to: 1 min because: Ignore this message please, we only testing hub software....
[2008-06-15 08:57:36] <_@o'> *** kmotor with IP 151.202.44.xx has been temp banned by PPK to: 1 min because: Ignore this message please, we only testing hub software....
[2008-06-15 08:57:36] <_@o'> *** lailinka with IP 82.99.152.xx has been temp banned by PPK to: 1 min because: Ignore this message please, we only testing hub software....
[2008-06-15 08:57:36] <_@o'> *** lupa with IP 88.103.159.xx has been temp banned by PPK to: 1 min because: Ignore this message please, we only testing hub software....
[2008-06-15 08:57:36] <_@o'> *** MAGic99 with IP 84.244.120.xx has been temp banned by PPK to: 1 min because: Ignore this message please, we only testing hub software....
[2008-06-15 08:57:36] <_@o'> *** mardur327 with IP 84.47.112.xx has been temp banned by PPK to: 1 min because: Ignore this message please, we only testing hub software....
[2008-06-15 08:57:36] <_@o'> *** marecek with IP 81.104.185.xx has been temp banned by PPK to: 1 min because: Ignore this message please, we only testing hub software....
[2008-06-15 08:57:36] <_@o'> *** Martin with IP 84.42.147.xx has been temp banned by PPK to: 1 min because: Ignore this message please, we only testing hub software....
[2008-06-15 08:57:36] <_@o'> *** MATRIXX with IP 89.102.31.xx has been temp banned by PPK to: 1 min because: Ignore this message please, we only testing hub software....
[2008-06-15 08:57:36] <_@o'> *** merlin60GB with IP 92.235.223.xx has been temp banned by PPK to: 1 min because: Ignore this message please, we only testing hub software....
[2008-06-15 08:57:36] <_@o'> *** Mil with IP 89.190.44.xx has been temp banned by PPK to: 1 min because: Ignore this message please, we only testing hub software....
[2008-06-15 08:57:36] <_@o'> *** Miramravenec with IP 90.177.170.xx has been temp banned by PPK to: 1 min because: Ignore this message please, we only testing hub software....
[2008-06-15 08:57:36] <_@o'> *** Oem with IP 147.230.154.xx has been temp banned by PPK to: 1 min because: Ignore this message please, we only testing hub software....
[2008-06-15 08:57:36] <_@o'> *** pata with IP 89.176.216.xx has been temp banned by PPK to: 1 min because: Ignore this message please, we only testing hub software....
[2008-06-15 08:57:36] <_@o'> *** Pepos with IP 92.243.204.xx has been temp banned by PPK to: 1 min because: Ignore this message please, we only testing hub software....
[2008-06-15 08:57:36] <_@o'> *** pitrsh with IP 80.87.177.xx has been temp banned by PPK to: 1 min because: Ignore this message please, we only testing hub software....
[2008-06-15 08:57:36] <_@o'> *** popo with IP 83.240.54.xx has been temp banned by PPK to: 1 min because: Ignore this message please, we only testing hub software....
[2008-06-15 08:57:36] <_@o'> *** richchi with IP 81.19.35.xx has been temp banned by PPK to: 1 min because: Ignore this message please, we only testing hub software....
[2008-06-15 08:57:36] <_@o'> *** Rogin with IP 85.135.138.xx has been temp banned by PPK to: 1 min because: Ignore this message please, we only testing hub software....
[2008-06-15 08:57:38] <_@o'> *** sAm with IP 88.146.207.xx has been temp banned by PPK to: 1 min because: Ignore this message please, we only testing hub software....
[2008-06-15 08:57:38] <_@o'> *** Sberatel.V with IP 88.100.74.xx has been temp banned by PPK to: 1 min because: Ignore this message please, we only testing hub software....
[2008-06-15 08:57:38] <_@o'> *** studacek with IP 212.80.64.xx has been temp banned by PPK to: 1 min because: Ignore this message please, we only testing hub software....
[2008-06-15 08:57:38] <_@o'> *** Thales with IP 77.48.51.xx has been temp banned by PPK to: 1 min because: Ignore this message please, we only testing hub software....
[2008-06-15 08:57:38] <_@o'> *** Tuzemak with IP 92.62.224.xx has been temp banned by PPK to: 1 min because: Ignore this message please, we only testing hub software....
[2008-06-15 08:57:38] <_@o'> *** ultra with IP 217.115.242.xx has been temp banned by PPK to: 1 min because: Ignore this message please, we only testing hub software....
[2008-06-15 08:57:38] <_@o'> *** vajcalo with IP 82.73.154.xx has been temp banned by PPK to: 1 min because: Ignore this message please, we only testing hub software....

I don't have more users for testing ;D
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

dmvn

We're running PtokaX 0.4.1.0 GUI software under Windows2003 server system (that is more than stable, continuous uptime 3-6 months is not a problem). The hub is heavily loaded (20.000+ registered users, 5k+ online), but my friend caught this on a low-loaded hub (under XP SP2).

I believe there are some special conditions exist... Ok, will try to provide ban command example that lead to looping... Please note that we're from Russia, so we have some cyrillic messages in ban reason... Btw, my friend is also from Russia, so he also (more likely) uses chars with codes > 0x7F.

Here is the raw format of command (contains some windows-1251 chars)
"$<%[mynick]> !tempban %[nick] %[line:Введите время (обычно 4h):] ПРАВИЛО НОМЕР: %[line:Введите номер правила:]. %[line:Введите причину:]&#124;|"



PPK

Ehm...
Quote11:04:36 - [SYS] Unknown command ($<PPK> !tempban PePeKa 1m ??????? ?????: wtf?. wtf!&#124;|) from PPK (127.0.0.1) - user closed.
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

dmvn

Ehm... strange to hear that from hub dev... That string was exactly the line that is invoked as UserCommand :) So put this line as UC in your favourite DC client and... Well, don't hurry, I'm sure I'll manage to catch this via debugger and provide a loop ptr...

dmvn

Quote from: Mutor on 15 June, 2008, 14:51:43
I understand what you wrote, but that does not ensure it isn't a scripted function that was written poorly.
One CAN write a script that uses the same '!tempban' command. We'll assume that it isn't a script but the
format of your user command. What purpose does the trailing colon serve in each [line:statement:]
of your user command serve?
There is nothing to assume. It's a FACT :)
Now, answering to your (good) question: It's quite easy to understand if you use any DC client that allow parameters in UserCommands. The user command (that goes from dc client directly, w/o any scripting) is formatted to !tempban command in a such way:
!tempban <nickname_of_user_to_ban> <time> <reason>

where reason is combined from two strings: rule number (our hub Rules) and text msg with reason. For example: "rule: 8, reason: fake share detected".

Text strings with trailing colons in [...] are only a descriptions of UserCommand parameters (so it's client-side interface, e.g. ApexDC). The command that goes to hub has the standard syntax, as described above (nick time text_of_reason).

bastya_elvtars

How about trying to kick (with the built-in client kicker) someone with this reason: because_BAN_1h
Everything could have been anything else and it would have just as much meaning.

PPK

Quote from: dmvn on 15 June, 2008, 11:41:19
That string was exactly the line that is invoked as UserCommand :)
Then i don't have idea how you causing never ending loop (if you ever created one, imho you only wasting here my time and no never ending loop exist) but i'm 100 % sure that it is not with !tempban command if you use that usercommand because that usercommand is not valid direct connect command >:(
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

dmvn

PPK, if I have any ideas why I managed to put ptokax.exe into loop, i'd already posted a diassembly with all explanations what happened. I dont like to waste others time, so if you're sure that you're absolutely right, you can simply step aside while our Moscow hub-owners will track this looping :) As I'm a programmer too, and I won't ask for special help, I only report that I saw using your soft (3 times, not one -- if one, i won't ever blink with my eyes, but when my hub stopped in the third time i damned everything because my Ops became angry!). And believe me, i can recognize looped app, ever if you dont' believe in those loops existence.

I'm still sure that bug exists. Well, please, let us wait while smb confirms it. If you cannot confirm, please write nothing to this topic :)

dmvn

Quote from: bastya_elvtars on 15 June, 2008, 17:18:52
How about trying to kick (with the built-in client kicker) someone with this reason: because_BAN_1h
Well, there are many solutions how to avoid direct !tempban exec (scripting, etc). But now we're trying to find the reason of a problem that I've detected...

dmvn

Well. Thanks for yr patience & please forgive me, i cut that line from script that adds command to menu a little bit inaccurately. Of course, no quotes and $ sign in the beginning is necessary. And colons at the end are compound part of Russian language, that's all :) (we put colon at the end of prompts usually, like that:

Enter reason: (bla-bla-bla)

So that colons are not control chars, but they are parts of desc strings.

I run now my main hub under debugger, so when it occurs again, we'll see where it looped. Hope this comes soon, so we should only wait.

PS. I recently received a exceptionlog.txt from PX0.4.0.0 crash, but i wish to ask if PPK needs it before i post it somewhere @ this forum (just because verson is not 04.1.0).

dmvn

Well done, everything is clear now.

I'm using PXH module 0.4.1.0 (md5sum: b8a7963e884f9c05060752bdd121106b). Infinite loop that i've detected is caused by unhandled exception that occurs (in a stable manner) near ptr .55f9d3 (it's a _vprinter subroutine that is invoked inside sprintf). This is the library function, so we can only pray that it is not buggy. So we should assume that code is tidy here, and will dig further.

Stack backtracing shows us that sprintf that caused exception was called from subr .4b2210 that translates bantime into string rep. Here it is:
.text:004B228D      push    eax                             ; push "year" string
.text:004B228E      lea     ecx, [esi+0E4h]
.text:004B2294      push    [ebp+var_8+4]              ; __int64 number (year)
.text:004B2297      push    [ebp+var_8]
.text:004B229A      push    ecx                             ; format
.text:004B229B      lea     eax, [ebp+output_buffer]
.text:004B22A1      push    eax                             ; buffer
.text:004B22A2      call    _sprintf                        ; HERE IT WILL CRASH
.text:004B22A7      add     esp, 14h


this behavior can be reproduced invoking, for example with
!tempban username 400d any_reason

but not with the
!tempban username 350d any_reason

you see the diff? 350d < 365d=1y < 400d. 400d is more than 365d so it's 1year+some days. And 1st line will ultimately lead to described exception. I'm too lazy to dig up entire diassembly (although I can), you have sources hence you'll find bug 1024 times quicker.

Please note that bug cannot be reproduced at PXH 0.4.1.RC2 (!), but I don't ever tracked why. But it exists in RC8 and release versions.

We don't exactly remember if we managed to loop PXH with bantime < 1y (but, e.g. 100000000m-ban 'works' perfecly -- we'll catch analogous exception and loop).

Good luck in bugtracking :)

PPK

Nice, thank you for report. Looks like crash is only in windows version and only when tempban message contains year(s) ::) Sadly borland and microsoft compiler don't have warnings for errors in code like that, gcc have it and that is why bug is not in posix version  ;D
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

dmvn

yes, exactly. Only if bantime is more than 1year long.

Russian DC++ community is waiting for fixed release :) Our people like to get long bans  ;D

bastya_elvtars

Quote from: dmvn on 16 June, 2008, 00:31:52
Well, there are many solutions how to avoid direct !tempban exec (scripting, etc). But now we're trying to find the reason of a problem that I've detected...

I wanted to know whether it brings this loop on. But it's already solved.
(No, I was not offering workarounds.)
Everything could have been anything else and it would have just as much meaning.

SMF spam blocked by CleanTalk