Page Index Toggle Pages: 1 ReplyAdd Poll Send Topic
Normal Topic Server problem for print function (Read 3017 times)
 
Paste Member Name in Quick Reply Box pyragony54
Language
***
Offline


I Love YaBB!

Posts: 852
Location: Йошкар-Ола
Joined: May 25th, 2014
Gender: Male
Mood: Dead
Zodiac sign: Scorpio
Server problem for print function
Nov 13th, 2014 at 3:48am
Mark & QuoteQuote  
I think the pictures say it all already. Our server operator has already threatened with dismissal. Our CPU usage constantly increased to 100% and we had no explanation why. In the early versions YaBB this was not the case. After a few days of observation, I had the declaration by constantly monitoring and comparing the error log. It is the print function. Somehow spambots press the Print function and a few hundred times in a row and within seconds. This drives the CPU utilization on the top. They also automatically falls not decrease even if the spammer disappears. I have only then restart Apache.

The print function must be revised fastest and brooks no delay. Well, it would also be able to disable this feature in the Admin Center.
  

Bild2_010.jpg ( 159 KB | 154 Downloads )
Bild4_001.jpg ( 100 KB | 156 Downloads )

if (idea == 'none') {use (manuals) && (Google | | search)}
if ($ answer == 0) {post (question)}
Back to top
 
IP Logged
 
Paste Member Name in Quick Reply Box Dandello
Forum Administrator
YaBB Modder
*****
Offline


I love YaBB 2.7!

Posts: 2234
Location: The Land of YaBB
Joined: Feb 12th, 2014
Gender: Female
Mood: Annoyed
Zodiac sign: Virgo
Re: Server problem for print function
Reply #1 - Nov 13th, 2014 at 5:14am
Mark & QuoteQuote  
I suggest you add ErrorLog Security to block the repeat offenders.

I'll look at creating some Admin print options - like members only and/or disabling Print Post.
  

Perfection is not possible. Excellence, however, is excellent.
Back to top
WWW  
IP Logged
 
Paste Member Name in Quick Reply Box pyragony54
Language
***
Offline


I Love YaBB!

Posts: 852
Location: Йошкар-Ола
Joined: May 25th, 2014
Gender: Male
Mood: Dead
Zodiac sign: Scorpio
Re: Server problem for print function
Reply #2 - Nov 13th, 2014 at 2:54pm
Mark & QuoteQuote  
thank Dandello. I'm going tonight with the night express from northern Germany to southern Germany. Look at me then tomorrow morning. Could help. It is important that you can turn off the print function for guests.

I think I will not be there the only one who could have the problem.

My house is almost finished and in two to three weeks, I have more time for YaBB.
  

if (idea == 'none') {use (manuals) && (Google | | search)}
if ($ answer == 0) {post (question)}
Back to top
 
IP Logged
 
Paste Member Name in Quick Reply Box Dandello
Forum Administrator
YaBB Modder
*****
Offline


I love YaBB 2.7!

Posts: 2234
Location: The Land of YaBB
Joined: Feb 12th, 2014
Gender: Female
Mood: Annoyed
Zodiac sign: Virgo
Re: Server problem for print function
Reply #3 - Nov 13th, 2014 at 4:07pm
Mark & QuoteQuote  
I'm in the process of fine-tuning the code for disabling Print Post. Print Topic has been part of YaBB for a long time but Print Post is a newer function and I can see bots hammering at all the links in a topic. And it's not just that they're opening hundreds of pages - they're also hammering the ErrorLog when those pages throw errors.

Adding the additional ErrorLog Security will help block the fast repeat offenders using .htaccess to stop them before they hit the cgi-bin. (It's a "three strikes you're out" mechanism - 3 errors in an inhumanly fast time and the IP gets blocked.)
  

Perfection is not possible. Excellence, however, is excellent.
Back to top
WWW  
IP Logged
 
Paste Member Name in Quick Reply Box pyragony54
Language
***
Offline


I Love YaBB!

Posts: 852
Location: Йошкар-Ола
Joined: May 25th, 2014
Gender: Male
Mood: Dead
Zodiac sign: Scorpio
Re: Server problem for print function
Reply #4 - Nov 13th, 2014 at 6:33pm
Mark & QuoteQuote  
Yes, but that will not stop the problem. The CPU then sends continuously the printer information and that makes them until a message comes from the printer. Eventually increases the load on the CPU to 100%. It then helps only a restart of Apache and I'm sometimes up to 10 times a day.
  

if (idea == 'none') {use (manuals) && (Google | | search)}
if ($ answer == 0) {post (question)}
Back to top
 
IP Logged
 
Paste Member Name in Quick Reply Box Dandello
Forum Administrator
YaBB Modder
*****
Offline


I love YaBB 2.7!

Posts: 2234
Location: The Land of YaBB
Joined: Feb 12th, 2014
Gender: Female
Mood: Annoyed
Zodiac sign: Virgo
Re: Server problem for print function
Reply #5 - Nov 13th, 2014 at 6:53pm
Mark & QuoteQuote  
Okay - so we also need a method of detecting if there's a printer or have a timeout on the process (or javascript intercept of some nature ).

I should have the Print Post permissions ready in a few hours as well.
  

Perfection is not possible. Excellence, however, is excellent.
Back to top
WWW  
IP Logged
 
Paste Member Name in Quick Reply Box Dandello
Forum Administrator
YaBB Modder
*****
Offline


I love YaBB 2.7!

Posts: 2234
Location: The Land of YaBB
Joined: Feb 12th, 2014
Gender: Female
Mood: Annoyed
Zodiac sign: Virgo
Re: Server problem for print function
Reply #6 - Nov 13th, 2014 at 8:13pm
Mark & QuoteQuote  
Okay - the actual Print function is javascript. BUT, calling the printable page generates a new page which has to be closed by hand even after the print job has finished.

So I see a couple of problems - one is that the page can be generated by bots and the other is that it doesn't close when the print job is done.
  

Perfection is not possible. Excellence, however, is excellent.
Back to top
WWW  
IP Logged
 
Paste Member Name in Quick Reply Box Dandello
Forum Administrator
YaBB Modder
*****
Offline


I love YaBB 2.7!

Posts: 2234
Location: The Land of YaBB
Joined: Feb 12th, 2014
Gender: Female
Mood: Annoyed
Zodiac sign: Virgo
Re: Server problem for print function
Reply #7 - Nov 13th, 2014 at 11:31pm
Mark & QuoteQuote  
Some experimental fixes:

In Languages/English/Main.lng add just above the 1; at the bottom
Code (Perl)
Select All
$maintxt{'printpage'} = 'Print this page'; 



In Sources/Display.pm find:
Code (Perl)
Select All
    $template_print =
 qq~$menusep<a href="$scripturl?action=print;num=$viewnum" target="_blank">$img{'print'}</a>~;
  


replace with
Code (Perl)
Select All
    $template_print =
 qq~$menusep<a href="javascript:void(window.open('$scripturl?action=print;num=$viewnum','printw
indow'))">$img{'print'}</a>~;
  



Find:
Code (Perl)
Select All
            $template_print_post =
 qq~$menusep<a href="$scripturl?action=print;num=$viewnum;post=$postnum" target="_blank">$img{'printp'}</a>~;
  


Replace with:
Code (Perl)
Select All
                $template_print_post =
 qq~$menusep<a stnum','printwindow'))">$img{'printp'}</a>~; 



In Sources/InstantMessage.pm find:
Code (Perl)
Select All
    $showIM_link .= qq~
             $menusep<a href="$scripturl?action=imprint;caller=$INFO{'caller'};id=$messageid" target="_blank">$img{'print_im'}</a>
         ~;
  


Replace with:
Code (Perl)
Select All
    $showIM_link .= qq~
             $menusep<a href="javascript:void(window.open('$scripturl?action=imprint;caller=$INFO{'calle
r'};id=$messageid','printwindow'))">$img{'print_im'}</a>
         ~; 



In Sources/Printpage.pm find
Code (Perl)
Select All
 function printPage() {
     if (window.print) {
         agree = confirm('$maintxt{773}');
         if (agree) window.print();
     }
 }
  


Remove it. (twice)
Find
Code (HTML)
Select All
<body onload="printPage()"> 


Replace with
Code (HTML)
Select All
<body> 

(twice)

Find:
Code (Perl)
Select All
</table>
 <br />~;

     $output .= qq~ 


Replace with:
Code (Perl)
Select All
</table>
 <form><p style="text-align:center"><input type="button" value=" $maintxt{'printpage'} " onclick="window.print();" /></p></form>
 ~;

     $output .= qq~ 



Find:
Code (Perl)
Select All
<br />~;
     }

     $output .= qq~ 


Replace with:
Code (Perl)
Select All
<br />
 ~;
     }

     $output .= qq~
 <form><p style="text-align:center"><input type="button" value=" $maintxt{'printpage'} " onclick="window.print();" /></p></form>
  



These changes use javascript to create the 'printable window' and also uses a button to call the actual print function. (One of the things I'm pretty sure was happening was the server was waiting for a browser response on a function that was automatically loaded but a bot couldn't respond to - and so long as it was waiting, CPU resources were being eaten up.)

I would like to have the printable window autoclose after printing but the 'window.close' function doesn't work properly in Chrome/Safari.
  

Perfection is not possible. Excellence, however, is excellent.
Back to top
WWW  
IP Logged
 
Paste Member Name in Quick Reply Box Red Barchetta
Junior Member
**
Offline



Posts: 62
Location: Miami, FL. USA
Joined: Oct 4th, 2014
Gender: Male
Zodiac sign: Aries
Re: Server problem for print function
Reply #8 - Nov 22nd, 2014 at 1:15am
Mark & QuoteQuote  
Just a quick note, but remember that IIS does not use .htaccess, so it will have no effect when YABB is running on a Windows IIS server.
  

Florida Classics and Muscle Car Automotive Forum Administrator
Back to top
WWW  
IP Logged
 
Paste Member Name in Quick Reply Box Dandello
Forum Administrator
*****
Offline


I love YaBB 2.7!

Posts: 2234
Location: The Land of YaBB
Joined: Feb 12th, 2014
Gender: Female
Mood: Annoyed
Zodiac sign: Virgo
Re: Server problem for print function
Reply #9 - Nov 22nd, 2014 at 5:50am
Mark & QuoteQuote  
Switching the 'open window' command to javascript should solve most of the problem with bots and blocking guest access via the mod will help. (And I'll get onto adding the permissions section for the other print function soon.)
  

Perfection is not possible. Excellence, however, is excellent.
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
ReplyAdd Poll Send Topic
Bookmarks: del.icio.us Digg Facebook Google LinkedIn reddit Twitter Yahoo
Server problem for print function

Please type the characters exactly as they appear in the image,
without the first 2 and last 2 characters.
The characters must be typed in the same order,
and they are case-sensitive.
Open Preview Preview

You can resize the textbox by dragging the right or bottom border.
Off Topic Comment Insert Spoiler
Insert Hyperlink Insert FTP Link Insert Image Insert E-mail Insert Media Insert Table Insert Table Row Insert Table Column Insert Horizontal Rule Insert Teletype Insert Code Insert Quote Edited Superscript Subscript Insert List /me - my name Insert Marquee Insert Timestamp No Parse
Bold Italicized Underline Insert Strikethrough Highlight
                       
Change Text Color
Insert Preformatted Text Left Align Centered Right Align
resize_wb
resize_hb







Max 5000 characters. Remaining characters:
Text size: %
More Smilies
View All Smilies
Collapse additional features Collapse/Expand additional features Smiley Wink Cheesy Grin Angry Sad Shocked Cool Huh Roll Eyes Tongue Embarrassed Lips Sealed Undecided Kiss Cry