r22780 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r22779‎ | r22780 | r22781 >
Date:22:15, 5 June 2007
Author:river
Status:old
Tags:
Comment:
slayerd (1.4) unstable; urgency=low

* Very large processes would cause integer overflow, kill too many
processes, produce confusing output:
Jun 5 15:37:14 hemlock slayerd[7005]: killed process "sift" (pid 29955) using -1636M, usage now 4107M

-- River Tarnell <river@wikimedia.org> Tue, 05 Jun 2007 22:11:51 +0000
Modified paths:
  • /trunk/tools/slayerd/debian/changelog (modified) (history)
  • /trunk/tools/slayerd/debian/files (modified) (history)
  • /trunk/tools/slayerd/debian/slayerd.substvars (modified) (history)
  • /trunk/tools/slayerd/slayerd.cc (modified) (history)

Diff [purge]

Index: trunk/tools/slayerd/debian/changelog
@@ -1,3 +1,11 @@
 2+slayerd (1.4) unstable; urgency=low
 3+
 4+ * Very large processes would cause integer overflow, kill too many
 5+ processes, produce confusing output:
 6+ Jun 5 15:37:14 hemlock slayerd[7005]: killed process "sift" (pid 29955) using -1636M, usage now 4107M
 7+
 8+ -- River Tarnell <river@wikimedia.org> Tue, 05 Jun 2007 22:11:51 +0000
 9+
210 slayerd (1.3) unstable; urgency=low
311
412 * Use data instead of rss to calculate process's memory use.
Index: trunk/tools/slayerd/debian/slayerd.substvars
@@ -1 +1 @@
2 -shlibs:Depends=libboost-filesystem1.33.1, libc6 (>= 2.3.5-1), libgcc1 (>= 1:4.1.1-12), libstdc++6 (>= 4.1.1-12)
 2+shlibs:Depends=libboost-filesystem1.33.1, libc6 (>= 2.5-5), libgcc1 (>= 1:4.1.1-12), libstdc++6 (>= 4.1.1-12)
Index: trunk/tools/slayerd/debian/files
@@ -1 +1 @@
2 -slayerd_1.3_amd64.deb admin extra
 2+slayerd_1.4_amd64.deb admin extra
Index: trunk/tools/slayerd/slayerd.cc
@@ -606,7 +606,7 @@
607607
608608 for (std::size_t i = 0, end = users.size(); i < end; ++i) {
609609 user &u = users[i];
610 - std::size_t bytes = u.rss * pagesize;
 610+ std::size_t bytes = std::size_t(u.rss) * pagesize;
611611
612612 if (config.exempt.find(u.uid) != config.exempt.end())
613613 continue;
@@ -635,15 +635,17 @@
636636 if (!config.debug)
637637 kill(p._pid, SIGKILL);
638638
 639+ std::size_t thissize = std::size_t(p._mdata) * pagesize;
 640+
639641 log(str(boost::format(" killed process \"%s\" (pid %d) using %dM, usage now %dM")
640642 % comm % p._pid
641 - % (p._mdata * pagesize / 1024 / 1024)
642 - % ((bytes - p._mdata * pagesize) / 1024 / 1024)));
 643+ % (thissize / 1024 / 1024)
 644+ % ((bytes - thissize) / 1024 / 1024)));
643645
644646 process_list += str(boost::format(" %s (pid %d), using %d megabyte(s)\n")
645 - % comm % p._pid % (p._mdata * pagesize / 1024 / 1024));
 647+ % comm % p._pid % (thissize / 1024 / 1024));
646648
647 - bytes -= p._mdata * pagesize;
 649+ bytes -= thissize;
648650 u.processes.erase(u.processes.begin());
649651 }
650652

Status & tagging log