AnimeSuki Forums

Register Forum Rules FAQ Members List Social Groups Search Today's Posts Mark Forums Read

Go Back   AnimeSuki Forum > AnimeSuki & Technology > Download Help

Notices

Reply
 
Thread Tools
Old 2004-08-20, 11:47   Link #1
HockeyMan
Junior Member
 
Join Date: Aug 2004
Location: Canada
BEncode Help

I get an error when trying to open a big torrent file with the script in example 2

The error I get is this:

Fatal error: Maximum execution time of 60 seconds exceeded in /home/vpopmail/domains/path/to/file/bencode.php on line 26


Anyway I can fix this so I can get it to display all the info for larger torrents??


Any help would be great

Thanks
HockeyMan
HockeyMan is offline   Reply With Quote
Old 2004-08-20, 14:02   Link #2
Sylf
翻訳家わなびぃ
*Fansubber
 
 
Join Date: Nov 2003
Age: 40
Send a message via MSN to Sylf Send a message via Yahoo to Sylf
Couple things:
1. Make sure the script is not eating up the execution time while transfering the torrent file from somewhere.
2. Since I don't know what's going on in the rest of your script, the easiest fix you can do is to allow the longer execution of that script. Use ini_set('max_execution_time', 600) or something.
3. Actually learn PHP, and figure out where in the script it's taking so long to run this script. In my experience, BEncode runs pretty quickly on most computers.
Sylf is offline   Reply With Quote
Old 2004-08-22, 04:05   Link #3
HockeyMan
Junior Member
 
Join Date: Aug 2004
Location: Canada
I'm have some experience with PHP and I asked someone else who is very experienced with PHP to look at it and we can not find a execution time limit any where in the script. Also the script I have is from this site if you want to look at it.
HockeyMan is offline   Reply With Quote
Old 2004-08-22, 05:55   Link #4
GHDpro
Administrator
*Administrator
 
 
Join Date: Jan 2001
Location: Netherlands
Age: 35
1) Make sure the torrent file is COMPLETE. Not corrupted in any way.

2) How large is the torrent? The script might choke on anything larger than 200 Kb if the
max execution time is 60 seconds.
GHDpro is offline   Reply With Quote
Old 2004-08-22, 06:14   Link #5
HockeyMan
Junior Member
 
Join Date: Aug 2004
Location: Canada
Torrent file is not corrupt and its about 400kb
HockeyMan is offline   Reply With Quote
Old 2004-08-22, 11:08   Link #6
HockeyMan
Junior Member
 
Join Date: Aug 2004
Location: Canada
Could it have something to do with the Tracker since there is no code stating a limit on time???
HockeyMan is offline   Reply With Quote
Old 2004-08-22, 14:47   Link #7
NightWish
…Nothing More
*Administrator
 
 
Join Date: Mar 2003
Age: 34
Exclamation

If the code isn't setting an execution timeout, PHP will be via its defaults. The actual value will be in the php.ini file.
By default this is 30, but I guess your server has the value set to 60:
max_execution_time = 60 ; Maximum execution time of each script, in seconds
If you are NOT running in SAFE mode, you can override the limit in the code, see set_time_limit.
If you ARE running in SAFE mode, you'll need to consider not doing so. There is no workaround for execution timeouts while in SAFE mode.
__________________
🐾
…to be bold, to be brave; it is the thinking that the heart can still be saved.
And the darkness can come quick. The danger's in the anger and the hanging on to it.
NightWish is offline   Reply With Quote
Old 2004-08-22, 15:30   Link #8
DeHackEd
Member
 
Join Date: Apr 2003
Not to say anything rude about GHDpro, but I also have my own BEncode lib, and when I did benchmark tests compared to this site's bencode lib, mine was faster. This was on /scrape data.

But any .torrent which takes that much time to run is probably mangled in some way.
DeHackEd is offline   Reply With Quote
Old 2004-08-22, 15:48   Link #9
NightWish
…Nothing More
*Administrator
 
 
Join Date: Mar 2003
Age: 34
I've just had a look at the two examples and I remembered a bug I've pointed out before -- although I can't find the thread where it was last discussed (maybe lost in the last forum crash). Anyway...

The problem is that fread doesn't work on network streams as it does on local files:
Quote:
Originally Posted by php help
When reading from network streams or pipes, such as those returned when reading remote files or from popen() and fsockopen(), reading will stop after a packet is available. This means that you should collect the data together in chunks as shown in the example below.
Basically this means that you're always getting corrupt data, even if you think you arn't. You need to replace the single fread with something just as simple, like this:
Spoiler for code:
__________________
🐾
…to be bold, to be brave; it is the thinking that the heart can still be saved.
And the darkness can come quick. The danger's in the anger and the hanging on to it.
NightWish is offline   Reply With Quote
Old 2004-08-22, 17:05   Link #10
GHDpro
Administrator
*Administrator
 
 
Join Date: Jan 2001
Location: Netherlands
Age: 35
Quote:
Originally Posted by DeHackEd
Not to say anything rude about GHDpro, but I also have my own BEncode lib, and when I did benchmark tests compared to this site's bencode lib, mine was faster. This was on /scrape data.

But any .torrent which takes that much time to run is probably mangled in some way.
Nah, that's alright, because it's true -- I have not put ANY effort at ALL in optimizing
the code whatsoever -- it works, so it's good enough for me.

FYI -- I had to disable scrape checking on a tracker (which was fortunately used by
only 1-2 torrents) because my script was choking on it -- the scrape file was 600 Kb
and my scripts set the execution time-out to at least 120 seconds (iirc).

So sorry... but if you want to parse torrents and/or scrape files that big, I recommend
finding a more optimized BEncode library...
GHDpro is offline   Reply With Quote
Old 2004-08-22, 23:51   Link #11
HockeyMan
Junior Member
 
Join Date: Aug 2004
Location: Canada
all I want is something that can display the total number of seeds and peers of a torrent that is hosted on a tracker that is not on my site. Since I am new to PHP all this seems way over my head, so I don't really understand what I can do to get it to display the info of larger torrents. But thanks for all the help, hopefully I can figure it out, but plz if you have any more hints or suggestions plz let me know
HockeyMan is offline   Reply With Quote
Old 2004-08-23, 03:23   Link #12
HockeyMan
Junior Member
 
Join Date: Aug 2004
Location: Canada
I finally got it to work correctly. It timed out becuase the file size of the actual torrent was too big. A friend told me to use Make Torrent 2 to create torrent files, he also told me to use use a custom setting at 128kb for the piece size. When I used the auto setting it made the torrent file 23kb instead of 400kb. Just wondering where would I put the code to increase the execution time in my script??

Last edited by HockeyMan; 2004-08-23 at 07:52.
HockeyMan is offline   Reply With Quote
Old 2004-08-23, 12:08   Link #13
Sylf
翻訳家わなびぃ
*Fansubber
 
 
Join Date: Nov 2003
Age: 40
Send a message via MSN to Sylf Send a message via Yahoo to Sylf
put ini_set() as I posted earlier at the top of your script...
Sylf is offline   Reply With Quote
Old 2004-10-19, 10:25   Link #14
AnBuKyD
Junior Member
 
Join Date: Sep 2004
Location: Jacksonville, Fl
Age: 30
Send a message via AIM to AnBuKyD
further help

Okay I figured out how to get the information using this thread, but now being a complete newb to the world of php, and website. how in the world do I get this information onto my site where I want it? I'm using a database that has the torennt location in it (mySQL) and I am using dreamweaver to make dynamic tables (repeating tables Do while statements. Now I just need to know how to autoate the info from BEncode into it.
AnBuKyD is offline   Reply With Quote
Old 2004-10-19, 21:30   Link #15
Sylf
翻訳家わなびぃ
*Fansubber
 
 
Join Date: Nov 2003
Age: 40
Send a message via MSN to Sylf Send a message via Yahoo to Sylf
For one, you want to be careful not to flood the server that's providing the scrape.

In the database, store the sha1 hash of that torrent file. You need to use that as the unique identifier to match the information obtained from the scrape. Of course, getting the scrape itself is as easy as
Code:
$scrape = file("http://my.tracker.com:6969/scrape");
Sylf is offline   Reply With Quote
Old 2004-10-19, 23:09   Link #16
AnBuKyD
Junior Member
 
Join Date: Sep 2004
Location: Jacksonville, Fl
Age: 30
Send a message via AIM to AnBuKyD
I actually realized that the example code were just that example codes and therefore I can add the code from the examples or make my own actually that will add the scrapes into my database. Thing is now will this work with a do while statement. Geez I hate being new to this stuff so many questions I need answered and reading is the best answer, but there is so much reading to do. urgh!
AnBuKyD is offline   Reply With Quote
Old 2004-10-19, 23:13   Link #17
AnBuKyD
Junior Member
 
Join Date: Sep 2004
Location: Jacksonville, Fl
Age: 30
Send a message via AIM to AnBuKyD
One other thing I notice you guys keep mentioning not to flood the server and all, but this code takes forever on just one torrent. How long does it take for animesuki to update their database? I know you use a cron and all to keep the file down to 4 hours, also how long does it run for if its set to only run four hours? Urgh so many freakin questions.
AnBuKyD is offline   Reply With Quote
Reply

Thread Tools

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 -5. The time now is 20:47.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
We use Silk.