[wp-hackers] Trackbacks staying in post.to_ping
max at awakers.com
Wed Sep 3 14:41:35 GMT 2008
@fflush($fs); worked as a good replacement for fread() and it's smarter
Now that's part 2 of the problem being fixed but that part one is that
the scheduler does not seem to run correctly. When do_all_ping() ran
manually, it moved to_ping to pinged even if the socket closed before
the buffer flushed. Now that the socket issue is fixed, I'm not sure
what to do about the scheduler. I thought about running a crontab on my
2 line script to ping trackbacks every 5 mins but I'd like to minimize
the modifications on the core files. Any ideas on how I can debug the
scheduler? I did not reverse its code yet but I'm guessing, that since
it's not using crontab, it must be answering to a trigger (like page
views). I'll reverse the code tomorrow to understand it better but in
the meantime, if any of you have any ideas, by all mean let me know. by
the way, this is a fresh install of WP2.6 without any modifications what
> I've seen this issue in other circumstances as well. If you do an
> fsockopen, an fputs, and then an fclose, sometimes the fclose doesn't
> flush the thing and your request never gets sent. Adding an fread or
> better yet an fflush forces it to actually send the data and work.
> In the trackback() function, find this code:
> $fs = @fsockopen($trackback_url['host'], $trackback_url['port'],
> $errno, $errstr, 4);
> @fputs($fs, $http_request);
> Between the fputs and the fclose, add this line:
> I'll bet it'll work properly then.
> In 2.7, the trackback and ping functions need to be modified to use
> the new http class instead of manually using sockets and such. I'll
> bring it up on trac somewhere.
> On Wed, Sep 3, 2008 at 2:24 AM, Max Deputter <max at awakers.com> wrote:
>> Dear WordPress hackers, I have the weirdest problem. My trackbacks stay in
>> the to_ping column. But if I hack in a bit, I can launch them. The move to
>> the pinged column but did not really ping. When I modify the code a bit, it
>> works. But they still stay in to_ping for new posts. Here's my path so far.
>> Everytime I submit a post with a trackback, it stays in to_post. I looked in
>> the code and it seems there's some kind of scheduled
>> wp_schedule_single_event that triggers a general ping fest when there's a
>> blog post. My earliest to_ping dates from 2008-08-11 08:30:42...
>> I made a test.php file with the following content:
>> Then I modified wp-include/comment.php to add some debug info that will show
>> up on the shell as I run my test.php script:
>> print "I opened to " . $trackback_url['host'] . " with port " .
>> $trackback_url['port'] . "\n";
>> if(!$fs) print "FS Did not succeed\n";
>> fputs($fs, $http_request);
>> print "I put: $http_request\n";
>> Now I can see what is being outputted and I give it a shot with telnetting
>> directly to a test blog I created on wordpress.com (awakers.wordpress.com)
>> and surprise, it works with telnet but it did not work with the php code. I
>> also notice that I got <error>0</error> so deduct that I should see the
>> error message if I get wordpress' answer via code. I add the following two
>> lines to comment.php
>> $res = fread($fs,8192);
>> print "Response:\n$res**************\n";
>> I am eagerly waiting to see finally what is holding my blog fury back.
>> HTTP/1.1 200 OK
>> Server: nginx
>> Date: Wed, 03 Sep 2008 06:50:13 GMT
>> Content-Type: text/xml; charset=UTF-8
>> Connection: close
>> X-hacker: If you're reading this, you should visit automattic.com/jobs and
>> apply to join the fun, mention this header.
>> X-Pingback: http://awakers.wordpress.com/xmlrpc.php
>> Content-Length: 78
>> <?xml version="1.0" encoding="utf-8"?>
>> What?!? I check on the blog and believe it or not, the trackback request is
>> there. I make another trackback, remove the fread code and it doesn't work.
>> At this point, I assume that closing the socket without reading some of it
>> kills the trackback.
>> So that's where I stand now. The do_all_pings scheduled does not run and
>> when I run things manually, it needs to read from the socket after it puts
>> to it.
>> Here's some info about my setup that might or might not be relevant:
>> Running CPanel on Centos5.2 under a VMware ESXi server
>> The ip of the machine is 10.0.0.5 and I'm natting traffic in and out on
>> required ports 80,443 etc
>> The router is OpenBSD's PF.
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
More information about the wp-hackers