Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Blog Module

Discuss the Blog Module.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Massive memory leak!


Go to End
Reply

9 Posts   2114 Views

Avatar
Mo

29 September 2009 at 10:19am Community Member, 509 Posts

Hi all,

I have tracked a massive memory leak down to the blog module installed on my site.

Currently I have 2 blogs, each with about 40 articles each., and a couple of widgets enabled. This is on SS version 2.3.3 and running on apache 2 on an ubuntu server (9.04).

Currently I have had to increase the PHP memory allocation to 550m to make the module work, but this makes the whole site unstable.

Running a debug_memory=1 results in showing the script uses about 530mb.

I also ran a debug_profile and this was the result:

Calls Time Routine
-----------------------------------------------------------------------------
20 6909.1868 ms (96.09 %) template(Comments)
1 80.2820 ms (1.12 %) template(CommentLink)
1 51.4619 ms (0.72 %) all_execution
2 16.5398 ms (0.23 %) template(ChildrenOf)
9 13.3250 ms (0.19 %) SSViewer::process
7 10.0341 ms (0.14 %) template(BlogEntries)
4 9.3930 ms (0.13 %) template(Page)
1 9.1622 ms (0.13 %) template(Dates)
208 8.9576 ms (0.12 %) casting cost
1 8.1940 ms (0.11 %) template(Widgets)
11 6.4194 ms (0.09 %) template(TagsCollection)
9 5.5771 ms (0.08 %) Requirements::includeInHTML
62 4.3554 ms (0.06 %) template(Date)
1 4.1640 ms (0.06 %) template(Level)
82 4.0302 ms (0.06 %) template(Link)
13 3.3603 ms (0.05 %) template(Content)
10 3.2499 ms (0.05 %) template(Author)
1 2.8329 ms (0.04 %) DB::connect
1 2.6040 ms (0.04 %) template(Silverstripenavigator)
13 2.3267 ms (0.03 %) template(Title)
1 2.0969 ms (0.03 %) template(SideBar)
1 1.9188 ms (0.03 %) template(MetaTags)
26 1.5690 ms (0.02 %) template(Format)
26 1.4520 ms (0.02 %) template(Year)
8 1.2369 ms (0.02 %) template(LinkingMode)
14 1.1995 ms (0.02 %) template(MenuTitle)
10 0.8717 ms (0.01 %) template(ParagraphSummary)
5 0.8280 ms (0.01 %) template(Tag)
20 0.8166 ms (0.01 %) template(Count)
10 0.7300 ms (0.01 %) template(Long)
10 0.5882 ms (0.01 %) template(XML)
3 0.4902 ms (0.01 %) template(WidgetHolder)
1 0.4530 ms (0.01 %) template(PaginationSummary)
1 0.4470 ms (0.01 %) main.php init
7 0.2768 ms (0.00 %) template(PageNum)
4 0.2632 ms (0.00 %) template(LevelOneLinkTop)
4 0.2582 ms (0.00 %) template(LevelOneLinkBot)
1 0.1900 ms (0.00 %) template(CommentText)
2 0.1740 ms (0.00 %) template(MetaKeywords)
4 0.1721 ms (0.00 %) template(CurrentBool)
1 0.1609 ms (0.00 %) template(RSSLink)
2 0.1590 ms (0.00 %) template(MetaDescription)
4 0.1538 ms (0.00 %) template(Pos)
1 0.1531 ms (0.00 %) template(PostLink)
1 0.0868 ms (0.00 %) template(NextLink)
1 0.0811 ms (0.00 %) template(DisplayMode)
1 0.0789 ms (0.00 %) template(ShowSecondLevel)
1 0.0739 ms (0.00 %) template(URLSegment)
2 0.0558 ms (0.00 %) template(Last)
1 0.0558 ms (0.00 %) template(MoreThanOnePage)
1 0.0479 ms (0.00 %) template(NotLastPage)
1 0.0379 ms (0.00 %) template(NotFirstPage)
1 0.0179 ms (0.00 %) unprofiled
1 0.0172 ms (0.00 %) template(Layout)

17.9756 ms (0.25 %) Missed
============================================================================
7190.6440 ms (100.00 %) OVERALL TIME
============================================================================

If anyone can shed some light on this, I would be eternally grateful!!

Mo

Avatar
Mo

29 September 2009 at 10:28am Community Member, 509 Posts

On closer inspection, it looks like the first line:

20 6909.1868 ms (96.09 %) template(Comments)

Looking closer at the site, from this, it looks like there is a shit load of comment spam. I thought commenting had been disabled, apparently not! Now I have 130000 comments sitting in the database!

Joy!!

Avatar
honeybunny

30 September 2009 at 12:36am Community Member, 79 Posts

Yikes! I thought the 4350 spam comments I had yesterday was bad, but it was a drop in the bucket compared to you. My page was only up for a couple of hours; I guess this shows just how efficient the bots are.

Avatar
Mo

30 September 2009 at 12:49am Community Member, 509 Posts

Tell me about it!!

The comment form was only on the blog, and the site was only up for a month or so. It just amazes me how quickly they found it and spammed it!

That will teach me for a lack of vigilance :s.

Avatar
banal

30 September 2009 at 7:27pm Community Member, 901 Posts

Hey Mo

Did you create a bug-ticket for that one? Seems to be pretty bad application design if thousands of comments are being loaded into memory just to display a page (where the comments aren't even shown)?

Avatar
Mo

1 October 2009 at 4:25am Community Member, 509 Posts

I think it is because it summarizes how many comments are associated with each story that is displayed. So to me it kind of makes sense.

I suppose it is worth flagging, it would be nice if spam didn't bring down a website like that :)

Avatar
banal

1 October 2009 at 9:06am Community Member, 901 Posts

It doesn't make sense to me. To count the comments that have been made per page can be done easily on the DB level. A DB query won't use that much ram for that amount of records (in DB terms, 130000 isn't too much of a deal) . If all these records are being loaded into DataObjects and merged in a DataObjectSet, just to count the number of comments, then it's clearly an application design flaw. Or maybe I didn't understand what you mean with "summarize". Even if it does display some summary, it would be foolish to not use at least a LIMIT on the DB query.

Avatar
Mo

1 October 2009 at 10:42am Community Member, 509 Posts

Actually, you have a point. I thought I might have customised the display a bit, but it is pretty much default, so I would have prefered it to be a bit more stable :s.

I will submit a bug report now! :)

Go to Top