Page Index Toggle Pages: 1
Topic Tools
Normal Topic Endless loops in YaBB? (Read 5,447 times)
Jet Li
Legacy Dev Team
Development Team
****
Offline



Posts: 6,588
Location: Hong Kong
Re: Endless loops in YaBB?
Reply #9 - Dec 26th, 2010 at 12:41pm
Post Tools
Applied on my Dev Forum. Patch will be in next Beta Package and in SVN.
  

PM me for YaBB Installation Service
Back to top
WWWGTalkFacebook  
IP Logged
 
Captain John
Ex Member


Re: Endless loops in YaBB?
Reply #8 - Nov 21st, 2010 at 6:06pm
Post Tools
Change made .......
  
Back to top
 
IP Logged
 
deti
Legacy Dev Team
Development Team
****
Offline



Posts: 2,650
Location: Prien am Chiemsee, Germany
Re: Endless loops in YaBB?
Reply #7 - Nov 19th, 2010 at 9:55pm
Post Tools
My first fix wasn't enough Embarrassed

The problem happened again on that other forum in some special cases. Now here my new fix.
Replace the existing code between the highlighted with this in Admin/Maintenance.pl:
Code (Perl)
Select All
	# remove from movedthreads.cgi only if it's the final thread
	# then look backwards to delete the other entries in
	# the Moved-Info-row if their files were deleted
	eval { require "$datadir/movedthreads.cgi" };
	my $save_moved;
	foreach my $th (sort { $a <=> $b } keys %moved_file) {
		if ($moved_file{$th}) {
			my %loop_control;
			while ($moved_file{$th}) { # to get the final/last thread
				$loop_control{$th} = 1;
				# break through loops
				if ($loop_control{ $moved_file{$th} }) {
					delete $moved_file{$th};
					$save_moved = 1;
				} else {
					$th = $moved_file{$th};
				}
			}
			unless (-e "$datadir/$th.txt") { &moved_loop($th); }
		}
	}
	sub moved_loop {
		my $th = shift;
		foreach (keys %moved_file) {
			if ($moved_file{$_} && $moved_file{$_} == $th && !-e "$datadir/$th.txt") {
				delete $moved_file{$_};
				$save_moved = 1;
				&moved_loop($_);
			}
		}
	}
	&save_moved_file if $save_moved; 

  

Was immer Du tun kannst
oder erträumst tun zu können,
beginne es.
Kühnheit besitzt Genie,
Macht und magische Kraft.
Beginne es jetzt.
Whatever you can do
or dream you can,
begin it.
Boldness has genius,
power and magic in it.
Begin it now.
J. W. Goethe
Back to top
WWW  
IP Logged
 
Captain John
Ex Member


Re: Endless loops in YaBB?
Reply #6 - Nov 12th, 2010 at 12:19am
Post Tools
lol Sure glad of That !  Wink
  
Back to top
 
IP Logged
 
deti
Legacy Dev Team
Development Team
****
Offline



Posts: 2,650
Location: Prien am Chiemsee, Germany
Re: Endless loops in YaBB?
Reply #5 - Nov 11th, 2010 at 4:37pm
Post Tools
Looks like it works. At least the server doesn't hang up when doing what I wrote in first post.
  

Was immer Du tun kannst
oder erträumst tun zu können,
beginne es.
Kühnheit besitzt Genie,
Macht und magische Kraft.
Beginne es jetzt.
Whatever you can do
or dream you can,
begin it.
Boldness has genius,
power and magic in it.
Begin it now.
J. W. Goethe
Back to top
WWW  
IP Logged
 
Captain John
Ex Member


Re: Endless loops in YaBB?
Reply #4 - Nov 11th, 2010 at 4:05pm
Post Tools
As of now ... Yes edited.
  
Back to top
 
IP Logged
 
deti
Legacy Dev Team
Development Team
****
Offline



Posts: 2,650
Location: Prien am Chiemsee, Germany
Re: Endless loops in YaBB?
Reply #3 - Nov 11th, 2010 at 3:41pm
Post Tools
Have you applied my fix on your server Captain?
  

Was immer Du tun kannst
oder erträumst tun zu können,
beginne es.
Kühnheit besitzt Genie,
Macht und magische Kraft.
Beginne es jetzt.
Whatever you can do
or dream you can,
begin it.
Boldness has genius,
power and magic in it.
Begin it now.
J. W. Goethe
Back to top
WWW  
IP Logged
 
Captain John
Ex Member


Re: Endless loops in YaBB?
Reply #2 - Nov 11th, 2010 at 1:57am
Post Tools
deti wrote on Nov 10th, 2010 at 5:49pm:
If so, your server probably will go down and you will need to kill (from shell) the process consuming all your server-power, or you reboot your server.


WOW ... what a consequence !  Nasty!  Sorry .. I share a Host server.
  
Back to top
 
IP Logged
 
deti
Legacy Dev Team
Development Team
****
Offline



Posts: 2,650
Location: Prien am Chiemsee, Germany
Re: Endless loops in YaBB?
Reply #1 - Nov 10th, 2010 at 8:30pm
Post Tools
A short fix can be done by replacing the existing code between the highlighted with this in
Admin/Maintenance.pl
Code (Perl)
Select All
	# remove from movedthreads.cgi only if it's the final thread
	# then look backwards to delete the other entries in
	# the Moved-Info-row if their files were deleted
	eval { require "$datadir/movedthreads.cgi" };
	my $save_moved;
	foreach my $th (sort { $a <=> $b } keys %moved_file) {
		if ($moved_file{$th}) {
			my $th_1 = $th;
			FINAL:
			while ($moved_file{$th}) { # to get the final/last thread
				# break through loops
				if ($moved_file{ $moved_file{$th} } == $th_1) {
					delete $moved_file{$th_1};
					$save_moved = 1;
					last FINAL;
				}
				$th = $moved_file{$th};
			}
			unless (-e "$datadir/$th.txt") { &moved_loop($th); }
		}
	}
	sub moved_loop {
		my $th = shift;
		foreach (keys %moved_file) {
			if ($moved_file{$_} && $moved_file{$_} == $th && !-e "$datadir/$th.txt") {
				delete $moved_file{$_};
				$save_moved = 1;
				&moved_loop($_);
			}
		}
	}
	&save_moved_file if $save_moved; 



At least you will be able to fix the problem after running RebuildMessageIndex.
  

Was immer Du tun kannst
oder erträumst tun zu können,
beginne es.
Kühnheit besitzt Genie,
Macht und magische Kraft.
Beginne es jetzt.
Whatever you can do
or dream you can,
begin it.
Boldness has genius,
power and magic in it.
Begin it now.
J. W. Goethe
Back to top
WWW  
IP Logged
 
deti
Legacy Dev Team
Development Team
****
Offline



Posts: 2,650
Location: Prien am Chiemsee, Germany
Endless loops in YaBB?
Nov 10th, 2010 at 5:49pm
Post Tools
Hi,

can someone test something for me (I have no test forum at the moment)?

- You move a thread to other board
- You do not delete the "Moved to" message in the first board
- You move the moved thread back into the thread you started from (I guess only admins can do that). I don't know who is so stupid to do this but someone must have done it.
- You do not delete the "Moved to" message in the second board
- You run RebuildMessageIndex.

I suppose it will never finish; and I also suppose that if you call the thread it will never finish too and it might be so with Favorites too!
If so, your server probably will go down and you will need to kill (from shell) the process consuming all your server-power, or you reboot your server. So please test this only if you have full control over your server!!!

  

Was immer Du tun kannst
oder erträumst tun zu können,
beginne es.
Kühnheit besitzt Genie,
Macht und magische Kraft.
Beginne es jetzt.
Whatever you can do
or dream you can,
begin it.
Boldness has genius,
power and magic in it.
Begin it now.
J. W. Goethe
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Topic Tools
 
  « Board Index ‹ Board  ^Top