Bravo List
Register
Go Back   > Bravo List > Source Code > Archived Trackers > TBDev
Reply
Thread Tools
  #1  
Old 18th February 2023, 23:56
actionman actionman is offline
Member
 
Join Date: Sep 2008
Posts: 4
Default any idea?
for the last 2 days at about 7pm uk time for several hours it will not allow me to upload torrents to my site, i think i have narrowed it down the benc.php file but this is where im lost, my server is showing no unusual traffic problems and the upload file works normally when this problem isnt occuring, would anyone know what the problem is it will not let my uploaders upload they just get a stderr appear

this is the part that is causing problems in the take upload file but this info is from the benc.php file i assume and the fopen command

PHP Code:
 $tmpname $f["tmp_name"];
 if (!
is_uploaded_file($tmpname))
   
stderr($lang['takeupload_failed'], "test1");
if (!
filesize($tmpname))
   
stderr("","<table align='center'><tr><td align='center'style='border:0px solid white;padding:5px'> <img src='images/upload/error.png' width='60' height='60'/></td><td style='border:0px solid white; padding:5px' align='center'>Upload Failed! You Have Supplied A Empty .Torrent File Recreate It Again</td></tr></table>");

  
$dict bdec_file($tmpname$TBDEV['max_torrent_size']);
 if (!isset(
$dict))
     
stderr($lang['takeupload_failed'], $lang['takeupload_not_benc']); 
the benc.php this is where im lost as to why its only happening after 7pm uk time till about 11pm ish

PHP Code:
function benc_str($s) {
    return 
strlen($s) . ":$s";
}

function 
benc_int($i) {
    return 
"i" $i "e";
}

function 
benc_list($a) {
    
$s "l";
    foreach (
$a as $e) {
        
$s .= benc($e);
    }
    
$s .= "e";
    return 
$s;
}

function 
benc_dict($d) {
    
$s "d";
    
$keys array_keys($d);
    
sort($keys);
    foreach (
$keys as $k) {
        
$v $d[$k];
        
$s .= benc_str($k);
        
$s .= benc($v);
    }
    
$s .= "e";
    return 
$s;
}

function 
bdec_file($f$ms) {
    
$fp fopen($f"rb");
    if (!
$fp)
        return;
    
$e fread($fp$ms);
    
fclose($fp);
    return 
bdec($e);
}

function 
bdec($s) {
    if (
preg_match('/^(\d+):/'$s$m)) {
        
$l $m[1];
        
$pl strlen($l) + 1;
        
$v substr($s$pl$l);
        
$ss substr($s0$pl $l);
        if (
strlen($v) != $l)
            return;
        return array(
"type" => "string""value" => $v"strlen" => strlen($ss), "string" => $ss);
    }
    if (
preg_match('/^i(-{0,1}\d+)e/'$s$m)) {
        
$v $m[1];
        
$ss "i" $v "e";
        if (
$v === "-0")
            return;
        if (
$v[0] == "0" && strlen($v) != 1)
            return;
        return array(
"type" => "integer""value" => $v"strlen" => strlen($ss), "string" => $ss);
    }
    switch (
$s[0]) {
        case 
"l":
            return 
bdec_list($s);
        case 
"d":
            return 
bdec_dict($s);
        default:
            return;
    }
}

function 
bdec_list($s) {
    if (
$s[0] != "l")
        return;
    
$sl strlen($s);
    
$i 1;
    
$v = array();
    
$ss "l";
    for (;;) {
        if (
$i >= $sl)
            return;
        if (
$s[$i] == "e")
            break;
        
$ret bdec(substr($s$i));
        if (!isset(
$ret) || !is_array($ret))
            return;
        
$v[] = $ret;
        
$i += $ret["strlen"];
        
$ss .= $ret["string"];
    }
    
$ss .= "e";
    return array(
"type" => "list""value" => $v"strlen" => strlen($ss), "string" => $ss);
}

function 
bdec_dict($s) {
    if (
$s[0] != "d")
        return;
    
$sl strlen($s);
    
$i 1;
    
$v = array();
    
$ss "d";
    for (;;) {
        if (
$i >= $sl)
            return;
        if (
$s[$i] == "e")
            break;
        
$ret bdec(substr($s$i));
        if (!isset(
$ret) || !is_array($ret) || $ret["type"] != "string")
            return;
        
$k $ret["value"];
        
$i += $ret["strlen"];
        
$ss .= $ret["string"];
        if (
$i >= $sl)
            return;
        
$ret bdec(substr($s$i));
        if (!isset(
$ret) || !is_array($ret))
            return;
        
$v[$k] = $ret;
        
$i += $ret["strlen"];
        
$ss .= $ret["string"];
    }
    
$ss .= "e";
    return array(
"type" => "dictionary""value" => $v"strlen" => strlen($ss), "string" => $ss);
}

?> 

Last edited by actionman; 19th February 2023 at 00:31. Reason: add code
Reply With Quote
  #2  
Old 19th February 2023, 02:39
DND DND is offline
VIP
 
Join Date: Dec 2008
Posts: 1,242
Default
the time is irrelevant
what's the error you getting?
either in error log, announce log, access log
__________________
Need HELP!? I can install:

  1. Server/VPS (Debian,CentOS,Ubuntu,Fedora, FreeBSD) Optimization and ... + Modules
  2. Webserver Windows/Linux (Apache/Lighttpd/Nginx/Mysql/PhpMyAdmin/SSL) Optimization and ... + Modules
  3. Seedbox Windows/Linux (uTorrent,rTorrent,libTorrent,ruTorrent) + Modules
  4. Multiple source code engines
  5. Linux Server Administration (security, cryptography/encryption, proxy, load balancer, custom ddos firewall)
Reply With Quote
  #3  
Old 19th February 2023, 21:01
actionman actionman is offline
Member
 
Join Date: Sep 2008
Posts: 4
Default
where would i find these logs,im not very good with ssh so wouldnt even have a scooby how to find these logs.


it is bizarre though as it goes crazy at 7pm but at 11pm the uploading is back to normal, we never had this issue before.


i can access my servers root directory on ssh but wouldnt have a clue how to direct myself to the logs.

the takeupload seems to stop at this point

if (!is_uploaded_file($tmpname))
stderr($lang['takeupload_failed'], "test1");

if i remove that it then errors on the next if command and so on.

Bump: located the error log in my ftp client but is the same error all the time



[Fri Feb 17 21:58:43 2023] [warn] Cannot get media type from 'x-mapp-php5'


the log file just shows loads of get announce things


46.232.210.170 - - [17/Feb/2023:21:58:43 +0100] "GET /announce.php?passkey=21c9103297e8941868036faf82fbe 6ea&info_hash=%FE%FD%CB%95%5CA%D0%80%84qW%1Fk%0Dj% 1Ee%C8%83%3A&peer_id=-lt0D60-%C1%26%2B%0E%83%19%87%8C%9F%8F%99o&key=61821bfe&co mpact=1&port=62166&uploaded=548019713&downloaded=1 530699265&left=0 HTTP/1.1" 200 314 "-" "rtorrent/0.9.6/0.13.6"


cannot see anything wrong though maybe you can.
Reply With Quote
  #4  
Old 19th February 2023, 22:08
DND DND is offline
VIP
 
Join Date: Dec 2008
Posts: 1,242
Default
what you are showing here doesn't have anything to do with your problem
the function of is_uploaded_file checks if the .torrent file is actual uploaded and match with what actual was uploaded
if that fails, means the file isn't uploaded for various reasons
maybe from 7pm to 11pm something is happening on your dedicated server (i hope is dedicated) that blocks this from happening
if you say this is only occurring around this interval
__________________
Need HELP!? I can install:

  1. Server/VPS (Debian,CentOS,Ubuntu,Fedora, FreeBSD) Optimization and ... + Modules
  2. Webserver Windows/Linux (Apache/Lighttpd/Nginx/Mysql/PhpMyAdmin/SSL) Optimization and ... + Modules
  3. Seedbox Windows/Linux (uTorrent,rTorrent,libTorrent,ruTorrent) + Modules
  4. Multiple source code engines
  5. Linux Server Administration (security, cryptography/encryption, proxy, load balancer, custom ddos firewall)
Reply With Quote
  #5  
Old 20th February 2023, 13:09
Freaky Freaky is offline
Member
 
Join Date: May 2021
Posts: 10
Default
In 2023 and your still getting php5 error, in may be time update code, and your second error may be because off rtorrent isn't setup correctly or it just doesn't work properly with your version off php.
Reply With Quote
  #6  
Old 20th February 2023, 16:34
Subzero's Avatar
Subzero Subzero is offline
Coder
 
Join Date: Jul 2008
P2P
Posts: 190
Default
Quote:
Originally Posted by actionman View Post
where would i find these logs,im not very good with ssh so wouldnt even have a scooby how to find these logs.


it is bizarre though as it goes crazy at 7pm but at 11pm the uploading is back to normal, we never had this issue before.


i can access my servers root directory on ssh but wouldnt have a clue how to direct myself to the logs.

the takeupload seems to stop at this point

if (!is_uploaded_file($tmpname))
stderr($lang['takeupload_failed'], "test1");

if i remove that it then errors on the next if command and so on.

Bump: located the error log in my ftp client but is the same error all the time



[Fri Feb 17 21:58:43 2023] [warn] Cannot get media type from 'x-mapp-php5'


the log file just shows loads of get announce things


46.232.210.170 - - [17/Feb/2023:21:58:43 +0100] "GET /announce.php?passkey=21c9103297e8941868036faf82fbe 6ea&info_hash=%FE%FD%CB%95%5CA%D0%80%84qW%1Fk%0Dj% 1Ee%C8%83%3A&peer_id=-lt0D60-%C1%26%2B%0E%83%19%87%8C%9F%8F%99o&key=61821bfe&co mpact=1&port=62166&uploaded=548019713&downloaded=1 530699265&left=0 HTTP/1.1" 200 314 "-" "rtorrent/0.9.6/0.13.6"


cannot see anything wrong though maybe you can.
If your site isn't yet established, I'd recommend moving to something a bit more up-to-date if you don't have the knowledge to update this code on your own.


Is the server a dedicated server? VPS? Shared hosting?


I'd recommend monitoring the server via SSH at the times you say you are having issues, although it seems odd it's only happening at a specific time.
Is everything else still working when the uploads are not?
Reply With Quote
  #7  
Old 22nd February 2023, 00:29
actionman actionman is offline
Member
 
Join Date: Sep 2008
Posts: 4
Default
Good afternoon all, sorry for the delay, yeah its dedicated - i barely understand php code so wouldnt even know about upgrading the code this is why its been stuck on php5 for all the time i have the site open. last time i trusted someone access to the code they locked me out of my own site lol.


it has been fine for the last 2 nights but again its back tonight, the server company are saying there is nothing happening at that time.


anything that requires a fopen stops working, image uploader, uploads etc. but the rest of the site is all good and working fine.


anything else you guys can think of ??
Reply With Quote
  #8  
Old 23rd February 2023, 13:49
Subzero's Avatar
Subzero Subzero is offline
Coder
 
Join Date: Jul 2008
P2P
Posts: 190
Default
Its hard to say without digging down deeper during those times.



If you have discord drop me your username in PM & ill see if I can help you debug it.
Reply With Quote
The Following User Says Thank You to Subzero For This Useful Post:
papad (26th February 2023)
  #9  
Old 26th February 2023, 19:32
actionman actionman is offline
Member
 
Join Date: Sep 2008
Posts: 4
Default
i do have discord but im not brilliant with it,


i am Uk based and work 9 till 5 mon to friday but as my problem is 7pm till 11pm its best we get together when its happening, last night it went right wierd, all my torrents on seedboxes all went red with error Tracker Failure check back later and then i got server load too high errorfor about 10 mins or so, my server company say there is nothing wrong but something clearly is. had no problems at all till this problem started a week ago.


Thanks for the help Subzero appreciate the help

Bump: Thank you @subzero - you are an absolute star! and to others that offered help.

Bump: Thank you @subzero - you are an absolute star! and to others that offered help.

Bump: Thank you @subzero - you are an absolute star! and to others that offered help.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT +2. The time now is 08:49. vBulletin skin by ForumMonkeys. Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.