[SERVER-44273] Failure to parse certain time zone specifications on windows platforms. Created: 28/Oct/19  Updated: 29/Oct/23  Resolved: 15/Jun/20

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: 3.6.15, 4.0.13, 4.2.1
Fix Version/s: 4.4.0-rc10, 4.2.9, 4.7.0

Type: Bug Priority: Major - P3
Reporter: Roberth Godoy Assignee: James Wahlin
Resolution: Fixed Votes: 1
Labels: qopt-team
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File timezone.PNG    
Issue Links:
Backports
Depends
is depended on by SERVER-48196 Upgrade the timelib to the latest to ... Closed
Related
related to SERVER-44568 Update the embedded version of the se... Closed
Backwards Compatibility: Fully Compatible
Operating System: Windows
Backport Requested:
v4.4, v4.2, v4.0, v3.6
Steps To Reproduce:

criar um registro na coleção useevents

db.getCollection('useevents').insert({
"registeredAt" : ISODate("2019-10-27T02:00:30.627Z")
})

executar um aggregate

db.getCollection('useevents').aggregate([{"$group":{"_id":{ "day":{"$dayOfMonth":{"date":"$registeredAt","timezone":"America/Sao_Paulo"}}},"count":{"$sum":1}}}])

resultado esperado

{
 "_id" : {
 "day" : 26
 },
 "count" : 1.0
}

resultado obtido

{
 "_id" : {
 "day" : 27
 },
 "count" : 1.0
}

se alterarmos o aggregate executando colocando o offset manualmente, o resultado esperado é alcançado

db.getCollection('useevents').aggregate([
 {"$group":{"_id":{ 
 "day":{"$dayOfMonth":{"date":"$registeredAt","timezone":"-03:00"}}},"count":{"$sum":1}}}])

Sprint: Query 2020-03-23, Query 2020-05-04, Query 2020-05-18, Query 2020-06-01, Query 2020-06-15
Participants:
Case:

 Description   

On windows platforms it looks like certain time zone specifications are not parsed properly and are just silently ignored without being loaded. At this point it looks like it would be any file which contains a CTRL-Z character, which includes at least "America/Sao_Paulo".

 



 Comments   
Comment by James Wahlin [ 30/Jul/20 ]

roberth.godoy@yahoo.com - thanks for reporting this issue. A fix for this will be available in our upcoming 4.2.9 and 4.4.0 MongoDB releases.

Comment by Githook User [ 28/Jul/20 ]

Author:

{'name': 'James Wahlin', 'email': 'james@mongodb.com', 'username': 'jameswahlin'}

Message: SERVER-44273 Fix timeZoneInfo file load on Windows

(cherry picked from commit 56ef6a8f586e58f2d23911226c7880a7b678e0af)
Branch: v4.2
https://github.com/mongodb/mongo/commit/c7bb043a38360dddfe983e7d887a768888c4f34d

Comment by Githook User [ 17/Jun/20 ]

Author:

{'name': 'James Wahlin', 'email': 'james@mongodb.com', 'username': 'jameswahlin'}

Message: SERVER-44273 Fix timeZoneInfo file load on Windows

(cherry picked from commit 56ef6a8f586e58f2d23911226c7880a7b678e0af)
Branch: v4.4
https://github.com/mongodb/mongo/commit/d71d29666e95a7dcbe145ca7e7ebaf74a1555563

Comment by Githook User [ 12/Jun/20 ]

Author:

{'name': 'James Wahlin', 'email': 'james@mongodb.com', 'username': 'jameswahlin'}

Message: SERVER-44273 Fix timeZoneInfo file load on Windows
Branch: master
https://github.com/mongodb/mongo/commit/56ef6a8f586e58f2d23911226c7880a7b678e0af

Comment by Charlie Swanson [ 15/May/20 ]

Handing this ticket off to james.wahlin to investigate. I've written a test to confirm that we can load the Sao_Paulo timezone file, but even with the fix to timelib applied it is still not being loaded properly. We need to go back and investigate more why this is still not working.

Comment by Charlie Swanson [ 30/Mar/20 ]

roberth.godoy@yahoo.com thanks for the report! I was able to reproduce this issue and it looks like the underlying problem is with the library we use to parse these files on windows platforms. I've created an issue here to track it, and I'll update this ticket accordingly. I was able to verify that with that fix in place we were able to parse and recognize "America/Sao_Paulo". I am hopeful that we can get this resolved and backported into our stable releases, but I will keep this ticket update as that process progresses.

Comment by David Storch [ 18/Dec/19 ]

Note that the embedded time zone database was upgraded to version 2019c in SERVER-44568, which will be available in versions 3.6.17, 4.0.14, and 4.2.3. Upgrading to one of these versions should be a sufficient workaround for most Windows users.

Comment by Danny Hatcher (Inactive) [ 17/Dec/19 ]

Thank you for the information. I am experiencing the same error as you on my Windows machine while my local Mac is able to handle the timezone file correctly. We will keep looking into this.

Comment by Roberth Godoy [ 07/Dec/19 ]

Yes, the file has been unzipped.

Comment by Eric Sedor [ 07/Dec/19 ]

For completeness, can you please confirm the file has been unzipped?

Comment by Roberth Godoy [ 07/Dec/19 ]

Hi Eric. The pointing does not work yet. The extra link file you sent in the "C:\mongodb\timezonedb" folder and the error still persists.

Can you reproduce these steps on a windows 10 machine?

Comment by Eric Sedor [ 06/Dec/19 ]

roberth.godoy@yahoo.com,

If you are still having issues pointing at recent copy of the timezone database on Windows, can you let us know?

Sincerely,
Eric

Comment by Eric Sedor [ 11/Nov/19 ]

roberth.godoy@yahoo.com,

We've opened SERVER-44568 to update the version of the timezone databases packaged with the server.

The MongoError: unrecognized time zone identifier: "America/Sao_Paulo" error makes it look like the argument to processManagement.timeZoneInfo isn't correctly pointed at a timezone database. Can you confirm that the extracted contents of https://downloads.mongodb.org/olson_tz_db/timezonedb-latest.zip are located at C:\mongodb\timezonedb?

Eric

Comment by Roberth Godoy [ 29/Oct/19 ]

Hi @eric.sedor , thanks for the reply.

What would be the way to update packages on windows?

edit:
created mongod.cfg

processManagement:
 timeZoneInfo: "C:\\mongodb\\timezonedb"
systemLog:
 destination: file
 path: "C:\\data\\history.log"
 logAppend: true
storage:
 dbPath: "C:\\data\\db"
net:
 bindIp: 127.0.0.1
 port: 27017

started mongo

mongod --config "C:\Program Files\MongoDB\Server\3.6\bin\mongod.cfg"

this error is returned

MongoError: unrecognized time zone identifier: "America/Sao_Paulo"

Comment by Eric Sedor [ 29/Oct/19 ]

Hi roberth.godoy@yahoo.com,

Can you please see https://docs.mongodb.com/manual/reference/configuration-options/#processManagement.timeZoneInfo for information about how to obtain the latest IANA timezone database? It has been updated since the release of 3.6.14.

Please let us know if you still have trouble after setting up the latest timezone information.

Gratefully,
Eric

Generated at Thu Feb 08 05:05:31 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.