nightscout / cgm-remote-monitor

nightscout web monitor
GNU Affero General Public License v3.0
2.42k stars 71.75k forks source link

Crashing after upgrade and after clean build. #6050

Closed JohnKitching closed 4 years ago

JohnKitching commented 4 years ago

Describe the bug A clear and concise description of what the bug is. I changed from mLab to Atlas about a month ago. That went fine. Yesterday I upgraded NS to 14.0.3 and was getting app crashes. I tried a clean fork. No improvement. Tried a new DB no improvement. Today I've created new Heroku and Atlas accounts and tried again. Same problem. Setup today went ok until step 8, NS settings. On saving I was prompted for API secret (although I'd already entered it) and it didn't accept the one I entered (which is correct)

I used this guide http://nightscout.github.io/nightscout/new_user/

I'm now getting this in my Heroku log every few seconds.

2020-09-19T09:37:43.661040+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=johnns2.herokuapp.com request_id=5600f709-1365-4e2c-8cf9-c0d58621d499 fwd="31.13.103.6" dyno= connect= service= status=503 bytes= protocol=http

Sometimes this

2020-09-19T09:47:17.888688+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=johnns2.herokuapp.com request_id=87e49fd8-abed-46f3-92e0-c577bcd038d9 fwd="93.35.243.46" dyno= connect= service= status=503 bytes= protocol=http

I've double checked my MONGODB_URI (I assume this is the main suspect) and it seems fine.

I haven't got as far as trying to get anything to write to NS.

sulkaharo commented 4 years ago

Would you have logs from before the crash notice that shows the cause? What software are you using to upload data into Nighscout? This is likely caused by some malformed data and I'd love to get a sample of it.

JohnKitching commented 4 years ago

Right now I'm getting the same crashes in an empty NS with nothing uploading to it.

This is the error I'm currently seeing:

2020-09-19T10:03:25.689323+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/socket.io/?EIO=3&transport=polling&t=NIbqNYK" host=johnns2.herokuapp.com request_id=e6dab5b5-12b4-4f20-8842-f76d651fdfda fwd="81.133.162.66" dyno= connect= service= status=503 bytes= protocol=https

The NIbqNYK changes. As does the request_id.

I'll try to figure out how to get to older logs.

JohnKitching commented 4 years ago

Not sure if this is relevant but I'm seeing

Version head

In settings.

JohnKitching commented 4 years ago

I restarted dynos and may have got what you wanted

johnns2-logs-1600510170101.txt

JohnKitching commented 4 years ago

If I understand it correctly I think it's crashing after reading a profile with a null value instead of a time. I've only used the NS profile editor to create a single profile.

This would tie in with it not crashing before I create a profile.

JohnKitching commented 4 years ago

This is the profile stored in the DB

{ "_id" : ObjectId("5f65c9f6af3ff000042e7b21"), "defaultProfile" : "JK", "store" : { "JK" : { "dia" : 7, "carbratio" : [ { "time" : "00:00", "value" : 6.4, "timeAsSeconds" : 0 } ], "carbs_hr" : null, "delay" : 20, "sens" : [ { "time" : "00:00", "value" : 8, "timeAsSeconds" : 0 } ], "timezone" : "Europe/London", "basal" : [ { "time" : "00:00", "value" : 1.44, "timeAsSeconds" : 0 }, { "time" : "01:00", "value" : 1.47 }, { "time" : "02:00", "value" : 1.79 }, { "time" : "03:00", "value" : 2.08 }, { "time" : "04:00", "value" : 1.99 }, { "time" : "05:00", "value" : 2.15 }, { "time" : "06:00", "value" : 2.3 }, { "time" : "07:00", "value" : 2.56 }, { "time" : "08:00", "value" : 2.56 }, { "time" : "09:00", "value" : 2.26 }, { "time" : "10:00", "value" : 2.12 }, { "time" : "11:00", "value" : 2.12 }, { "time" : "12:00", "value" : 2.12 }, { "time" : "13:00", "value" : 2.13 }, { "time" : "14:00", "value" : 2.14 }, { "time" : "15:00", "value" : 2.14 }, { "time" : "16:00", "value" : 2.14 }, { "time" : "17:00", "value" : 2.14 }, { "time" : "18:00", "value" : 2.15 }, { "time" : "19:00", "value" : 2.15 }, { "time" : "20:00", "value" : 2.15 }, { "time" : "21:00", "value" : 2.15 }, { "time" : "22:00", "value" : 2.15 }, { "time" : "23:00", "value" : 2.15 } ], "target_low" : [ { "time" : "00:00", "value" : 7, "timeAsSeconds" : 0 } ], "target_high" : [ { "time" : "00:00", "value" : 7, "timeAsSeconds" : 0 } ], "units" : "mmol" } }, "startDate" : "1970-01-01T00:00:00.000Z", "mills" : 0, "units" : "mmol", "created_at" : "2020-09-19T09:05:58.714Z" }

JohnKitching commented 4 years ago

Would you rather I wait for you guys or try to find out more? I was thinking of trying to delete the profile from the database and see if it runs then. If that works maybe try different time zones and settings when creating a new profile.

sulkaharo commented 4 years ago

Just delete the profile to get the site up and running. Which app saved this to your database?

JohnKitching commented 4 years ago

Will do thanks. Nightscout wrote the profile.

JohnKitching commented 4 years ago

Found it! It's when carb absorption rate is blank. I think Pre-14 used to be ok with that but post-14 isn't.

sulkaharo commented 4 years ago

Yay that's a great catch! Awesome, thank you ❀️

JohnKitching commented 4 years ago

Pleasure is all mine. It's nice to not be just taking for once even if it is a bit trivial! Thank you for your hard work.

bmcd31 commented 4 years ago

Found it! It's when carb absorption rate is blank. I think Pre-14 used to be ok with that but post-14 isn't.

Hi john, I'm actually having trouble with the same error at the moment. May I ask what exactly you mean by this carb absorption problem?

JohnKitching commented 4 years ago

In a NS profile is the setting "carbs activity / absorption rate [g/hour]" I always used to delete this number as AAPS doesn't use it (and I think I read somewhere you should when using AAPS). This was my problem. To get round it I think there are two options (I'm sure there are more, but these are the simple ones I could come up with)

  1. Use MongoDB Shell to delete all profiles (this is what I did, it's not as daunting as it sounds)
  2. Create a new, empty Atlas DB.

Restart dynos after either option.

With option 1 at least you shouldn't lose your data. Either option means you'll have to manually recreate your profile(s) when you get running again. Don't delete carb absorption this time 😏

bmcd31 commented 4 years ago

Hi john, Thank you for your reply. Are you aware of any instructions I could find to perform option 1 that you have stated?

If you have any questions please don't hesitate to contact me.

Kind regards, Ben McDermott Ben Built Constructions Phone: 0429 329 975


From: John Kitching notifications@github.com Sent: Sunday, September 20, 2020 8:08 pm To: nightscout/cgm-remote-monitor Cc: bmcd31; Comment Subject: Re: [nightscout/cgm-remote-monitor] Crashing after upgrade and after clean build. (#6050)

In a NS profile is the setting "carbs activity / absorption rate [g/hour]" I always used to delete this number as AAPS doesn't use it (and I think I read somewhere you should when using AAPS). This was my problem. To get round it I think there are two options (I'm sure there are more, but these are the simple ones I could come up with)

  1. Use MongoDB Shell to delete all profiles (this is what I did, it's not as daunting as it sounds)
  2. Create a new, empty Atlas DB.

Restart dynos after either option.

With option 1 at least you shouldn't lose your data. Either option means you'll have to manually recreate your profile(s) when you get running again.

β€” You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/nightscout/cgm-remote-monitor/issues/6050#issuecomment-695768985, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ANAM3W2WPLPWIO4VPG3VGWDSGXIBPANCNFSM4RS5VC3A.

JohnKitching commented 4 years ago

No, but I'll help if you like. Log into Atlas Click connect and it'll show you how to get MongoDB Shell running on your Mac or PC. The second part will show you how to connect Shell to your DB. In shell do... show dbs This will show all the databases, one will be your Nightscout one. Do ... Use DBName Where DBName is your Nightscout database Do ... show collections If you're in the right DB one of these will be profile If you want to see your profiles before deleting do ... db.profile.find() Or to display it a bit nicer do ... db.profile.find().pretty() You can now copy or print any profile of interest. Do ... db.profile.remove({}) This will delete all profiles. Restart dynos in Heroku You should now be able to go to Nightscout and create a new profile.

To be fair you could move your profile to another collection or edit it to add the carb absorption rate but that was beyond what I could be bothered to learn how to do 😏

psonnera commented 4 years ago

@JohnKitching that sounds good, any way to do it with the web UI of Atlas? Like this? image

JohnKitching commented 4 years ago

Probably but I didn't do that.

psonnera commented 4 years ago

Works, just tried on a test site. No need for shell, no data loss.

JohnKitching commented 4 years ago

That sounds easier than "my" way

bmcd31 commented 4 years ago

Thanks anyway john, I'll be so glad if either if these strategies work for me.

If you have any questions please don't hesitate to contact me.

Kind regards, Ben McDermott Ben Built Constructions Phone: 0429 329 975


From: John Kitching notifications@github.com Sent: Monday, September 21, 2020 1:28 am To: nightscout/cgm-remote-monitor Cc: bmcd31; Comment Subject: Re: [nightscout/cgm-remote-monitor] Crashing after upgrade and after clean build. (#6050)

That sounds easier than "my" way

β€” You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/nightscout/cgm-remote-monitor/issues/6050#issuecomment-695799918, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ANAM3W2UXSST635D3HXEZA3SGYNQNANCNFSM4RS5VC3A.

human911 commented 4 years ago

Thank you everyone. This also resolved my issue.

sulkaharo commented 4 years ago

Ok I could finally repro locally, dev now has a fix for this. Looks like to have this happen, you have to save a profile that leaves the carbs field blank

JohnKitching commented 4 years ago

Thanks Sulka. I'm pretty certain I read somewhere once that you should blank it with AAPS. Whether it was real or Facebook type advice I'm not sure!