Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Last modified field in collection is incorrect #2983

Open
vinod-mortgagekart opened this issue Apr 18, 2022 · 7 comments
Open

Last modified field in collection is incorrect #2983

vinod-mortgagekart opened this issue Apr 18, 2022 · 7 comments
Labels
stale For marking issues as stale. Labeled issues will be closed soon if label is not removed.

Comments

@vinod-mortgagekart
Copy link

I am using Kinto on local server by installing on system. Kinto stores a 'last modified' data field whenever we insert a document in 'Kinto' collection. I found an issue with 'last modified' field whenever I inserted the data. The 'last modified' is an unix timestamp. I tried converting the unix timestamp to the Date format, and that doesn't matches with the time when the document was inserted. What's more fascinating is -
When I insert 2 documents consecutively, the 'last modified' timestamp when converted from unix to date format, varies hugely. Example -
new Date(1649841497793);
Wed Apr 13 2022 14:48:17 GMT+0530 (India Standard Time)
new Date(1649861297794);
Wed Apr 13 2022 20:18:17 GMT+0530 (India Standard Time)

@dstaley
Copy link
Member

dstaley commented Apr 19, 2022

Hi @vinod-mortgagekart, thank you for letting us know about this issue. I have a few questions:

  1. What operating system are you running Kinto server on?
  2. What database are you using Kinto with (memory or Postgres)? If Postgres, what operating system is the database running on?
  3. Can you provide your kinto.ini config for your server? Please redact any sensitive details.
  4. Can you provide the client code you're using to create these records?

@vinod-mortgagekart
Copy link
Author

vinod-mortgagekart commented Apr 20, 2022

Hi @dstaley , thanks for the response.

  1. I am running Kinto on Ubuntu system
  2. Postgres Database, the database is also running on ubuntu
  3. kinto.txt
  4. I am actually not sure, what do you mean by client code?

@dstaley
Copy link
Member

dstaley commented Apr 20, 2022

By client code I mean the code you used to insert consecutive records.

@vinod-mortgagekart
Copy link
Author

Oh, got it. So I am using python. I use the kinto_http library for interacting with Kinto. To insert consecutive records, I used a loop inside which 'create_record' method was used. Example - client.create_record(id = None,data = data,bucket = "default",collection = "test_data")
But, I don't think it's language dependent, as we are getting the same error using node.js

@dstaley
Copy link
Member

dstaley commented Apr 20, 2022

Oh, it's nice you've confirmed this happens with multiple clients! Can you also confirm that the Postgres database is configured to use UTC time zone? Also can you try your code again and share the timestamps you get? The two you shared are exactly 5.5 hours + 1 ms apart, so I'm curious if that's always the case. It would make sense that your Postgres DB is using India Standard Time since that's exactly 5.5 hours offset from UTC.

@vinod-mortgagekart
Copy link
Author

Yes, the postgres database is configured for UTC timezone using the query - 'SET TIME ZONE 'UTC' . I tried inserting the 4 documents consecutively, and all of them are 5.5 hrs apart.
1st - 1650557896877 - (Thursday, 21 April 2022 16:18:16.877) GMT
2nd - 1650577696878 - (Thursday, 21 April 2022 21:48:16.878) GMT
3rd - 1650597496879 - (Friday, 22 April 2022 03:18:16.879) GMT
4th - 1650617296880 - (Friday, 22 April 2022 08:48:16.880) GMT
'

@dstaley
Copy link
Member

dstaley commented Apr 21, 2022

The fact that each record is exactly 5.5 hours + 1 ms apart leads me to believe there's something wrong with either your Postgres configuration or your server configuration. When you run Kinto you should see output that starts with INFO [kinto.core] Running kinto 14.6.1. Can you check to see if that log has any mention of timezone issues? We recommend using ALTER DATABASE to set the timezone, so if you haven't done that give that a try.

Also, can you run SELECT last_modified FROM objects; to confirm that the timestamp in Postgres is matching the values being returned by the Kinto API?

@alexcottner alexcottner added the stale For marking issues as stale. Labeled issues will be closed soon if label is not removed. label Jul 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale For marking issues as stale. Labeled issues will be closed soon if label is not removed.
Projects
None yet
Development

No branches or pull requests

3 participants