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 | + |
2 | 10 | slayerd (1.3) unstable; urgency=low |
3 | 11 | |
4 | 12 | * 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 @@ |
607 | 607 | |
608 | 608 | for (std::size_t i = 0, end = users.size(); i < end; ++i) { |
609 | 609 | user &u = users[i]; |
610 | | - std::size_t bytes = u.rss * pagesize; |
| 610 | + std::size_t bytes = std::size_t(u.rss) * pagesize; |
611 | 611 | |
612 | 612 | if (config.exempt.find(u.uid) != config.exempt.end()) |
613 | 613 | continue; |
— | — | @@ -635,15 +635,17 @@ |
636 | 636 | if (!config.debug) |
637 | 637 | kill(p._pid, SIGKILL); |
638 | 638 | |
| 639 | + std::size_t thissize = std::size_t(p._mdata) * pagesize; |
| 640 | + |
639 | 641 | log(str(boost::format(" killed process \"%s\" (pid %d) using %dM, usage now %dM") |
640 | 642 | % 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))); |
643 | 645 | |
644 | 646 | 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)); |
646 | 648 | |
647 | | - bytes -= p._mdata * pagesize; |
| 649 | + bytes -= thissize; |
648 | 650 | u.processes.erase(u.processes.begin()); |
649 | 651 | } |
650 | 652 | |