Categories disappearing from posts

Found a bug? Tell us!!
Post Reply
greenwayg
Regular
Posts: 34
Joined: Wed Jan 02, 2008 8:25 pm

Categories disappearing from posts

Post by greenwayg »

I noticed recently that all of my posts seem to be losing their categories. Here's the situation:

1) Create a new post. Write the text. Assign it a category. Set it to "publish" and save.
2) Check it on my blog's frontpage. Category is correctly displayed.
3) Come back later. Post is there with no category.

This seems to happen whether I assign 1 category or more categories. After the category disappears from the post, if I go back and re-add it, it will stay permanently.

Yesterday I setup a cron job right after publishing a new post to figure out how long it takes to disappear (wget the entry every 5 minutes, grep through later to figure out when it disappeared). Yesterday, I published at 9:40, and the post lost its category between 15:15 and 15:20.

This *may* have started when I moved to a different timezone from my server and changed "Server time offset" from zero to -2 in my blog configuration. But that also may be a red herring.

Any ideas what could cause this, or further debugging steps to narrow down what is going wrong?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Categories disappearing from posts

Post by garvinhicking »

Hi!

That sounds odd. Which event plugins are you running? I can only imagine that specific plugins fetch entries, modify them and repost them, but do not properly set the categories metadata.

You might want to setup a cronjob dumping the serendipity_entrycat table for the entry ID you are trying, and see if that at some time really simply vanishes. Then you can save the timestamp, and also log HTTP requests and see if the removal happens at a time where also a HTTP request happened...

Also depending on your list of event plugins you might want to temporarily disable those. Hot candidates that come to my mind are: Autosave entries, freetag, twitter, multilingual, aggregator, popfetcher, imageselectorplus, xmlrpc, versioning, metadesc, flattr, trackback

(Most of them have code calls to "serendipity_updertEntry" that updates an entry)
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
greenwayg
Regular
Posts: 34
Joined: Wed Jan 02, 2008 8:25 pm

Re: Categories disappearing from posts

Post by greenwayg »

In the 5-minute window, the only request (according to the apache access log) was for the atom feed. There had been several requests for the atom feed between when I published the entry and when the category disappeared, so that doesn't seem to be the cause.

My active event plugins are:
markup emoticate
browser compat
picasa
spartacus
spam protector
statistics
highlight search queries
rules for publishing
searches comments on quicksearch
google analytics
versioning of entries
links to next/previous entry
dashboard
lightbox
markup nl2br
trackback-control
frontend entry filtering

I'm assuming that disabled plugins don't matter? I have a few of those.

I'll try the cron job on the entrycat table next time I publish an entry.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Categories disappearing from posts

Post by garvinhicking »

Hi!

Disabled plugins are not loaded, so those wouldn't matter.

Those plugins here are fully unproblematic:
markup emoticate
spartacus
spam protector
highlight search queries
searches comments on quicksearch
links to next/previous entry
lightbox
markup nl2br

You could remove the browser compat plugin, since nowadays it doesn't really serve a purpose anymore, it's only added weight.

Plugins that might be worth toggling off, just to see if they influence the situation:
picasa
statistics
rules for publishing
google analytics
versioning of entries
dashboard
trackback-control
frontend entry filtering


I actually think the most likable plugins to interfer here are versioning and trackback-control. Especially trackback-control has an option to send timeshifted trackbacks and those modify the entry. This would correspond with your timezone-change, so it seems highly likely...

If we can pinpoint it to a certain plugin, I'm sure we can debug and fix the situation.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
greenwayg
Regular
Posts: 34
Joined: Wed Jan 02, 2008 8:25 pm

Re: Categories disappearing from posts

Post by greenwayg »

From the looks of things, it is very likely the track-back control plugin. It had the "delayed trackbacks" option enabled. Interestingly, I only use the plugin for the "disable the global use of trackbacks" option, so I figured the other options didn't matter.

From looking at the plugin's code, it only checks for whether to handle the delayed trackbacks every 1 in 10 pageviews, which explains why it didn't happen exactly two hours after I published. It also does the delayed trackback code whether or not there are any trackbacks present, and whether or not "disable the global use of trackbacks" is enabled. I disabled "delayed trackbacks" and I'll test again and post the results. Thanks for your help narrowing this down!

Also, I noticed that after changing the timezone offset setting, whenever I publish an entry, the entries editing page shows the icon indicating it is a future post, but the blog frontpage (correctly) publishes the entry. The entry editing page gets "fixed" two hours later. The timestamp of the entry is usually "now". So it seems that not all code is correctly taking the timezone offset into account. I wouldn't care (since it only affects the entry editing page, nothing user-visible) except that this is what triggered the delayed trackbacks: the plugin incorrectly saw the entry as in the future, even though it is not.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Categories disappearing from posts

Post by garvinhicking »

Hi!

Good detective work. So I believe there are two things to fix, one being the delayed trackback not resetting categories anymore, and two the backend not properly recognizing the timezone offset.

I'll see what can be fixed about this.

Thanks,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
NightFlyer
Regular
Posts: 19
Joined: Wed Feb 10, 2010 1:41 pm

Re: Categories disappearing from posts

Post by NightFlyer »

May be a little addition:
I've discovered recently that the set category is vanishing if the post is set to be released in the futur.

- Create a post and set category
- Set the publishing date five minutes or so into the future
- Wait till the posting appears and check the category

BR
NF
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Categories disappearing from posts

Post by garvinhicking »

Hi NIghtflyer!

Yes, this is the same issue. Thanks for the feedback. I'll get this patched before 1.6 will be released.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply