nikku / wuffle

A multi-repository / multi-organization task board for GitHub issues.
https://wuffle.dev
MIT License
118 stars 23 forks source link

Cards not displayed on wuffle pod restart until next background sync #112

Closed piyushk closed 3 years ago

piyushk commented 3 years ago

Describe the Bug

We restarted our wuffle pod and all cards on the frontend vanished. Store was restored from s3 within ~5 seconds. The cards appeared ~15 minutes later when the next background sync happened.

I removed some spurious log lines in the log below:

sed -i '/"name":"http"/d' log
sed -i '/"name":"wuffle:auth-flow"/d' log 
sed -i '/"name":"wuffle:user-/d' log 
sed -i '/"name":"github:user-/d' log

Log:

{"name":"wuffle:run","hostname":"wuffle-68d756bd5b-2mprw","pid":1,"level":30,"msg":"Attempting to run Wuffle v0.35.5 in /app/packages/app","time":"2021-03-08T21:06:29.278Z","v":0}
{"name":"wuffle:run","hostname":"wuffle-68d756bd5b-2mprw","pid":1,"level":30,"msg":"Validating configuration","time":"2021-03-08T21:06:29.280Z","v":0}
{"name":"wuffle:run","hostname":"wuffle-68d756bd5b-2mprw","pid":1,"level":30,"msg":"Starting Wuffle","time":"2021-03-08T21:06:29.282Z","v":0}
Warning: connect.session() MemoryStore is not
designed for a production environment, as it will leak
memory, and will not scale past a single process.
[@octokit/app] Deprecated. Use @octokit/app-auth instead. See https://github.com/octokit/app.js/#deprecated
{"name":"probot","hostname":"wuffle-68d756bd5b-2mprw","pid":1,"level":40,"msg":"Run `npm install --save-dev smee-client` to proxy webhooks to localhost.","time":"2021-03-08T21:06:29.404Z","v":0}
{"name":"probot","hostname":"wuffle-68d756bd5b-2mprw","pid":1,"level":30,"msg":"Listening on http://localhost:3000","time":"2021-03-08T21:06:29.404Z","v":0}
{"name":"wuffle:dump-store-s3","hostname":"wuffle-68d756bd5b-2mprw","pid":1,"level":30,"Bucket":"REDACTED","Key":"storedump.json","t":5244,"msg":"restored","time":"2021-03-08T21:06:34.644Z","v":0}
{"name":"wuffle","hostname":"wuffle-68d756bd5b-2mprw","pid":1,"level":30,"msg":"started","time":"2021-03-08T21:06:34.644Z","v":0}
{"name":"wuffle:dump-store-s3","hostname":"wuffle-68d756bd5b-2mprw","pid":1,"level":30,"Bucket":"REDACTED","Key":"storedump.json","t":783,"msg":"dumped","time":"2021-03-08T21:11:30.184Z","v":0}
{"name":"wuffle:dump-store-s3","hostname":"wuffle-68d756bd5b-2mprw","pid":1,"level":30,"Bucket":"REDACTED","Key":"storedump.json","t":680,"msg":"dumped","time":"2021-03-08T21:16:30.082Z","v":0}
{"name":"wuffle:background-sync","hostname":"wuffle-68d756bd5b-2mprw","pid":1,"level":30,"msg":"start","time":"2021-03-08T21:20:59.728Z","v":0}
...
...

Note that the background sync happened ~15 minutes after startup. After the background sync, cards appeared on the frontend as normal.

Steps to Reproduce

I'm not sure how reproducible this behavior is. We just restarted out wuffle pod. The repositories have a high number of issues.

Expected Behavior

I would expect that cards appear as soon as wuffle pod is restarted and the store has been restored.

Environment

nikku commented 3 years ago

Thanks for opening this issue @piyushk.

What would be interesting is to get some more details on your utilization:

Note that the background sync happened ~15 minutes after startup. After the background sync, cards appeared on the frontend as normal.

The only explaination I can think of at the moment is that store restore did not kick in or did not restore anything. But looking at the logs restore completed in five seconds.

nikku commented 3 years ago

Do you by chance have a backup of your store dump? If so, it could be interesting to see what was inside / supposed to be restored.

piyushk commented 3 years ago

I'll try my best to provide details. We're running on this private repository, so I'll have to look through stuff before sharing it:

We did save a copy of the storedump around restart. I'll see if I can share the store dump. I may not be able to, but I'll update within the week once I look through it.

nikku commented 3 years ago

Regarding background synchronization of issues: Old issues ("archived") are automatically cleaned up after some days (cf. CONFIG). So what you're seeing over there is expected behavior.

Looking at the logs I can verify what you pointed out regarding start, restore and background-sync:

{"name":"wuffle:run","hostname":"wuffle-68d756bd5b-2mprw","pid":1,"level":30,"msg":"Starting Wuffle","time":"2021-03-08T21:06:29.282Z","v":0}

{"name":"wuffle:background-sync","hostname":"wuffle-68d756bd5b-2mprw","pid":1,"level":30,"msg":"start","time":"2021-03-08T21:20:59.728Z","v":0}

Background synchronization is done every hour and the timer is persisted across restarts.

:arrow_right: As we see the sync happen 15 minutes after start already, I conclude that restore worked and restored the last sync time.

I see no circumstance in which one bit of information is restored successfully and the other one (issues) is not. Are you sure you were properly logged-in into the board after restore? Sessions as well as a number of internal user-access caches do not persist.

piyushk commented 3 years ago

I can confirm that I was properly logged into the board after restore. I see session requests in the log. I also did a hard refresh on my browser. I also agree that the restore happened correctly.

I'll try and reproduce this bug at a time it will be less disruptive for users and try and debug it further. Since there isn't an obvious answer right now, please feel free to close the issue. I'll report back if I find something concrete.

nikku commented 3 years ago

Closing this issue as you suggested. Happy to re-open if you can reproduce what you're seeing.

piyushk commented 3 years ago

We recently bumped our pod again, and cards disappeared for 10 minutes. This time they appeared before the next background sync happened, so my original issue report was not correct.