wekan / wekan-snap

Newest Wekan Snap docs wiki. Repo has old Snap code, newest Snap code at https://github.com/wekan/wekan , where is also more of newest WeKan docs at wiki.
https://github.com/wekan/wekan-snap/wiki
MIT License
71 stars 11 forks source link

The mongo data has been tampered after snap update. #83

Closed abel533 closed 5 years ago

abel533 commented 5 years ago

You may find that the card has disappeared.

Query the mongo database to find the following problem:

    "listId" : "PozTHYqCX9P5TcchW",
    "boardId" : "rjkgvdzfSwo5MC7qW",
    "sort" : 0.0625,
    "swimlaneId" : "rjkgvdzfSwo5MC7qW",
    "type" : "cardType-card",
    "archived" : false,

the swimlaneId should be 6zoz9hutLm9T4h7Rz,but now it's the same as boardId, then the card has disappeared.

Snap can't disable updates, how to avoid this serious bug caused by automatic updates.

xet7 commented 5 years ago

@abel533

What is your Wekan versions? You see it with sudo snap list

Docker version of Wekan does not update automatically, it's used by version tag like this at docker-compose.yml:

image: quay.io/wekan/wekan:v2.33

With Wekan, you need to have backups of database at least daily, preferably more often. Wekan still has bugs that can make Wekan board not load anymore, like moving some card away from subtasks, or linking to card itself causing recursive loop, so you need to be able to restore, even when not having automatic updates.

@andresmanelli Can you look at this?

Related https://github.com/wekan/wekan/issues/2209

xet7 commented 5 years ago

Hmm, that's stange bug. I'll also look at source code changes how has this happened.

xet7 commented 5 years ago

@abel533

I can't figure out anything that would cause that in changes between previous and newest Wekan release that would have caused that. It would really help if you could tell what Wekan version you have.

abel533 commented 5 years ago

Version:

Name   Version    Rev   Tracking  Publisher   Notes
core   16-2.37.2  6405  stable    canonical✓  core
wekan  2.33       449   stable    xet7        -

When you add or modify a card now, there will still be a problem with the swimlaneId becoming a boardId.

image

abel533 commented 5 years ago

How to use the snap to downgrade the wekan version?

xet7 commented 5 years ago

@abel533

https://snapcraft.io has snap docs.

xet7 commented 5 years ago

Just guessing, maybe it's this https://github.com/wekan/wekan/issues/2213

I will revert it and add new Wekan release.

abel533 commented 5 years ago

I also found filtering problems yesterday.

xet7 commented 5 years ago

Wekan Snap version is currently building, it will be released soon.

xet7 commented 5 years ago

Well, "soon" depends how fast Snap Store validates new upload of Wekan release. Sometimes it's fast, but sometimes it takes one hour.

xet7 commented 5 years ago

@abel533

Thanks a lot for reporting this issue! Hmm, I did not sleep tonight, it's morning already...

abel533 commented 5 years ago

I will always pay attention to the update of the snap version, and feedback after the update.

xet7 commented 5 years ago

Thanks! Wekan has a huge amount of advanced features so I do depend on bug reports etc community feedback to know what does not work.

xet7 commented 5 years ago

Now Wekan snap is released! Please test. This updates immediately:

sudo snap refresh
xet7 commented 5 years ago

Only other change that I did not revert yet were performance improvements https://github.com/wekan/wekan/pull/2214 that add indexes to MongoDB and do group queries to database, but I would think that does not actually change queries in any way.

abel533 commented 5 years ago

I have updated.

abel533 commented 5 years ago

Filtering problems still exist

xet7 commented 5 years ago

Sure, filter "fix" was reverted. But did mongodb tampering get fixed?

abel533 commented 5 years ago

SwimlaneId problem still exists, I'll try a lower version.

abel533 commented 5 years ago
redis@redis:~$ sudo snap revert --revision=446 wekan
wekan reverted to 2.31
redis@redis:~$ ll /snap/wekan/
total 8
drwxr-xr-x  5 root root 4096 Mar  1 14:34 ./
drwxr-xr-x  5 root root 4096 Jan 10 09:47 ../
drwxr-xr-x 13 root root  671 Feb 28 18:57 446/
drwxr-xr-x 13 root root  671 Mar  1 05:47 449/
drwxr-xr-x 13 root root  671 Mar  1 13:25 451/
lrwxrwxrwx  1 root root    3 Mar  1 14:34 current -> 446/
abel533 commented 5 years ago
redis@redis:~$ snap list --all wekan
Name   Version  Rev  Tracking  Publisher  Notes
wekan  2.31     446  stable    xet7       -
wekan  2.33     449  stable    xet7       disabled
wekan  2.34     451  stable    xet7       disabled

446 also has problems. I can't switch to a lower version.

bentiss commented 5 years ago

446 also has problems. I can't switch to a lower version.

I can help bisecting the problem. However, I can't seem to reproduce the issue. Do you have a reliable reproducer? Neither adding nor modifying a card makes it disappear in v2.33, so I must not be doing the right thing to expose the bug.

xet7 commented 5 years ago

@abel533

You could have something wrong in your database like circular reference bug or something else. It can not be fixed with downgrade because downgrade does not change database contents. You coud try exporting all boards to Wekan JSON and importing to new empty Wekan database. You can empty database this way in snap:

sudo snap stop wekan.wekan
mongo --port 27019
use wekan
db.dropDatabase();
exit
sudo snap start wekan.wekan
xet7 commented 5 years ago

And, make backup first before trying above.

xet7 commented 5 years ago

Also, this does not restore all users, so you would need to copy list from webbrowser and create them again, or edit database.

xet7 commented 5 years ago

Another one to try is, does this bug happen only on one board? If you create new board, is the bug there too?

xet7 commented 5 years ago

I would guess that if you find the difference by comparing working and not-working Wekan boards, and fix some small change to your existing database, you could fix this.

xet7 commented 5 years ago

Also on my Wekan boards I have not noticed this bug at all. I will add filter fix back in next Wekan release.

abel533 commented 5 years ago

This problem exists in many billboards.

When this problem occurs again, I will check all the data to find the problem.

abel533 commented 5 years ago

Test in a new board.

Create a new card and drag it in the current list.

The following are the new and updated messages:

[
  [
    {
      "msg": "method",
      "method": "/cards/insert",
      "params": [
        {
          "title": "111",
          "members": [],
          "labelIds": [],
          "customFields": [],
          "listId": "FmAiv5rD3spesKK5f",
          "boardId": "7qBtoFy5iD9jEPj2T",
          "sort": 3,
          "swimlaneId": "xtTDXEpP9q4tjJxAb",
          "type": "cardType-card",
          "archived": false,
          "parentId": "",
          "coverId": "",
          "createdAt": { "$date": 1551506948812 },
          "dateLastActivity": { "$date": 1551506948812 },
          "description": "",
          "requestedBy": "",
          "assignedBy": "",
          "spentTime": 0,
          "isOvertime": false,
          "userId": "oup6ydF2SXPsZXa3X",
          "subtaskSort": -1,
          "linkedId": ""
        }
      ],
      "id": "30",
      "randomSeed": "e3df1685305781720f82"
    }
  ],
  [
    {
      "msg": "method",
      "method": "/cards/update",
      "params": [
        { "_id": "Q9bhk3pSQLteKSALW" },
        {
          "$set": {
            "swimlaneId": "7qBtoFy5iD9jEPj2T",
            "listId": "FmAiv5rD3spesKK5f",
            "boardId": "7qBtoFy5iD9jEPj2T",
            "sort": 3,
            "dateLastActivity": { "$date": 1551506950810 }
          }
        },
        {}
      ],
      "id": "31"
    }
  ]
]

Tests show that only specific users will update the wrong swimlaneId. My own account does not have this problem. Can you see the reason?

abel533 commented 5 years ago

docker compose, use wekanteam/wekan:v2.17.

The same user performs the same operation.

There is no problem with this version. Judging from the data, swimlaneId has been updated in the new version.

{
    "msg": "method",
    "method": "/cards/update",
    "params": [
        {
            "_id": "JeFGz88Ykt9aeXe5m"
        },
        {
            "$set": {
                "listId": "gSQcK4AyA3K3A9hpc",
                "boardId": "QEvKyvvi69yaentZo",
                "sort": 4,
                "dateLastActivity": {
                    "$date": 1551513769979
                }
            }
        },
        {}
    ],
    "id": "5"
}
abel533 commented 5 years ago

I changed from snap to dock-compose.