standardnotes / syncing-server

[Deprecated: Use our new Node server: https://github.com/standardnotes/syncing-server-js]
https://standardnotes.org
GNU Affero General Public License v3.0
209 stars 48 forks source link

Sync duplicating notes #101

Closed reueljohnk closed 4 years ago

reueljohnk commented 4 years ago

Hi, Everything works as expected. However when I create a note it starts duplicating randomly. i.e, 1 note becomes 2,4,6,8 and so on and doesn't stop. Here are the logs

{"method":"POST","path":"/auth/sign_in","format":"*/*","controller":"Api::AuthController","action":"sign_in","status":200,"duration":148.02,"view":0.4,"db":1.98,"ddsource":["ruby"],"time":"2020-08-31 12:51:56 +0000","params":{"password":"[FILTERED]","email":"reueljohn+notes@protonmail.com","api":"20190520","controller":"api/auth","action":"sign_in","auth":{"password":"[FILTERED]","email":"reueljohn+notes@protonmail.com","api":"20190520"}},"level":"INFO"}
{"method":"POST","path":"/items/sync","format":"*/*","controller":"Api::ItemsController","action":"sync","status":200,"duration":67.2,"view":33.2,"db":10.75,"ddsource":["ruby"],"time":"2020-08-31 12:51:57 +0000","params":{"limit":150,"compute_integrity":true,"items":[{"uuid":"b7031050-278c-4e44-9c44-346e962c8b92","content_type":"[FILTERED]","created_at":"2020-08-31T12:51:29.714Z","updated_at":"2020-08-31T12:51:37.946Z","enc_item_key":"[FILTERED]","content":"[FILTERED]","auth_hash":"[FILTERED]"},{"uuid":"c7d0c2bd-8395-4a52-bff4-13ce7dc2c2da","content_type":"[FILTERED]","created_at":"2020-08-31T12:51:29.716Z","updated_at":"2020-08-31T12:51:37.946Z","enc_item_key":"[FILTERED]","content":"[FILTERED]","auth_hash":"[FILTERED]"},{"uuid":"1d1aa8fd-159b-40e6-931a-1e25a2830a5d","content_type":"[FILTERED]","created_at":"2020-08-31T12:51:29.718Z","updated_at":"2020-08-31T12:51:37.946Z","enc_item_key":"[FILTERED]","content":"[FILTERED]","auth_hash":"[FILTERED]"},{"uuid":"0589bae7-42dd-4463-8ae6-8c5846ca4c87","content_type":"[FILTERED]","created_at":"2020-08-31T12:51:29.719Z","updated_at":"2020-08-31T12:51:37.946Z","enc_item_key":"[FILTERED]","content":"[FILTERED]","auth_hash":"[FILTERED]"}],"sync_token":null,"cursor_token":null,"api":"20190520","controller":"api/items","action":"sync","item":{}},"level":"INFO"}
{"method":"POST","path":"/items/sync","format":"*/*","controller":"Api::ItemsController","action":"sync","status":200,"duration":28.22,"view":1.14,"db":10.29,"ddsource":["ruby"],"time":"2020-08-31 12:51:59 +0000","params":{"limit":150,"items":[{"uuid":"b7031050-278c-4e44-9c44-346e962c8b92","content_type":"[FILTERED]","deleted":true,"created_at":"2020-08-31T12:51:29.714Z","updated_at":"2020-08-31T12:51:57.508Z","enc_item_key":"[FILTERED]","content":"[FILTERED]","auth_hash":"[FILTERED]"},{"uuid":"c7d0c2bd-8395-4a52-bff4-13ce7dc2c2da","content_type":"[FILTERED]","deleted":true,"created_at":"2020-08-31T12:51:29.716Z","updated_at":"2020-08-31T12:51:57.515Z","enc_item_key":"[FILTERED]","content":"[FILTERED]","auth_hash":"[FILTERED]"},{"uuid":"1d1aa8fd-159b-40e6-931a-1e25a2830a5d","content_type":"[FILTERED]","deleted":true,"created_at":"2020-08-31T12:51:29.718Z","updated_at":"2020-08-31T12:51:57.519Z","enc_item_key":"[FILTERED]","content":"[FILTERED]","auth_hash":"[FILTERED]"},{"uuid":"0589bae7-42dd-4463-8ae6-8c5846ca4c87","content_type":"[FILTERED]","deleted":true,"created_at":"2020-08-31T12:51:29.719Z","updated_at":"2020-08-31T12:51:57.523Z","enc_item_key":"[FILTERED]","content":"[FILTERED]","auth_hash":"[FILTERED]"}],"sync_token":"MjoxNTk4ODc4MzE3LjUyMzY1MQ==\n","cursor_token":null,"api":"20190520","controller":"api/items","action":"sync","item":{}},"level":"INFO"}
{"method":"POST","path":"/items/sync","format":"*/*","controller":"Api::ItemsController","action":"sync","status":200,"duration":3.29,"view":0.18,"db":0.78,"ddsource":["ruby"],"time":"2020-08-31 12:51:59 +0000","params":{"limit":150,"items":[],"sync_token":"MjoxNTk4ODc4MzE5LjE4MDA5Ng==\n","cursor_token":null,"api":"20190520","controller":"api/items","action":"sync","item":{}},"level":"INFO"}
{"method":"POST","path":"/items/sync","format":"*/*","controller":"Api::ItemsController","action":"sync","status":200,"duration":3.35,"view":0.19,"db":0.82,"ddsource":["ruby"],"time":"2020-08-31 12:51:59 +0000","params":{"limit":150,"items":[],"sync_token":"MjoxNTk4ODc4MzE5LjI5NzM4NQ==\n","cursor_token":null,"api":"20190520","controller":"api/items","action":"sync","item":{}},"level":"INFO"}
{"method":"POST","path":"/items/sync","format":"html","controller":"Api::ItemsController","action":"sync","status":200,"duration":9.37,"view":1.04,"db":1.71,"ddsource":["ruby"],"time":"2020-08-31 12:52:01 +0000","params":{"limit":150,"compute_integrity":true,"items":[],"sync_token":"MjoxNTk4ODc4Mjk1LjMxNDQzMg==\n","cursor_token":null,"api":"20190520","controller":"api/items","action":"sync","item":{}},"level":"INFO"}
{"method":"POST","path":"/items/sync","format":"html","controller":"Api::ItemsController","action":"sync","status":200,"duration":8.54,"view":0.22,"db":1.74,"ddsource":["ruby"],"time":"2020-08-31 12:52:03 +0000","params":{"limit":150,"compute_integrity":true,"items":[],"sync_token":"MjoxNTk4ODc4MzIxLjkxMjAwMzU=\n","cursor_token":null,"api":"20190520","controller":"api/items","action":"sync","item":{}},"level":"INFO"}
{"method":"POST","path":"/items/sync","format":"html","controller":"Api::ItemsController","action":"sync","status":200,"duration":3.26,"view":0.19,"db":0.78,"ddsource":["ruby"],"time":"2020-08-31 12:52:05 +0000","params":{"limit":150,"items":[],"sync_token":"MjoxNTk4ODc4MzIzLjMwMTc2NTc=\n","cursor_token":null,"api":"20190520","controller":"api/items","action":"sync","item":{}},"level":"INFO"}
{"method":"POST","path":"/items/sync","format":"html","controller":"Api::ItemsController","action":"sync","status":200,"duration":3.9,"view":0.51,"db":0.81,"ddsource":["ruby"],"time":"2020-08-31 12:52:15 +0000","params":{"limit":150,"items":[],"sync_token":"MjoxNTk4ODc4MzI1LjMwOTU5Nw==\n","cursor_token":null,"api":"20190520","controller":"api/items","action":"sync","item":{}},"level":"INFO"}
{"method":"POST","path":"/items/sync","format":"*/*","controller":"Api::ItemsController","action":"sync","status":200,"duration":9018.59,"view":0.34,"db":3.22,"ddsource":["ruby"],"time":"2020-08-31 12:52:07 +0000","params":{"limit":150,"items":[{"uuid":"3167b72f-582f-4710-860b-e985d6a1a5b4","content_type":"[FILTERED]","created_at":"2020-08-31T12:51:58.978Z","updated_at":"1970-01-01T00:00:00.000Z","enc_item_key":"[FILTERED]","content":"[FILTERED]","auth_hash":"[FILTERED]"}],"sync_token":"MjoxNTk4ODc4MzE5Ljc0Njg5NTM=\n","cursor_token":null,"api":"20190520","controller":"api/items","action":"sync","item":{}},"level":"INFO"}
{"method":"POST","path":"/items/sync","format":"html","controller":"Api::ItemsController","action":"sync","status":200,"duration":4.75,"view":0.59,"db":1.07,"ddsource":["ruby"],"time":"2020-08-31 12:52:21 +0000","params":{"limit":150,"items":[],"sync_token":"MjoxNTk4ODc4MzM1LjU3NTk5Mw==\n","cursor_token":null,"api":"20190520","controller":"api/items","action":"sync","item":{}},"level":"INFO"}
{"method":"POST","path":"/items/sync","format":"*/*","controller":"Api::ItemsController","action":"sync","status":200,"duration":9034.05,"view":0.8,"db":4.26,"ddsource":["ruby"],"time":"2020-08-31 12:52:16 +0000","params":{"limit":150,"items":[{"uuid":"1042ff76-f2d2-46a1-836a-a730b50806e6","content_type":"[FILTERED]","created_at":"2020-08-31T12:51:58.978Z","updated_at":"1970-01-01T00:00:00.000Z","enc_item_key":"[FILTERED]","content":"[FILTERED]","auth_hash":"[FILTERED]"}],"sync_token":"MjoxNTk4ODc4MzI3LjE0MjU5ODI=\n","cursor_token":null,"api":"20190520","controller":"api/items","action":"sync","item":{}},"level":"INFO"}
{"method":"POST","path":"/items/sync","format":"html","controller":"Api::ItemsController","action":"sync","status":200,"duration":3.78,"view":0.21,"db":0.88,"ddsource":["ruby"],"time":"2020-08-31 12:52:25 +0000","params":{"limit":150,"items":[],"sync_token":"MjoxNTk4ODc4MzQxLjk1NjU5Mg==\n","cursor_token":null,"api":"20190520","controller":"api/items","action":"sync","item":{}},"level":"INFO"}
{"method":"POST","path":"/items/sync","format":"*/*","controller":"Api::ItemsController","action":"sync","status":200,"duration":9034.07,"view":0.72,"db":3.64,"ddsource":["ruby"],"time":"2020-08-31 12:52:25 +0000","params":{"limit":150,"items":[{"uuid":"e0259f6d-ce04-4ef8-96e6-6d8e246405cb","content_type":"[FILTERED]","created_at":"2020-08-31T12:51:58.978Z","updated_at":"1970-01-01T00:00:00.000Z","enc_item_key":"[FILTERED]","content":"[FILTERED]","auth_hash":"[FILTERED]"}],"sync_token":"MjoxNTk4ODc4MzM2LjM1NTg3NzY=\n","cursor_token":null,"api":"20190520","controller":"api/items","action":"sync","item":{}},"level":"INFO"}
{"method":"POST","path":"/items/sync","format":"html","controller":"Api::ItemsController","action":"sync","status":200,"duration":3.76,"view":0.55,"db":0.83,"ddsource":["ruby"],"time":"2020-08-31 12:52:35 +0000","params":{"limit":150,"items":[],"sync_token":"MjoxNTk4ODc4MzQ1LjUwMzMyMjQ=\n","cursor_token":null,"api":"20190520","controller":"api/items","action":"sync","item":{}},"level":"INFO"}
{"method":"POST","path":"/items/sync","format":"*/*","controller":"Api::ItemsController","action":"sync","status":200,"duration":9031.38,"view":0.85,"db":3.41,"ddsource":["ruby"],"time":"2020-08-31 12:52:35 +0000","params":{"limit":150,"items":[{"uuid":"da87e346-fcb1-43ae-86a4-b4b8fc93a626","content_type":"[FILTERED]","created_at":"2020-08-31T12:51:58.978Z","updated_at":"1970-01-01T00:00:00.000Z","enc_item_key":"[FILTERED]","content":"[FILTERED]","auth_hash":"[FILTERED]"}],"sync_token":"MjoxNTk4ODc4MzQ1LjYxNTI2MDE=\n","cursor_token":null,"api":"20190520","controller":"api/items","action":"sync","item":{}},"level":"INFO"}
{"method":"POST","path":"/items/sync","format":"*/*","controller":"Api::ItemsController","action":"sync","status":200,"duration":9031.99,"view":0.73,"db":3.09,"ddsource":["ruby"],"time":"2020-08-31 12:52:45 +0000","params":{"limit":150,"items":[{"uuid":"0345a53c-e782-48a1-91ce-44d62ca4a30c","content_type":"[FILTERED]","created_at":"2020-08-31T12:51:58.978Z","updated_at":"1970-01-01T00:00:00.000Z","enc_item_key":"[FILTERED]","content":"[FILTERED]","auth_hash":"[FILTERED]"}],"sync_token":"MjoxNTk4ODc4MzU1Ljc3OTc1NDY=\n","cursor_token":null,"api":"20190520","controller":"api/items","action":"sync","item":{}},"level":"INFO"}
{"method":"POST","path":"/items/sync","format":"*/*","controller":"Api::ItemsController","action":"sync","status":200,"duration":9034.69,"view":0.74,"db":6.85,"ddsource":["ruby"],"time":"2020-08-31 12:52:54 +0000","params":{"limit":150,"items":[{"uuid":"2f700994-c95e-459f-a664-6cf02e4f1cb6","content_type":"[FILTERED]","created_at":"2020-08-31T12:51:58.978Z","updated_at":"1970-01-01T00:00:00.000Z","enc_item_key":"[FILTERED]","content":"[FILTERED]","auth_hash":"[FILTERED]"}],"sync_token":"MjoxNTk4ODc4MzY1LjAxMTcwNQ==\n","cursor_token":null,"api":"20190520","controller":"api/items","action":"sync","item":{}},"level":"INFO"}
{"method":"POST","path":"/items/sync","format":"html","controller":"Api::ItemsController","action":"sync","status":200,"duration":4.72,"view":1.27,"db":0.91,"ddsource":["ruby"],"time":"2020-08-31 12:53:05 +0000","params":{"limit":150,"items":[],"sync_token":"MjoxNTk4ODc4MzU1LjMxNDE3NDI=\n","cursor_token":null,"api":"20190520","controller":"api/items","action":"sync","item":{}},"level":"INFO"}
{"method":"POST","path":"/items/sync","format":"*/*","controller":"Api::ItemsController","action":"sync","status":200,"duration":9031.65,"view":1.54,"db":3.7,"ddsource":["ruby"],"time":"2020-08-31 12:53:03 +0000","params":{"limit":150,"items":[{"uuid":"026b025f-8ef3-46ef-98b7-2294e86b4e4c","content_type":"[FILTERED]","created_at":"2020-08-31T12:51:58.978Z","updated_at":"1970-01-01T00:00:00.000Z","enc_item_key":"[FILTERED]","content":"[FILTERED]","auth_hash":"[FILTERED]"}],"sync_token":"MjoxNTk4ODc4Mzc0LjI2MjI0MTg=\n","cursor_token":null,"api":"20190520","controller":"api/items","action":"sync","item":{}},"level":"INFO"}
{"method":"POST","path":"/items/sync","format":"*/*","controller":"Api::ItemsController","action":"sync","status":200,"duration":9032.09,"view":0.72,"db":3.12,"ddsource":["ruby"],"time":"2020-08-31 12:53:12 +0000","params":{"limit":150,"items":[{"uuid":"b1f33c0f-f63f-4884-babb-feeb1faaacd7","content_type":"[FILTERED]","created_at":"2020-08-31T12:51:58.978Z","updated_at":"1970-01-01T00:00:00.000Z","enc_item_key":"[FILTERED]","content":"[FILTERED]","auth_hash":"[FILTERED]"}],"sync_token":"MjoxNTk4ODc4MzgzLjQ5MjE5OQ==\n","cursor_token":null,"api":"20190520","controller":"api/items","action":"sync","item":{}},"level":"INFO"}
{"method":"POST","path":"/items/sync","format":"*/*","controller":"Api::ItemsController","action":"sync","status":200,"duration":9040.0,"view":1.33,"db":4.12,"ddsource":["ruby"],"time":"2020-08-31 12:53:21 +0000","params":{"limit":150,"items":[{"uuid":"ad4be084-faa7-4824-aeb1-8fce0d27fef0","content_type":"[FILTERED]","created_at":"2020-08-31T12:51:58.978Z","updated_at":"1970-01-01T00:00:00.000Z","enc_item_key":"[FILTERED]","content":"[FILTERED]","auth_hash":"[FILTERED]"}],"sync_token":"MjoxNTk4ODc4MzkyLjczMzcwMzY=\n","cursor_token":null,"api":"20190520","controller":"api/items","action":"sync","item":{}},"level":"INFO"}
{"method":"POST","path":"/items/sync","format":"html","controller":"Api::ItemsController","action":"sync","status":200,"duration":6.26,"view":1.23,"db":1.26,"ddsource":["ruby"],"time":"2020-08-31 12:53:35 +0000","params":{"limit":150,"items":[],"sync_token":"MjoxNTk4ODc4Mzg1LjMxMjg5NjU=\n","cursor_token":null,"api":"20190520","controller":"api/items","action":"sync","item":{}},"level":"INFO"}
reueljohnk commented 4 years ago

I also get this notification frequently:

Hmm...we can't seem to sync your account. 
The reason: <!DOCTYPE html>
<html>
<head>
  <title>We're sorry, but something went wrong (500)</title>
  <meta name="viewport" content="width=device-width,initial-scale=1">
  <style>
  body {
    background-color: #EFEFEF;
    color: #2E2F30;
    text-align: center;
    font-family: arial, sans-serif;
    margin: 0;
  }

  div.dialog {
    width: 95%;
    max-width: 33em;
    margin: 4em auto 0;
  }

  div.dialog > div {
    border: 1px solid #CCC;
    border-right-color: #999;
    border-left-color: #999;
    border-bottom-color: #BBB;
    border-top: #B00100 solid 4px;
    border-top-left-radius: 9px;
    border-top-right-radius: 9px;
    background-color: white;
    padding: 7px 12% 0;
    box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
  }

  h1 {
    font-size: 100%;
    color: #730E15;
    line-height: 1.5em;
  }

  div.dialog > p {
    margin: 0 0 1em;
    padding: 1em;
    background-color: #F7F7F7;
    border: 1px solid #CCC;
    border-right-color: #999;
    border-left-color: #999;
    border-bottom-color: #999;
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
    border-top-color: #DADADA;
    color: #666;
    box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
  }
  </style>
</head>

<body>
  <!-- This file lives in public/500.html -->
  <div class="dialog">
    <div>
      <h1>We're sorry, but something went wrong.</h1>
    </div>
    <p>If you are the application owner check the logs for more information.</p>
  </div>
</body>
</html>
moughxyz commented 4 years ago

@karolsojko do we still have the issue where not having AWS_REGION set will cause saving to silently fail? That might be what's going on here.

karolsojko commented 4 years ago

@mobitar I think duplicates happened when someone used develop brach of syncing-server against master webapp /cc @baptiste-grob @johnny243

as for the AWS_REGION that was an issue when someone used the app in development mode from what I remember https://github.com/standardnotes/syncing-server/pull/63

reueljohnk commented 4 years ago

@karolsojko I might have used the develop branch by mistake. My bad!! I will try with the master branch and get back

moughxyz commented 4 years ago

@karolsojko but if using the server in production mode wouldn't it run jobs which depend on AWS_REGION?

reueljohnk commented 4 years ago

I changed to the master branch and it's working perfectly now :100: ! Thank you so much. Do let me know if i can go ahead and close the issue

karolsojko commented 4 years ago

@karolsojko but if using the server in production mode wouldn't it run jobs which depend on AWS_REGION?

Can't recall what the discussion was about the setting needed to be inline in development mode only. Anyways yeah - in production mode you'd need to have AWS_REGION to get registration emails (but it's not necesarry to run the server): https://github.com/standardnotes/syncing-server/blame/develop/app/controllers/api/auth_controller.rb#L138

This is a bit of a different topic - @itsrjk I think you can close this issue

reueljohnk commented 4 years ago

Cheers!