Bug #38323 inappropriate time zone used to parse user-entered date(+time) strings.
Submitted: 23 Jul 2008 21:57 Modified: 8 Aug 2008 15:40
Reporter: Josh Sled Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Enterprise Monitor: Web Severity:S3 (Non-critical)
Version:1.2, 1.3, 2.0 OS:Any
Assigned to: Sloan Childers CPU Architecture:Any

[23 Jul 2008 21:57] Josh Sled
Description:
In various places in the Monitor web interface, we have From/To date fields which the user enters in their locale/timezone.  We then either parse the date strings into value using either SimpleDateformat.parse() in the server's timezone (com.mysql.merlin.ui.actions.monitor.Graph) or explictly as UTC (callers of DateUtil.toDate(), see below).

Callers of DateUtil.toDate:

[-] Date com.mysql.util.DateUtil.toDate(String)
 |-[+] com.mysql.util.DateUtil
 |-[+] <void> com.mysql.merlin.ui.actions.monitor.queryAnalysis.BrowseQueries.addSummaries():576
 |-[+] <void> com.mysql.merlin.ui.actions.monitor.queryAnalysis.BrowseQueries.addSummaries():578 TODO
 |-[-] Date com.mysql.util.DateUtil.toDateNotNull(String):104
 |  |-[+] com.mysql.util.DateUtil
 |  |-[+] Date com.mysql.merlin.server.collect.DCAgentDatumXMLWrapper.getUtc():51
 |  |-[+] <void> com.mysql.util.SerializedXML.setField(Serializable,Node):215
 |  |-[X] Date com.mysql.merlin.ui.actions.settings.logs.ShowLog.convertUtc(String):287
 |  `-[+] Date com.mysql.etools.monitor.bo.MockFlaggedStatement.getTime():51
 |-[+] Date com.mysql.etools.monitor.rest.HttpRequest.getTimestamp():101
 |-[+] <void> com.mysql.etools.monitor.bo.Agent.updateFromHeartbeat(AgentHeartbeatRequest):279
 |-[-] <void> com.mysql.etools.monitor.bo.quanal.StatementFilter.setFromDate(String):150
 |  |-[+] com.mysql.etools.monitor.bo.quanal.StatementFilter
 |  `-[+] String com.mysql.merlin.ui.actions.monitor.queryAnalysis.BrowseQueries.executeInner():479
 |-[-] <void> com.mysql.etools.monitor.bo.quanal.StatementFilter.setToDate(String):162
 |  |-[+] com.mysql.etools.monitor.bo.quanal.StatementFilter
 |  `-[+] String com.mysql.merlin.ui.actions.monitor.queryAnalysis.BrowseQueries.executeInner():482
 |-[-] <void> com.mysql.merlin.ui.actions.monitor.events.Events.updateAlarms():328
 |  |-[+] com.mysql.merlin.ui.actions.monitor.events.Events
 |  `-[+] String com.mysql.merlin.ui.actions.monitor.events.Events.executeInner():483
 |-[-] <void> com.mysql.merlin.ui.actions.monitor.events.Events.updateAlarms():334
 |  |-[+] com.mysql.merlin.ui.actions.monitor.events.Events
 |  `-[+] String com.mysql.merlin.ui.actions.monitor.events.Events.executeInner():483
 |-[-] String com.mysql.merlin.ui.actions.settings.logs.ShowLog.executeInner():326
 |  |-[+] com.mysql.merlin.ui.actions.BaseViewAction
 |  `-[+] String com.mysql.merlin.ui.actions.BaseViewAction.execute():16
 |-[-] String com.mysql.merlin.ui.actions.settings.logs.ShowLog.executeInner():331
 |  |-[+] com.mysql.merlin.ui.actions.BaseViewAction
 |  `-[+] String com.mysql.merlin.ui.actions.BaseViewAction.execute():16
 |-[-] String com.mysql.merlin.server.MainCommandProcessor.getLog(Map):262
 |  |-[+] com.mysql.merlin.server.MainCommandProcessor
 |  `-[+] Serializable com.mysql.merlin.server.MainCommandProcessor.processRequest(User,Map):97
 |-[-] String com.mysql.merlin.server.MainCommandProcessor.getLog(Map):263
 |  |-[+] com.mysql.merlin.server.MainCommandProcessor
 |  `-[+] Serializable com.mysql.merlin.server.MainCommandProcessor.processRequest(User,Map):97
 `-[-] Date com.mysql.etools.monitor.rest.GraphReportResource.argToDate(Matcher,int):95
    |-[+] com.mysql.etools.monitor.rest.GraphReportResource
    |-[+] <void> com.mysql.etools.monitor.rest.GraphReportResource.GraphReportResource(String,Clock,Map):85
    `-[+] <void> com.mysql.etools.monitor.rest.GraphReportResource.GraphReportResource(String,Clock,Map):88

How to repeat:
For the Graphs issue (easiest to see evidence of):

run your server and agent in EST.  Make your user setting for PST.  Go to graphs page; change to From/To, 9-10am.  Notice that the graph axis is "6-7am" on the graph, but it's really the data for 9-10am EST.

Suggested fix:
Use the user's timezone to parse the dates, traffic only in UTC timestamps/Dates internally.
[24 Jul 2008 18:03] Josh Sled
Fixed for 2.0 in (currently) 6150 rev-id jsled@asynchronous.org-20080724180141-5naz97qil6gfb21w

The following files were changed to call a new date parser that respects the users timezone:

  - src/com/mysql/merlin/ui/actions/monitor/Graph.java
  - src/com/mysql/merlin/ui/actions/monitor/events/Events.java
  - src/com/mysql/merlin/ui/actions/monitor/queryAnalysis/BrowseQueries.java
  - src/com/mysql/merlin/ui/actions/settings/logs/ShowLog.java
[25 Jul 2008 19:20] Bill Weber
re-opening and re-assigning for 1.3
[29 Jul 2008 20:08] Sloan Childers
r9182 ga-1.3.3
[7 Aug 2008 15:07] Marcos Palacios
Verified fixed in ver. 1.3.3.9184.
Tested on graphs, logs, and events pages.
[8 Aug 2008 15:40] Tony Bedford
An entry was added to the 1.3.3 and 2.0 changelogs:

An inappropriate time zone was used to parse user-entered date and time strings.