HabitRPG / habitica

A habit tracker app which treats your goals like a Role Playing Game.
https://habitica.com
Other
12k stars 4.09k forks source link

"two versions of your data" bug / Bizarre cron reset problem - cron runs (boss damage) but leaves Dailies ticked; Dailies do damage when completed (not from sync errors) [$150] #4313

Closed mamishka closed 8 years ago

mamishka commented 9 years ago

I talked to Alys about this and she said she hadn't heard about this bug before, but it's now happened to me twice in just three days.

Here's what happens in a nutshell: 1) I mark off all of my Dailies for the day. 2) After midnight, PST, a new Daily appears for the new day. 3) I go to Social:Party to see what damage I have done to the Boss. 4) I click Fetch Recent Messages 5) It tells me something along these lines: "Mamishka attacks Octothulu for 57.2 damage, Octothulu attacks party for 14.8 damage." even though I did ALL of my daily tasks. 6) I go back to my main page, hit refresh. My list shows all of the tasks I did on the previous day checked for TODAY. 7) So essentially something is going on where the cron is resetting but screwing up somehow, noting anything I marked off toward the end of the day on the previous day as not being done and taking EVERYTHING that I marked off as done on the previous day and applying them to today. 8) This is extremely annoying.

I have put myself into the Tavern until this problem can be resolved, as I am damaging my party unfairly while we're on a Quest, which is extremely vexing.


edit by admin:

Advice:

This bug occurs when your browser stops syncing correctly with Habitica's server and so the server never finds out that you have taken actions on the website (e.g., it doesn't know that you completed your Dailies). A wide range of odd behaviour can happen when syncing stops. Typically, the website keeps behaving as if all your actions are being recorded, but later when syncing starts again those actions will either be reversed as if they had never occurred or will be re-applied as if they had happened twice.

1. How to fix Dailies that should have become unticked:

There are two ways to untick Dailies without losing Experience (XP), Gold (GP), and Mana (MP):

You will probably find that your streaks for those Dailies have been set to zero. You can reset them by editing each Daily and looking in the Advanced Options part of the edit screen. If you aren't sure what your streaks were, go to Data menu -> Data Display Tool and use the Dailies History section to help you estimate them (for more information see the wiki's Streaks page).

2. How to recover from damage (health loss) caused by Dailies that you did complete yesterday:

When this bug occurs, it can cause you to lose health for Dailies that you had completed on the previous day. If you are in a boss quest, this will also cause the other quest participants to lose health. You and they can regain the lost health by each of you going to Settings -> Site and clicking on the Fix Character Values button. You will be shown a form that you can use to set your Health back to what it should be. If the damage was severe enough to cause you to die, you can also restore your level (increase it by one) and give yourself extra gold to buy back the piece of equipment that you lost.

3. How to recognise this bug as soon as it starts:

Sometimes the first sign of that this bug has occurred is that the blue sync bar does not appear when you are taking actions on the site. So, as you are using the website, keep an eye on the top of the screen where the blue bar should be. You should see it every time you add a task, delete a task, or click on the checkbox or +/- buttons of a task. You should also see it when changing/completing checklist items, and when using Rewards, and when doing a variety of other actions.

Not receiving any drops at all for a significant period of time is another sign that this bug has occurred (although note that drops are random, and depend on buffs and equipment, and have a daily limit that cannot be exceeded, so it is possible to receive no drops without this bug occurring).

If you ever do not see the blue bar when you're expecting it or if you notice anything else that indicates that the website is not syncing with the server, immediately log out of the website and log back in (if you are not sure what your login details are, you can view them at Settings > Site before you log out - in particular, note the email address there and make sure it is correct and current). If the blue bar still doesn't appear when you action tasks, try logging out again. This should stop you being unfairly damaged when cron runs and prevent the other problems this bug causes.

However note that this bug can still occur even when the blue bar keeps working. If you don't see the blue bar, you definitely have this bug. If you do see the blue bar, you might still have this bug. :( See the advice in point 4 for a more certain way to protect yourself.

4. What to do if you experience this bug often:

It is likely that cron problems caused by this bug won't occur if you reload Habitica using your browser's refresh button just before you stop using Habitica for the day. After you've reloaded, do a sync using the sync button in the top right hand corner of the tasks page and then check that your Dailies are still ticked off. If they aren't, tick them again and then repeat the reload and sync.

However a reload is not always a reliable way to stop the bug; sometimes logging out is necessary.

You can also use the Data Display Tool (available from Habitica's Data menu) to examine your Dailies in the "Dailies Incomplete" section. That tool takes its data directly from Habitica's server, so if it shows differences from what you see on the Habitica website, it means that this bug has occurred on the website. Reload the Habitica website then refetch data in the Data Display Tool, and compare again. Repeat until the Habitica website shows the same thing as the Data Display Tool. If reloading the Habitica website doesn't fix the problem, try logging out of Habitica and then logging back in.

I'm sorry it's such a pain. If you've had this problem happen to you just once or twice, it might not be worth the effort of doing this every night, but if it happens to you very frequently, this might stop or reduce it. It's only a workaround - we do intend to make a proper fix, as soon as we can work out what that fix should be.

There is a $150 open bounty on this issue. Add to the bounty at Bountysource.

Alys commented 9 years ago

@mamishka Please let us know your unique user id. You can find out how to find it from this page.

If this happens again, can you please take a screenshot of your Dailies just before midnight showing which ones are ticked and which ones aren't, and another screenshot immediately after point 2 (when the new Daily has appeared), and another one immediately after point 6 (showing the Dailies checked for today). For each screenshot, please use the "All" tab on the Dailies list, rather than "Due" or "Grey". If you have enough Dailies that they don't all appear on one screen, please take a couple of screenshots at each of those three times so that we can see all of them.

If your Dailies contain any sensitive information, you can use an image editor to remove or block out the text. What I'm really interested in is the colours of the Dailies and the states of the checkboxes.

Alys commented 9 years ago

A similar report in the Tavern (UUID 4dfccb29-5423-4f85-a1d8-ccaf2ebe2c12): "my dailies now have not reset for two days and I thus cannot check them off today. Yesterday I unchecked and rechecked them all and apparently that didn't register for all of them, as today I and my party received damage for some (and streaks for some reset). This morning I woke up to see them all checked off still. I'm not resting in the inn, although I did just check in and out of it just to be sure." - This implies that damage is happening but the Dailies aren't being unticked, so cron is running only partially.

goldfndr commented 9 years ago

I don't know if this is related but...

My (c844d0b3-ee01-422d-9b5a-4135917181f2) dailies didn't reset last night; I'm guessing it's because I have CDS=3 and didn't check most (all?) until after midnight; at first I was guessing that everyone was put into the Inn during the server outage. Also, for the Boss Quest, I should've taken 1.1 damage but it says 0.0 for 13 hours ago. That particular Daily is the only one remaining unchecked but it is showing a score for today.

I still have the Data Display open, last refreshed at 2:47am, if that'd help.

Looking further, I think my issue is an instance of #1057 rather than this.

Alys commented 9 years ago

@goldfndr Before you close the Data Display, go to the Stats and Streaks Backup section and copy everything there to a text file! You might need it if your Dailies lose their streaks in the next day or two. I'm not sure they will but we're getting a lot of reports of problems like this so best to be safe.

@goldfndr Just to confirm: when your cron ran : It DID put a message into your party chat about your damage done to/from the boss but it did NOT untick your Dailies - is that correct?

goldfndr commented 9 years ago

@Alys Backed up. I suppose that's maybe correct, as 13 hours ago would be about the time for cron, but perhaps that was login time instead of cron time. Within the API/user (after a sync), I see auth: { timestamps: { loggedin: "2014-12-02T09:53:32.900Z" } } and lastCron: "2014-12-02T09:53:32.898Z". I wish the party chat had more verbose time, as the two lines just prior to 13 hours ago are "3 days ago"... maybe that's something I can effect locally, now that I've studied a little more angular. Ah, 1417514013143 is the timestamp for the last (0.0 damage) party message, which corresponds to... well, 09:53:33 or so. (drat, why do the popular ones hide the milliseconds even though they were provided with milliseconds?!?)

Come to think of, I think I did have a Perfect Day previously, so maybe I have yet to take the 1.1 damage. Perhaps the bug (this is #1057) is related to not having logged in/sync'd within a 25h period?

Alys commented 9 years ago

@goldfndr Cron always happens when your account takes its first action on the site after midnight (or after your Custom Day Start time). So if you logged out the night before, cron would happen when you logged in. If you were still logged in from the night before, cron would happen when you ticked off a task or refreshed the page or synced new chat messages - whatever you did first. Drop in to the Aspiring Coders guild for some comments about timestamps that I've just put there.

Cron shouldn't perform incorrectly if you've been away for more than 24 hours - it's built to cope with that. But then cron doesn't always do what it should do... I don't know. At this stage we're still collecting information about the recent larger-than usual amount of cron problems.

mamishka commented 9 years ago

Whatever is going on definitely not normal. In the past I would often hit refresh after midnight and my tasks would be active again and cron would have occurred properly and I would have been appropriately rewarded or lost health depending on what I did or did not do the previous day. Now it seems like cron completely forgets the previous days achievements, punishes you for not completing them and then assumes that everything you checked off the previous day is for the next day. I never log out and this has never been a problem before now.

Alys commented 9 years ago

Thanks @mamishka. It is pretty clear that there's something going wrong. Unfortunately we need more information to help us work out exactly what. Can you please see my comment above to you? We need your unique user ID, and if the same thing keeps on happening - and it sounds like it does - then the screenshots I described could really help us see what's happening for you.

mamishka commented 9 years ago

Hi @Alys! Here is my id: bea2a0fc-8ea9-423b-afad-0c5931a287a3 I "might" have some useful information to share on this problem. I realized that in both cases where the cron did not reset properly for me, I was set to seeing only "Due" Dailies not "All". Today, as an experiment, I finished all of my Dailies and checked them off and then took screen captures just in case the problem occurred again. The difference? I set my Dailies to "All". After midnight I refreshed and lo and behold, my cron reset properly and I immediately got the following message when I clicked Fetch Recent Message in my Party Chat: "Mamishka attacks Octothulu for 66.4 damage, Octothulu attacks party for 0.0 damage. -6 minutes ago"

So it might be a glitch that only happens depending on how you're looking at your Dailies?

Tomorrow I will set myself to "Due" Dailies as a reverse experiment and see if the cron weirdness happens or not. fingers crossed

Alys commented 9 years ago

There's another detailed report of this in https://github.com/HabitRPG/habitrpg/issues/4317 - "Cron is running but dailies are not resetting... the boss is dealing damage each night even when I have had a perfect day... I've been forcing a sync after I tick off anything and also completing the ticks earlier"

Alys commented 9 years ago

We are adding extra logging to the cron process which we are hoping will show us where errors are occurring.

Alys commented 9 years ago

This cron bug happened to me last night - or at least something that looks like the bug that people have been reporting here, but might be something odd about me using the mobile app.

There is something odd about quest.progress.up. The full amount that I had yesterday WAS applied to the boss overnight (party message confirms that). However this morning, when it should be back to zero, it's actually about 7.6. I am almost completely certain that I noticed this problem before I ticked off any tasks this morning (at worst, I might have ticked off one task) so most/all of this 7.6 damage is NOT from tasks I have done today. To investigate this I made a record of which Dailies had remained ticked overnight, then unticked them all, then made note of quest.progress.up (still 7.6), then ticked those same Dailies again, then looked at quest.progress.up and it was 14.9 (about twice what it was before). So it seems that the additional quest.progress.up that I had this morning corresponds with the Dailies that had remained unticked. It's as if those Dailies had been ticked off both before cron ran and then again after.

There is something I did last night that I don't usually do, which might explain this. I hardly ever use the mobile app to tick off Dailies, but last night I did use it to tick off several all in a row, and also to tick the checklist items for one Daily that I had not fully completed. After that, when I got back to my PC, I noticed that those Dailies had not been synced and were still unticked. I was sleepy and not thinking clearly, so I didn't go back to the phone to force a sync, but just ticked them off again on the website on my PC. I am not certain which Dailies I did this for or how many, but the 9 that did not become unticked overnight MIGHT have been those ones. If that's true, then the other behaviour I've described above could be explained by a sync from the phone happening after cron ran. However.... after I ticked off Dailies on the phone and then ticked them off again on the PC, I realised that phone sync issues might do odd things overnight, so I used Titanium Backup to switch my phone to a different user profile, which caused the HabitRPG mobile app to be logged in under a different account than the one that this bug happened to. So I don't think it's possible for the phone itself to have synced those Dailies after cron ran. I'm going to try to replicate this tonight.

bunnyplanet commented 9 years ago

I'm having an issue which may be this same bug. My user ID is 0396e6e1-0edc-46f5-9449-24891ba16698

Here's what I've observed. Every other day, the majority of my dailies don't reset. The number seems to vary, but the pattern, if there is one, is that dailies that I checked off first thing in the morning the previous day will reset and all others will not. Some of my streaks will stay as they were, others will go down to one.

I'm not in any parties, but I do generally get a hit point loss at the start of these days, and I'm not buffed despite having had a perfect day previously.

mamishka commented 9 years ago

I've noticed a pattern that might be helpful in solving this bug. Any time I have my dailies set to "all", everything works fine and cron resets properly. Every time I have my dailies set to "due", this cron problem happens. Not sure why that would affect things, but that might be a clue to what is causing the problem.

bunnyplanet commented 9 years ago

I'll try leaving mine set to all tonight and see what happens. Though if the pattern holds, I wouldn't have the issue tomorrow anyway. I'll try it tomorrow night as well.

deilann commented 9 years ago

I can pretty much guarantee you that is not related.

On Mon, Dec 22, 2014 at 8:54 PM, bunnyplanet notifications@github.com wrote:

I'll try leaving mine set to all tonight and see what happens. Though if the pattern holds, I wouldn't have the issue tomorrow anyway. I'll try it tomorrow night as well.

— Reply to this email directly or view it on GitHub https://github.com/HabitRPG/habitrpg/issues/4313#issuecomment-67922014.

bunnyplanet commented 9 years ago

Well, weirdly enough I set the dailies to "all" last night and today everything reset as it should. Let's see if I can get three in a row.

pepperpanda commented 9 years ago

UUID: 5638de0b-7673-4e12-a14e-0e1efc244b1c lastCron" : ISODate("2015-01-11T00:03:14.987Z")

So I had a perfect day yerterday but I seem to have taken damage and didn't have a perfect day buff. Also while our party was on a collection quest, I did gain quest items but some my Dailies didn't become UNticked. 10 Dailies have become unticked and 22 Dailies are still ticked.

Alys commented 9 years ago

Another report: https://github.com/HabitRPG/habitrpg/issues/1107#issuecomment-69706766

Alys commented 9 years ago

Another report: https://github.com/HabitRPG/habitrpg/issues/4512

trailrunnerhabitrpg commented 9 years ago

I am having similar issues (8c39b6b2-3870-444d-9ba1-6838cb897a87). On Monday night I thought I checked out of the Inn but on Tuesday morning I was still checked in. On Tuesday night all of the habits I checked off after about 7 pm damaged me overnight and appeared checked off and grayed in the morning. All the ones I checked off earlier in the day were fine.

bunnyplanet commented 9 years ago

So, I don't know if this will help everyone, but I seem to have found a way to keep my problem from occurring. (Knock wood.)

I've been following along with the user data display. A few days ago, I noticed that when I fetched my data, it was wrong -- it didn't show most of the dailies I had checked off that day, or the drops I'd received. Nothing changed until I reloaded the user page [edit by Alys: bunnyplanet later confirmed that this refers to the HabitRPG task page]. (I think the sync button didn't work -- it often seems not to do anything. I'll check if this happens again.) Once I'd reloaded the page and refetched the data, everything was fine and I haven't had a problem since.

I don't know for sure, but I suspect that if I hadn't reloaded, I would've wound up with one of the weird messed up days the next day.

Alys commented 9 years ago

@bunnyplanet Sorry, I'd like to confirm exactly which page you're referring to when you say you reloaded the user page. Do you mean you reloaded the User Data Display page (https://oldgods.net/habitrpg/habitrpg_user_data_display.html), or did you mean a page in HabitRPG itself (https://habitrpg.com/)?

bunnyplanet commented 9 years ago

Sorry, I just realized I was being obscure there. I meant the tasks page. (https://habitrpg.com/#/tasks)

Alys commented 9 years ago

@bunnyplanet Okay, that's definitely interesting. If I understand correctly, the sequence of events was:

  1. You ticked off some Dailies in HabitRPG. Everything looked okay in HabitRPG (all the right Dailies were marked as completed).
  2. You fetched your data in the Data Display Tool (DDT) and noticed it was outdated
  3. You reloaded HabitRPG using your browser's "refresh" feature. Everything still looked okay in HabitRPG (all the right Dailies were still marked as completed).
  4. You refetched your data in the DDT and noticed that it was now correct.
  5. The cron problems did NOT occur at all when cron ran the next morning.

Is that all correct?

How unreliable has cron been for you before this? Have you been having problems EVERY time cron runs, or most times, or only a few times? Can you remember roughly how long ago you started having these problems with cron (your first comment in this issue was 23 days ago)?

bunnyplanet commented 9 years ago

Yes, that's the sequence.

I had been having problems about every other day. I think it began shortly after I joined.

Alys commented 9 years ago

@bunnyplanet Thanks for confirming! Could you please tell us your unique user ID (from Settings -> API).

And would it be okay if I looked up the date that you joined HabitRPG and posted it into this issue? It will help us get a feel for how long this has been happening.

bunnyplanet commented 9 years ago

Sure. 0396e6e1-0edc-46f5-9449-24891ba16698

I think I also posted early on in the newbie guild, if that helps.

Alys commented 9 years ago

@bunnyplanet I would be VERY interested to know if reloading HabitRPG using your browser's refresh button every night prevents the cron problems you've been having OR if it does not help in future. In theory, it should not have any effect, but in theory these cron problems should not be happening. :-/

bunnyplanet joined HabitRPG on 2014-12-03T00:41:45.991Z (see above her comment "I had been having problems about every other day. I think it began shortly after I joined.")

@lefnire @paglias @blade @negue @anyone-else-who-cares @clutching-at-straws: I'm wondering if there's some sort of bizarre caching issue going on somewhere. bunnyplanet's success with a reload might be just coincidence but it might also indicate that there's two "versions" of his data floating around somehow, and a reload makes the most recent one overwrite the older one. This also sort of matches a couple of other reports I've seen where people report that the Dailies they ticked off later in the day are treated differently than the earlier ones (example: "all of the [dailies] I checked off after about 7 pm... appeared checked off and grayed in the morning. All the ones I checked off earlier in the day were fine."). But this is just wild speculation.

bunnyplanet commented 9 years ago

I'll keep checking my data and report back if anything else happens. (I'm a her, btw. :-) ) I do sometimes have wifi issues, perhaps that could contribute to a caching problem?

Alys commented 9 years ago

@bunnyplanet I've edited my post to adjust the pronoun. :) Wifi issues should just produce Sync Errors, which is where your browser / app temporarily has data that has not been saved to the server, and then when you reload, the browser's data is completely overwritten by the server's data. That doesn't seem to be what's happening here. But really, I have no idea. :) I'm just hoping that wild speculation will eventually produce something meaningful.

Future reports of anything you notice will definitely be useful! Thanks for being so helpful about this.

paglias commented 9 years ago

@Alys if i'm not wrong we also had reports where refreshing didn't solve the issue. When you send an action to the server it sends also a version attribute which tells which data you have, if it doesn't correspond to the one the server has than it assumes that you don't have the most recent one and thus resend the whole user object to the browser.

Caching: we don't cache anything nor tell the browser to cache anything from the api. As far as I know browser respect what the server tells them about what to cache so I don't know.

What might indeed be seen as "caching" is in the case where the user keep the site open after reset time, in that case they will look like they didn't reset because cron only runs on the server and so nothing will change until a sync or a refresh are made.

Soo... I'm going to make a pull request to force a sync after cron time but it will need some testing

Alys commented 9 years ago

Another report with interesting features (refresh not helping, etc): https://github.com/HabitRPG/habitrpg/issues/4520 "Cron related issue between mobile and browser?"

lemoness commented 9 years ago

Minor note - last night, when I fetched data on the Data Display Tool, it did not update to my most recent information. I tried fetching data several times, and then, remembering this ticket, refreshed Habit fully. The Data Display Tool then updated to the expected stats when I fetched my data. This morning, all of my tasks refreshed normally. If it happens again, should I take one for the team and not refresh Habit to see if it triggers this bug?

On Thu, Jan 15, 2015 at 12:39 PM, Alice Harris notifications@github.com wrote:

Another report with interesting features (refresh not helping, etc): #4520 https://github.com/HabitRPG/habitrpg/issues/4520 "Cron related issue between mobile and browser?"

— Reply to this email directly or view it on GitHub https://github.com/HabitRPG/habitrpg/issues/4313#issuecomment-70157380.

Alys commented 9 years ago

Blimey... this bug...!!!! @lemoness yes, I think it would be useful to see what happens if you don't refresh.

lemoness commented 9 years ago

Okay, I will keep an eye out!

On Thu, Jan 15, 2015 at 1:06 PM, Alice Harris notifications@github.com wrote:

Blimey... this bug...!!!! @lemoness https://github.com/lemoness yes, I think it would be useful to see what happens if you don't refresh.

— Reply to this email directly or view it on GitHub https://github.com/HabitRPG/habitrpg/issues/4313#issuecomment-70161606.

Alys commented 9 years ago

I am wondering if this is not actually a cron bug at all, but instead is a "two versions of my data" bug, and the only reason cron is involved is because the "two versions" bug becomes really obvious when cron acts on just one version of the data. We have two reports now (bunnyplanet and Lemoness) of a "two versions" situation that has nothing to do with cron.

EDIT: And another "two versions" report from djstinkay

trailrunnerhabitrpg commented 9 years ago

My bug hit again last night. The first time this happened, I checked the problematic things off on my iPad, but yesterday I did it on the computer. I'll try to better document--thought the problem was solved because I was fine on Thursday morning.

Alys commented 9 years ago

I have this "two versions of my data" bug myself now!!! My cron has not happened yet, and won't for another 4.5 hours, and my previous cron this morning was normal as far as I noticed (certainly all my Dailies become unticked) so what I am reporting here has nothing to do with cron. I am writing each part of this as I investigate. At the end will be a summary highlighting the important points. Note that it is stupidly late here and I should have been asleep hours ago, so any failures of logic or poor explanations are due to exhaustion. :) I'll go through all this again in the morning. See also Lemoness's comment above which I believe is the same situation, and also bunnyplanet's and probably djstinkay's.

In the browser window that I was using for ticking off tasks tonight, I have just three Dailies left uncompleted. In the DDT, those three are marked as uncompleted but there are also two others marked uncompleted - the two that I ticked off most recently tonight (I am certain of that). So, according to the DDT, there are five Dailies incomplete, but according to my browser, there are three incomplete.

Note that the difference is TWO tasks, so this can't be a normal browser sync error, where the browser displays data that has not been (and never is) sent to the server. If there had been a sync error when I ticked off the first of those two tasks, then ticking off the second of those two should have reversed the unsynced tick-off of the first one, and my browser would now be showing four Dailies incomplete. (At least I think my logic is correct here. I'll think over it again in the morning.) My net connection isn't so poor that I'd expect two sync errors to happen in a row. Normally, I never get sync errors at all.

When I repeatedly refetch data in the DDT, the results there don't change.

When I click HabitRPG's sync button in the browser, literally nothing happens! There is no blue bar across the top of the page and nothing changes. Note that my number of tasks is huge, so the blue bar is always visible for a second or so whenever a sync occurs - it is not possible that tonight the blue bar is appearing and disappearing so quickly that I can't see it. I.e., the sync button is broken - it is not causing a sync.

The Chrome console has this error:

https://habitrpg.com/api/v2/user/batch-update?_v=581&data=1421411005263&siteVersion=1 Failed to load resource: net::ERR_NETWORK_CHANGED
app-7b1bd051.js:6 TypeError: Cannot read property 'wasModified' of null
    at https://habitrpg.com/app-7b1bd051.js:27:18438
    at https://habitrpg.com/app-7b1bd051.js:6:9105
    at j (https://habitrpg.com/app-7b1bd051.js:7:7310)
    at https://habitrpg.com/app-7b1bd051.js:7:7507
    at j.$eval (https://habitrpg.com/app-7b1bd051.js:7:14303)
    at j.$digest (https://habitrpg.com/app-7b1bd051.js:7:12775)
    at j.$apply (https://habitrpg.com/app-7b1bd051.js:7:14568)
    at t (https://habitrpg.com/app-7b1bd051.js:6:10659)
    at v (https://habitrpg.com/app-7b1bd051.js:6:12206)
    at XMLHttpRequest.r (https://habitrpg.com/app-7b1bd051.js:6:11930)app-7b1bd051.js:6 (anonymous function)

A quick grep -r of the codebase for wasModified shows the hits below - note the reference to _v - something related to versions? I'll study the code properly later.

node_modules/habitrpg-shared/script/userServices.js:              if(data.wasModified) {
node_modules/habitrpg-shared/script/userServices.js:                delete data.wasModified;
src/controllers/auth.js:    res.locals.wasModified = req.query._v ? +user._v !== +req.query._v : true;
src/controllers/user.js:    if (ranCron) res.locals.wasModified = true;
src/controllers/user.js:    response.wasModified = res.locals.wasModified;
src/controllers/user.js:    }else if(response.wasModified){
src/routes/apiv1.js:    response.wasModified = res.locals.wasModified
src/routes/apiv1.js:    }else if(response.wasModified){

When I clear the Chrome console and hit the (non-functional) sync button again, nothing reappears in the Chrome console.

When I open a second browser tab with HabitRPG in it and sync, syncing works and I see the same five uncompleted Dailies that that DDT shows. Nothing interesting in the console.

A third browser tab using the beta site gives the same results as the second browser tab.

Summary so far: at this point, we have one browser tab (the oldest tab) showing three Dailies remaining, and three tabs (including DDT) showing five remaining. Those latter three have extracted their data from the server more recently than the first browser tab. I.e., the server says there are five Dailies uncompleted.

I reload my first, oldest browser tab using my browser's refresh function (this is the tab that shows only three tasks uncompleted). The reload takes a normal amount of time, the blue bar does its normal thing, and when it's all over, there are still the same THREE tasks uncompleted. I.e., now the most recent data from the server says there are just three Dailies left, even though I have not ticked off any tasks since the server thought there were five Dailies left. This means that the server has now received the message that two extra Dailies were ticked off, so that message had to have been cached/stored/versioned/??? somewhere! There is nothing interesting in the Console.

Note that when I reloaded, a few GP, XP, etc notification messages appeared, as if I had been ticking off tasks in another location and the earnings were only just now being reported. I'm not sure if the amounts shown correspond to the two tasks I ticked off most recently. I have screenshots. I'll examine them in the morning.

Now I use HabitRPG's sync button on the other two HabitRPG browser tabs (prod and beta) and I refetch my data in the DDT. Each of those three tabs now shows only three Dailies remaining. The server has definitely got the message that it's not five. There is nothing interesting in the Console for the two HabitRPG website tabs.

So, in summary:

  1. On the website, I ticked off two Dailies, leaving three remaining.
  2. At some time around here, maybe before, maybe after, the Chrome console said Cannot read property 'wasModified' of null
  3. At some time around here, maybe before, maybe after, HabitRPG's sync button stopped working.
  4. Fetching data from the server in other tabs showed that the server thought there were five Dailies remaining.
  5. Reloading the first browser tab had these effects:
    • The wasModified error did not reoccur
    • The sync button started working
    • The information about the two Dailies that I ticked off recently was sent to to the server. It had been stored somewhere.
  6. The server now knows that there are only three Dailies remaining.

I really hope all this makes sense.

During this whole process, I completely forgot to check the database to see what it had stored. I'm going to be annoyed about that for days.

Alys commented 9 years ago

paglias has told me now that we do actually do some caching. We use the browser's local storage, so the "two versions of my data" bug probably is a real thing, and this issue isn't about a cron bug at all (cron merely makes the "two versions" bug more obvious).

https://github.com/HabitRPG/habitrpg-shared/commit/4a22b1dc57d1167b24e225f2253d9272120daf63

bunnyplanet commented 9 years ago

"When I click HabitRPG's sync button in the browser, literally nothing happens! There is no blue bar across the top of the page and nothing changes."

That's the same issue I've been intermittently having.

paglias commented 9 years ago

@bunnyplanet we just fixed it :) it will take some more time to get to the mobile app but the browser is fine now

bunnyplanet commented 9 years ago

The exact same sequence happened tonight. Fetched my data, it was off by 5 dailies. Sync button did nothing at all. Refreshing the tasks browser fixed it.

paglias commented 9 years ago

@bunnyplanet it shouldn't but if it happens again you should open the chrome console (Ctrl+shift+j) and paste here any error you see Il 17/gen/2015 07:23 "bunnyplanet" notifications@github.com ha scritto:

The exact same sequence happened tonight. Fetched my data, it was off by 5 dailies. Sync button did nothing at all. Refreshing the tasks browser fixed it.

— Reply to this email directly or view it on GitHub https://github.com/HabitRPG/habitrpg/issues/4313#issuecomment-70356622.

flutterbye commented 9 years ago

hit by the bug again this morning. 3 dailies reset, the rest did not from the boss battle..flutterbye attacks The Laundromancer for 4.5 damage, The Laundromancer attacks party for 4.4 damage. i can't remember what time i ticked everything off, but the ones that reset were the same ones that reset last time the bug hit.

Alys commented 9 years ago

@flutterbye Is it possible to give us a rough approximation of how many hours ago you ticked off the last of your Dailes for yesterday? To the nearest hour or two? I'm hoping to find out if it was before or after we pushed a change to the site.

flutterbye's previous reports: https://github.com/HabitRPG/habitrpg/issues/4317 and https://github.com/HabitRPG/habitrpg/issues/1057#issuecomment-65208452 (It's been really vicious for you flutterbye, I'm sorry!)

flutterbye commented 9 years ago

I think it was around 13-14 hours ago. It's 11.45am here now, and I had logged off before 11pm last night. Although it was the later ones that did not reset last time, this doesn't appear to be the case this time, but it it the same dailies. Thanks Alice :)

On 17 January 2015 at 11:35, Alice Harris notifications@github.com wrote:

@flutterbye https://github.com/flutterbye Is it possible to give us a rough approximation of how many hours ago you ticked off the last of your Dailes for yesterday? To the nearest hour or two? I'm hoping to find out if it was before or after we pushed a change to the site.

flutterbye's previous reports: #4317 https://github.com/HabitRPG/habitrpg/issues/4317 and #1057 (comment) https://github.com/HabitRPG/habitrpg/issues/1057#issuecomment-65208452 (It's been really vicious for you flutterbye, I'm sorry!)

— Reply to this email directly or view it on GitHub https://github.com/HabitRPG/habitrpg/issues/4313#issuecomment-70363773.

flutterbye commented 9 years ago

Sorry Alice I've just looked again as I was resetting them, and it is possible that the ones that reset were ticked off earlier. I'm sorry that I can't be sure this time.

On 17 January 2015 at 11:49, Carolyn Gara saltergara@gmail.com wrote:

I think it was around 13-14 hours ago. It's 11.45am here now, and I had logged off before 11pm last night. Although it was the later ones that did not reset last time, this doesn't appear to be the case this time, but it it the same dailies. Thanks Alice :)

On 17 January 2015 at 11:35, Alice Harris notifications@github.com wrote:

@flutterbye https://github.com/flutterbye Is it possible to give us a rough approximation of how many hours ago you ticked off the last of your Dailes for yesterday? To the nearest hour or two? I'm hoping to find out if it was before or after we pushed a change to the site.

flutterbye's previous reports: #4317 https://github.com/HabitRPG/habitrpg/issues/4317 and #1057 (comment) https://github.com/HabitRPG/habitrpg/issues/1057#issuecomment-65208452 (It's been really vicious for you flutterbye, I'm sorry!)

— Reply to this email directly or view it on GitHub https://github.com/HabitRPG/habitrpg/issues/4313#issuecomment-70363773.

flutterbye commented 9 years ago

to clarify: i meant ticked off earlier in the day. i hope what i'm writing isn't too confusing!

On 17 January 2015 at 11:55, Carolyn Gara saltergara@gmail.com wrote:

Sorry Alice I've just looked again as I was resetting them, and it is possible that the ones that reset were ticked off earlier. I'm sorry that I can't be sure this time.

On 17 January 2015 at 11:49, Carolyn Gara saltergara@gmail.com wrote:

I think it was around 13-14 hours ago. It's 11.45am here now, and I had logged off before 11pm last night. Although it was the later ones that did not reset last time, this doesn't appear to be the case this time, but it it the same dailies. Thanks Alice :)

On 17 January 2015 at 11:35, Alice Harris notifications@github.com wrote:

@flutterbye https://github.com/flutterbye Is it possible to give us a rough approximation of how many hours ago you ticked off the last of your Dailes for yesterday? To the nearest hour or two? I'm hoping to find out if it was before or after we pushed a change to the site.

flutterbye's previous reports: #4317 https://github.com/HabitRPG/habitrpg/issues/4317 and #1057 (comment) https://github.com/HabitRPG/habitrpg/issues/1057#issuecomment-65208452 (It's been really vicious for you flutterbye, I'm sorry!)

— Reply to this email directly or view it on GitHub https://github.com/HabitRPG/habitrpg/issues/4313#issuecomment-70363773 .

Alys commented 9 years ago

That's fine @flutterbye , thanks! It's the kind of information I was hoping for.

The change https://github.com/HabitRPG/habitrpg-shared/commit/4a22b1dc57d1167b24e225f2253d9272120daf63 which is related to this bug was deployed about 19 hours ago which is before flutterbye ticked off the last of her Dailies, and the ones that did not reset look like they were the last ones (which would make sense based on what we suspect about this bug so far), so it looks like there's still something going wrong.