Mantis Bugtracker
  

Viewing Issue Advanced Details Jump to Notes ] View Simple ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0003706 [Resin] trivial always 10-08-09 13:39 01-20-11 17:28
Reporter stbu View Status public  
Assigned To ferg
Priority normal Resolution fixed Platform
Status closed   OS
Projection none   OS Version
ETA none Fixed in Version 4.0.15 Product Version 3.1.9
  Product Build
Summary 0003706: Resin Administration (php) shows increasing uptime for already stopped web-apps
Description The PHP Resin Administration (/resin-admin) shows the uptime for all Web-Apps in tab 'Summary' and 'WebApp', but the uptime is continuously increasing even if the web-app has been stopped after it was once in state 'active'.

For the uptime calculation, the PHP code is using '$webapp->StartTime' which returns the time of the ***last start** accordingly to the JavaDoc comment of DeployControllerMXBean.java independent from current lifecycle state.

  @Description("The current time of the last start")
  public Date getStartTime();


Therefore the uptime calculation is not correct in my opinion.

I have changed the following two .php files in Resin 3.1/php/admin code and afterwards the uptime is only displayed for active web-apps.
Steps To Reproduce
Additional Information $ svn diff php/admin/webapp.php
Index: php/admin/webapp.php
===================================================================
--- php/admin/webapp.php (revision 5604)
+++ php/admin/webapp.php (working copy)
@@ -92,7 +92,12 @@
 function display_webapp($mbean_server, $webapp)
 {
   $session = $webapp->SessionManager;
-
+ $activeStartTime = $webapp->StartTime;
+ if ($webapp->State != 'active')
+ {
+ $activeStartTime = null;
+ }
+
   echo <<<END
 <h2>WebApp</h2>

@@ -121,8 +126,8 @@
 echo " </td>\n";
 echo " <td>" . $webapp->RequestCount . "</td>\n";
 echo " <td>" . $session->SessionActiveCount . "</td>\n";
-echo " <td class='" . format_ago_class($webapp->StartTime) . "'>\n";
-echo " " . format_ago($webapp->StartTime) . "\n";
+echo " <td class='" . format_ago_class($activeStartTime) . "'>\n";
+echo " " . format_ago($activeStartTime) . "\n";
 echo " </td>\n";

         format_ago_td_pair($webapp->Status500CountTotal,
@@ -207,6 +212,12 @@
 foreach ($webapps as $webapp) {

   $session = $webapp->SessionManager;
+ $activeStartTime = $webapp->StartTime;
+ if ($webapp->State != 'active')
+ {
+ $activeStartTime = null;
+ }
+
 ?>

   <tr class='<?= row_style($count++) ?>'>
@@ -216,15 +227,15 @@
 $object_name = $webapp->mbean_name;

 echo "<a href='webapp.php?id=" . $object_name . "'>" . $context_path . "</a>";
-?>
+?>
     </td>
     <td class='<?= format_state_class($webapp->State) ?>'>
        <?= $webapp->State ?>
     </td>
     <td><?= $webapp->RequestCount ?></td>
     <td><?= $session->SessionActiveCount ?></td>
- <td class='<?= format_ago_class($webapp->StartTime) ?>'>
- <?= format_ago($webapp->StartTime) ?>
+ <td class='<?= format_ago_class($activeStartTime)?>'>
+ <?= format_ago($activeStartTime) ?>
     </td>
     <?php
         format_ago_td_pair($webapp->Status500CountTotal,




$ svn diff php/admin/status.php
Index: php/admin/status.php
===================================================================
--- php/admin/status.php (revision 5604)
+++ php/admin/status.php (working copy)
@@ -500,6 +500,11 @@
 $count = 0;
 foreach ($webapps as $webapp) {
   $session = $webapp->SessionManager;
+ $activeStartTime = $webapp->StartTime;
+ if ($webapp->State != 'active')
+ {
+ $activeStartTime = null;
+ }
 ?>

   <tr class='<?= row_style($count++) ?>'>
@@ -511,8 +516,8 @@
     </td>
     <td><?= $webapp->RequestCount ?></td>
     <td><?= $session->SessionActiveCount ?></td>
- <td class='<?= format_ago_class($webapp->StartTime) ?>'>
- <?= format_ago($webapp->StartTime) ?>
+ <td class='<?= format_ago_class($activeStartTime) ?>'>
+ <?= format_ago($activeStartTime) ?>
     </td>
     <?php
         format_ago_td_pair($webapp->Status500CountTotal,
Attached Files

- Relationships

- Notes
(0004262)
ferg
10-13-09 12:13

We could also add a StateChangeTime and count the time since the last state change.
 
(0004263)
stbu
10-13-09 13:22

Scott, that's a good idea.
Today I've seen that the status of one of my web-apps is changed to 'active-modified' until a new request has changed it again. The StateChangeTime sounds to fulfil a lot of interests.
 

- Issue History
Date Modified Username Field Change
10-08-09 13:39 stbu New Issue
10-08-09 13:39 stbu Issue Monitored: stbu
10-13-09 12:13 ferg Note Added: 0004262
10-13-09 13:22 stbu Note Added: 0004263
01-20-11 17:28 ferg Assigned To  => ferg
01-20-11 17:28 ferg Status new => closed
01-20-11 17:28 ferg Resolution open => fixed
01-20-11 17:28 ferg Fixed in Version  => 4.0.15


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
32 total queries executed.
27 unique queries executed.
Powered by Mantis Bugtracker