Skip to content
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

Compass broke after trip #42

Open
KTamas opened this issue Oct 1, 2021 · 3 comments
Open

Compass broke after trip #42

KTamas opened this issue Oct 1, 2021 · 3 comments

Comments

@KTamas
Copy link

KTamas commented Oct 1, 2021

I was on a trip to another country. I'm back now and it suddenly throws 500 errors with overland. I had it running on the airplane, maybe that messed things up somehow?

[2021-10-01 06:38:44] lumen.ERROR: ErrorException: Undefined index: geometry in /opt/compass/compass/app/Http/Controllers/Api.php:280
Stack trace:
#0 /opt/compass/compass/app/Http/Controllers/Api.php(280): Laravel\Lumen\Application->Laravel\Lumen\{closure}(8, 'Undefined index...', '/opt/compass/co...', 280, Array)
#1 [internal function]: App\Http\Controllers\Api->input(Object(Illuminate\Http\Request))
#2 /opt/compass/compass/vendor/illuminate/container/Container.php(507): call_user_func_array(Array, Array)
#3 /opt/compass/compass/vendor/laravel/lumen-framework/src/Application.php(1399): Illuminate\Container\Container->call(Array, Array)
#4 /opt/compass/compass/vendor/laravel/lumen-framework/src/Application.php(1363): Laravel\Lumen\Application->callControllerCallable(Array, Array)
#5 /opt/compass/compass/vendor/laravel/lumen-framework/src/Application.php(1335): Laravel\Lumen\Application->callLumenController(Object(App\Http\Controllers\Api), 'input', Array)
#6 /opt/compass/compass/vendor/laravel/lumen-framework/src/Application.php(1303): Laravel\Lumen\Application->callControllerAction(Array)
#7 /opt/compass/compass/vendor/laravel/lumen-framework/src/Application.php(1288): Laravel\Lumen\Application->callActionOnArrayBasedRoute(Array)
#8 /opt/compass/compass/vendor/laravel/lumen-framework/src/Application.php(1207): Laravel\Lumen\Application->handleFoundRoute(Array)
#9 [internal function]: Laravel\Lumen\Application->Laravel\Lumen\{closure}(Object(Illuminate\Http\Request))
#10 /opt/compass/compass/vendor/illuminate/pipeline/Pipeline.php(139): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#11 /opt/compass/compass/vendor/illuminate/session/Middleware/StartSession.php(62): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#12 [internal function]: Illuminate\Session\Middleware\StartSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#13 /opt/compass/compass/vendor/illuminate/pipeline/Pipeline.php(124): call_user_func_array(Array, Array)
#14 /opt/compass/compass/vendor/illuminate/cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#15 [internal function]: Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(Object(Illuminate\Http\Request), Object(Closure))
#16 /opt/compass/compass/vendor/illuminate/pipeline/Pipeline.php(124): call_user_func_array(Array, Array)
#17 /opt/compass/compass/vendor/illuminate/cookie/Middleware/EncryptCookies.php(59): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#18 [internal function]: Illuminate\Cookie\Middleware\EncryptCookies->handle(Object(Illuminate\Http\Request), Object(Closure))
#19 /opt/compass/compass/vendor/illuminate/pipeline/Pipeline.php(124): call_user_func_array(Array, Array)
#20 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#21 /opt/compass/compass/vendor/illuminate/pipeline/Pipeline.php(102): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#22 /opt/compass/compass/vendor/laravel/lumen-framework/src/Application.php(1439): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#23 /opt/compass/compass/vendor/laravel/lumen-framework/src/Application.php(1213): Laravel\Lumen\Application->sendThroughPipeline(Array, Object(Closure))
#24 /opt/compass/compass/vendor/laravel/lumen-framework/src/Application.php(1153): Laravel\Lumen\Application->dispatch(NULL)
#25 /opt/compass/compass/public/index.php(28): Laravel\Lumen\Application->run()
#26 {main}
@KTamas
Copy link
Author

KTamas commented Oct 2, 2021

So here's the entry that caused the issue:

[2021-10-01 17:44:11] lumen.DEBUG: Array
(
    [type] => Feature
    [properties] => Array
        (
            [wifi] => HomeWifi
            [timestamp] => 2021-09-30T22:42:16Z
            [battery_state] => unplugged
            [battery_level] => 0.5
            [device_id] => OLDPHONE
            [action] => application_launched_with_location
        )

)

I changed the code so it could process these:

              if (array_key_exists('geometry', $loc)) {
                if($loc['geometry']['coordinates'][0] == 0 && $loc['geometry']['coordinates'][1] == 0) $shouldAdd = false;
              } else {
                \Log::debug("something went wrong, no geometry, skipping, but srsly, wtf");
                \Log::debug(print_r($loc, true));
              }

I think what happened is that I am in the middle of switching phones and at one point both were logging and that does not jibe well with Compass somehow.

@aaronpk
Copy link
Owner

aaronpk commented Oct 2, 2021

That's super weird, it shouldn't be possible for Overland to generate a record that doesn't have location data!

The other way to avoid this is to turn off the "tracking stats" feature in the app.

but yeah if you're pushing data from two phones you'll also run into the problem of the records being out of order since it currently assumes data is always written sequentially.

@KTamas
Copy link
Author

KTamas commented Oct 3, 2021

Yeah, I really don't know what happened, and as far as I can tell it was this one record. Since than I reset the other phone so now I have definitely only one copy of overland running.

Still, might be wise to add something like the above to the code for these freak incidents.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants