-
-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Version v2.0.2 - database error=json: unsupported value: NaN ...
#402
Comments
This seems to be in the database query. There must be some invalid data in the database. Are you handy with sqlite? |
I'm actually using both SQLIte and PostgreSQL right now. I'm in the process of transitioning to Postgres. |
In that case, you can try two things:
Eventually, you should find the culprit and we should be able to determine what exactly causes this... |
Perhaps I should provide a command line utility to iterate over all workouts and print information about them... |
A Command line utility would be great! Trying to find which line causes the problem will take a while. |
Yes, I don't understand what could be related... I won't pretend I don't make mistakes, maybe you pulled a tag at a time the build was broken? (I had to redo a tag in the v2 because I messed something up) |
I'll try repulling and let you know |
Release v2.0.3 contains an extra binary wt-debug, which you can try; it's still very much WIP, but you never know! |
Awesome! I'm finishing a couple things but will test the new version shortly. Thanks!!! |
The binary is not inside the docker container; it's contained in the archive files you can download and you can run it separately, eg against your SQLite file. |
Sorry. Brain is glitching. I downloaded the source code and found the wt_debug, but not sure if I'm doing the right thing. I tried starting the container but it panics too quickly for me to get in and work with it. |
So, I started with a clean database in the Sqlite container and added everything back in from GPX files just like I did before and it worked just fine. The only difference is that I did not include any file that was in the "failed" directory. |
Every release has compiled assets; from v2.0.3 on, if you download the compiled archive for your system, it should contain 2 binaries: The docker container does not contain the debugging tool (yet). |
I finally figured it out!!!! It was nothing to do with the application (sort of). For some reason, 2 records in the My query to find them was:
|
What was the value then, if not numeric and not null? |
So, in the Sqlite database, the fields contained Something I realized later was that the database does not like zero values for speed and distance. I'm not sure how I had GPX files with zero values for those two items, but I have since corrected them. I realized this after refreshing the workouts (through the user profile page). Immediately after doing so, a recalculation put those values back into the If I was making a recommendation for app updates, it would be to include some sort of error check that either bypasses the calculation for zero value entries or ignores the entries entirely (and adds the gpx files to the |
Yes, I noticed the same issue; I assumed that division by zero would not be allowed, but: https://go.dev/play/p/fucTTgc2cEJ This was a big surprise for me. And JSON did not like that. I now added #409 |
It kind of seems like this is getting worse. I just noticed my app was down again, many more items listed with +Inf now than last time... wt-app | {"time":"2025-02-10T13:36:57.237476279-08:00","level":"ERROR","msg":"json: unsupported value: +Inf","app":"workout-tracker","version":"master","sha":"25b0ee2b4bdb2b5df61e7935a8b24dd6c761a35f","module":"database","error":"json: unsupported value: +Inf","query":"SELECT * FROM "map_data" WHERE "map_data"."workout_id" IN (215,174,173,172,171,8,2,3,1,6,170,169,168,167,190,166,189,165,188,203,164,163,162,161,160,159,158,4,157,156,155,154,153,152,151,150,149,148,147,146,144,143,142,145,141,140,139,138,137,136,135,134,133,132,131,130,129,127,126,125,124,123,122,121,120,119,118,117,214,213,116,212,211,210,115,114,113,128,112,111,110,109,108,107,106,209,208,105,104,207,103,206,102,101,100,99,98,97,205,96,95,94,93,92,91,90,89,88,204,87,86,85,202,84,83,82,81,80,79,78,77,76,179,178,177,176,75,175,201,74,200,199,73,198,72,197,71,196,70,195,194,193,69,187,191,68,67,66,65,64,63,62,61,60,59,58,57,56,53,52,51,49,50,44,42,41,40,38,35,34,33,31,30,29,28,55,18,17,16,19,13,21,11,9,10)","duration":7846479,"rows":185,"file":"/app/pkg/database/workouts.go:405"} |
How are you entering the workouts that are changing to |
Can you share the specifics for one such workout (anonymised if relevant)? Maybe I can reproduce... |
With the latest version, 2.0.2, I get an error immediately after start up. It appears to be in the Go file
file=/app/pkg/database/workouts.go:407
.If I revert to v2.0.1, it works just fine.
Not sure how to fix the issue if it is complaining about values within the workout.
Any ideas?
The text was updated successfully, but these errors were encountered: