Teslamate: ERROR: type "earth" does not exist at character 136

Created on 5 Oct 2019  Â·  9Comments  Â·  Source: adriankumpf/teslamate

Hi,

I get following error when starting new version 1.10 from docker. I was migrating from 1.19 and had no problem before.

@adriankumpf any idea?

br

pi@raspberrypi:~/teslamate $ sudo docker-compose up
Starting teslamate_teslamate_1 ... done
Starting teslamate_grafana_1 ... done
Starting teslamate_db_1 ... done
Starting teslamate_mosquitto_1 ... done
Attaching to teslamate_teslamate_1, teslamate_db_1, teslamate_mosquitto_1, teslamate_grafana_1
db_1 | 2019-10-05 16:10:32.669 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
db_1 | 2019-10-05 16:10:32.669 UTC [1] LOG: listening on IPv6 address "::", port 5432
db_1 | 2019-10-05 16:10:34.138 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
db_1 | 2019-10-05 16:10:35.178 UTC [24] LOG: database system was shut down at 2019-10-05 16:09:42 UTC
db_1 | 2019-10-05 16:10:35.182 UTC [25] LOG: incomplete startup packet
teslamate_1 | waiting for postgres at db:5432 (2sec)
mosquitto_1 | 1570291833: mosquitto version 1.6.7 starting
mosquitto_1 | 1570291833: Config loaded from /mosquitto/config/mosquitto.conf.
mosquitto_1 | 1570291833: Opening ipv4 listen socket on port 1883.
mosquitto_1 | 1570291833: Opening ipv6 listen socket on port 1883.
db_1 | 2019-10-05 16:10:35.233 UTC [1] LOG: database system is ready to accept connections
grafana_1 | /run.sh: line 75: /usr/share/grafana/bin/grafana-cli: No such file or directory
teslamate_1 | 18:10:45.447 [info] Already up
teslamate_grafana_1 exited with code 127
db_1 | 2019-10-05 16:11:05.768 UTC [34] ERROR: type "earth" does not exist at character 136
db_1 | 2019-10-05 16:11:05.768 UTC [34] QUERY: SELECT cube(cube(cube(earth()cos(radians($1))cos(radians($2))),earth()cos( radians($1))sin(radians($2))),earth()*sin(radians($1)))::earth
db_1 | 2019-10-05 16:11:05.768 UTC [34] CONTEXT: SQL function "ll_to_earth" during inlining
db_1 | automatic analyze of table "teslamate.public.positions"
^CGracefully stopping... (press Ctrl+C again to force)
Stopping teslamate_teslamate_1 ... done
Stopping teslamate_mosquitto_1 ... done
Stopping teslamate_db_1 ... done

bug

All 9 comments

I don't yet understand what's causing this error. But someone found a workaround in this thread: https://github.com/diogob/activerecord-postgres-earthdistance/issues/30#issuecomment-419642823

thanks for reply. executed suggested statement in postgres console. Looks like this.

db_1 | 2019-10-05 16:55:29.261 UTC [41] ERROR: type "earth" does not exist at character 136
db_1 | 2019-10-05 16:55:29.261 UTC [41] QUERY: SELECT cube(cube(cube(earth()cos(radians($1))cos(radians($2))),earth()cos(radians($1))sin(radians($2))),earth()*sin(radians($1)))::earth
db_1 | 2019-10-05 16:55:29.261 UTC [41] CONTEXT: SQL function "ll_to_earth" during inlining
db_1 | automatic analyze of table "teslamate.public.positions"

In fact I was raising the issue because of my not working grafana and have not even seen that earth function went wrong. Could you please have a look at this:

db_1 | 2019-10-05 16:10:35.233 UTC [1] LOG: database system is ready to accept connections
grafana_1 | /run.sh: line 75: /usr/share/grafana/bin/grafana-cli: No such file or directory
teslamate_1 | 18:10:45.447 [info] Already up
teslamate_grafana_1 exited with code 127

I just saw this - I don't have the earth issue but grafana is failing to load. Same error see #193

It seems two different issues.

I also have this problem with the "earth" error. Not sure what exactly to do with it yet.

But everything seems to be working fine.

As mentioned in https://github.com/adriankumpf/teslamate/issues/193#issuecomment-538732714 I downgraded Grafana with the most recent docker image. Please pull the latest image and try again.

As mentioned in #193 (comment) I downgraded Grafana with the most recent docker image. Please pull the latest image and try again.

I pulled your last revision. But it seems to work _now and then_ - for some reason.
I get this error when running:

grafana_1 | t=2019-10-06T15:46:59+0000 lvl=info msg="Initializing Stream Manager" grafana_1 | t=2019-10-06T15:46:59+0000 lvl=info msg="HTTP Server Listen" logger=http.server address=0.0.0.0:3000 protocol=http subUrl= socket= database_1 | 2019-10-06 15:47:00.235 UTC [28] LOG: incomplete startup packet teslamate_1 | 15:47:04.377 [info] Already up teslamate_1 | 15:47:15.228 [info] Running TeslaMateWeb.Endpoint with cowboy 2.6.3 at :::4000 (http) teslamate_1 | 15:47:15.237 [info] Access TeslaMateWeb.Endpoint at http://teslamate.url.com teslamate_1 | 15:47:16.134 [info] Found 'TESLAX' mosquitto_1 | 1570376836: New connection from 172.19.0.6 on port 1883. mosquitto_1 | 1570376836: New client connected from 172.19.0.6 as TESLAMATE_302E3939393 (p2, c1, k60). teslamate_1 | 15:47:16.150 [info] Initializing handler teslamate_1 | 15:47:16.152 [info] Connection has been established teslamate_1 | 15:47:17.705 car_id=1 [info] Start / :online teslamate_1 | 15:47:17.760 [info] Querying location for elevation takes longer than 50ms ... database_1 | 2019-10-06 15:47:27.448 UTC [36] ERROR: type "earth" does not exist at character 136 database_1 | 2019-10-06 15:47:27.448 UTC [36] QUERY: SELECT cube(cube(cube(earth()*cos(radians($1))*cos(radians($2))),earth()*cos(radians($1))*sin(radians($2))),earth()*sin(radians($1)))::earth database_1 | 2019-10-06 15:47:27.448 UTC [36] CONTEXT: SQL function "ll_to_earth" during inlining database_1 | automatic analyze of table "teslamate.public.positions" teslamate_1 | 15:47:42.968 [error] TeslaApi.Error / 504 – %{"error" => "upstream_timeout", "error_description" => "", "response" => nil} teslamate_1 | 15:47:42.968 car_id=1 [warn] Error / upstream timeout teslamate_1 | 15:47:58.163 [error] TeslaApi.Error / 504 – %{"error" => "upstream_timeout", "error_description" => "", "response" => nil} teslamate_1 | 15:47:58.164 car_id=1 [warn] Error / upstream timeout database_1 | 2019-10-06 15:48:27.470 UTC [38] ERROR: type "earth" does not exist at character 136 database_1 | 2019-10-06 15:48:27.470 UTC [38] QUERY: SELECT cube(cube(cube(earth()*cos(radians($1))*cos(radians($2))),earth()*cos(radians($1))*sin(radians($2))),earth()*sin(radians($1)))::earth database_1 | 2019-10-06 15:48:27.470 UTC [38] CONTEXT: SQL function "ll_to_earth" during inlining database_1 | automatic analyze of table "teslamate.public.positions" database_1 | 2019-10-06 15:49:27.582 UTC [40] ERROR: type "earth" does not exist at character 136 database_1 | 2019-10-06 15:49:27.582 UTC [40] QUERY: SELECT cube(cube(cube(earth()*cos(radians($1))*cos(radians($2))),earth()*cos(radians($1))*sin(radians($2))),earth()*sin(radians($1)))::earth database_1 | 2019-10-06 15:49:27.582 UTC [40] CONTEXT: SQL function "ll_to_earth" during inlining database_1 | automatic analyze of table "teslamate.public.positions"

But if I stop and start again, it starts without any problems. I can then stop and start again, same error messages. Not very consistent actually.

Ideas @adriankumpf ?

I can now see it's coming all the time. I just needed to wait a few minutes. (_docker-compose logs database_):

root@TeslaMate:~# docker-compose logs database Attaching to root_database_1 database_1 | 2019-10-06 16:07:28.050 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432 database_1 | 2019-10-06 16:07:28.050 UTC [1] LOG: listening on IPv6 address "::", port 5432 database_1 | 2019-10-06 16:07:28.057 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432" database_1 | 2019-10-06 16:07:28.161 UTC [21] LOG: database system was shut down at 2019-10-06 16:07:13 UTC database_1 | 2019-10-06 16:07:28.170 UTC [1] LOG: database system is ready to accept connections database_1 | 2019-10-06 16:07:31.566 UTC [28] LOG: incomplete startup packet database_1 | 2019-10-06 16:07:58.280 UTC [36] ERROR: type "earth" does not exist at character 136 database_1 | 2019-10-06 16:07:58.280 UTC [36] QUERY: SELECT cube(cube(cube(earth()*cos(radians($1))*cos(radians($2))),earth()*cos(radians($1))*sin(radians($2))),earth()*sin(radians($1)))::earth database_1 | 2019-10-06 16:07:58.280 UTC [36] CONTEXT: SQL function "ll_to_earth" during inlining database_1 | automatic analyze of table "teslamate.public.positions" database_1 | 2019-10-06 16:08:58.291 UTC [38] ERROR: type "earth" does not exist at character 136 database_1 | 2019-10-06 16:08:58.291 UTC [38] QUERY: SELECT cube(cube(cube(earth()*cos(radians($1))*cos(radians($2))),earth()*cos(radians($1))*sin(radians($2))),earth()*sin(radians($1)))::earth database_1 | 2019-10-06 16:08:58.291 UTC [38] CONTEXT: SQL function "ll_to_earth" during inlining database_1 | automatic analyze of table "teslamate.public.positions"

Also see a few of these in the TeslaMate logs (_docker-compose logs teslamate_):

teslamate_1 | 16:07:48.386 [info] Initializing handler teslamate_1 | 16:07:48.388 [info] Connection has been established teslamate_1 | 16:07:49.158 car_id=1 [info] Start / :online teslamate_1 | 16:07:49.213 [info] Querying location for elevation takes longer than 50ms ... teslamate_1 | 16:10:08.311 [error] TeslaApi.Error / 504 – %{"error" => "upstream_timeout", "error_description" => "", "response" => nil} teslamate_1 | 16:10:08.311 car_id=1 [warn] Error / upstream timeout teslamate_1 | 16:10:39.626 [error] TeslaApi.Error / 504 – %{"error" => "upstream_timeout", "error_description" => "", "response" => nil} teslamate_1 | 16:10:39.626 car_id=1 [warn] Error / upstream timeout teslamate_1 | 16:11:10.808 [error] TeslaApi.Error / 504 – %{"error" => "upstream_timeout", "error_description" => "", "response" => nil} teslamate_1 | 16:11:10.808 car_id=1 [warn] Error / upstream timeout teslamate_1 | 16:11:26.126 [error] TeslaApi.Error / 504 – %{"error" => "upstream_timeout", "error_description" => "", "response" => nil} teslamate_1 | 16:11:26.126 car_id=1 [warn] Error / upstream timeout

I also started seeing these - I don't know what it breaks (if anything).

But here are what I am seeing:

2019-10-08 16:57:48.549 UTC [38] ERROR:  type "earth" does not exist at character 136,
    automatic analyze of table "teslamate.public.positions",
2019-10-08 17:04:48.750 UTC [52] CONTEXT:  SQL function "ll_to_earth" during inlining,
2019-10-08 17:04:48.750 UTC [52] QUERY:  SELECT cube(cube(cube(earth()*cos(radians($1))*cos(radians($2))),earth()*cos(radians($1))*sin(radians($2))),earth()*sin(radians($1)))::earth,
2019-10-08 17:04:48.750 UTC [52] ERROR:  type "earth" does not exist at character 136,
2019-10-08 17:03:48.737 UTC [50] CONTEXT:  SQL function "ll_to_earth" during inlining,
2019-10-08 17:03:48.737 UTC [50] QUERY:  SELECT cube(cube(cube(earth()*cos(radians($1))*cos(radians($2))),earth()*cos(radians($1))*sin(radians($2))),earth()*sin(radians($1)))::earth,
2019-10-08 17:03:48.737 UTC [50] ERROR:  type "earth" does not exist at character 136,
2019-10-08 17:02:48.707 UTC [48] CONTEXT:  SQL function "ll_to_earth" during inlining,
2019-10-08 17:02:48.707 UTC [48] QUERY:  SELECT cube(cube(cube(earth()*cos(radians($1))*cos(radians($2))),earth()*cos(radians($1))*sin(radians($2))),earth()*sin(radians($1)))::earth,
2019-10-08 17:02:48.707 UTC [48] ERROR:  type "earth" does not exist at character 136,
2019-10-08 17:01:48.678 UTC [46] CONTEXT:  SQL function "ll_to_earth" during inlining,
2019-10-08 17:01:48.678 UTC [46] QUERY:  SELECT cube(cube(cube(earth()*cos(radians($1))*cos(radians($2))),earth()*cos(radians($1))*sin(radians($2))),earth()*sin(radians($1)))::earth,
2019-10-08 17:01:48.678 UTC [46] ERROR:  type "earth" does not exist at character 136,
2019-10-08 17:00:48.648 UTC [44] CONTEXT:  SQL function "ll_to_earth" during inlining,
2019-10-08 17:00:48.648 UTC [44] QUERY:  SELECT cube(cube(cube(earth()*cos(radians($1))*cos(radians($2))),earth()*cos(radians($1))*sin(radians($2))),earth()*sin(radians($1)))::earth,
2019-10-08 17:00:48.648 UTC [44] ERROR:  type "earth" does not exist at character 136,
2019-10-08 16:59:48.619 UTC [42] CONTEXT:  SQL function "ll_to_earth" during inlining,
2019-10-08 16:59:48.619 UTC [42] QUERY:  SELECT cube(cube(cube(earth()*cos(radians($1))*cos(radians($2))),earth()*cos(radians($1))*sin(radians($2))),earth()*sin(radians($1)))::earth,
2019-10-08 16:59:48.619 UTC [42] ERROR:  type "earth" does not exist at character 136,
2019-10-08 16:58:48.589 UTC [40] CONTEXT:  SQL function "ll_to_earth" during inlining,
2019-10-08 16:58:48.589 UTC [40] QUERY:  SELECT cube(cube(cube(earth()*cos(radians($1))*cos(radians($2))),earth()*cos(radians($1))*sin(radians($2))),earth()*sin(radians($1)))::earth,
2019-10-08 16:58:48.589 UTC [40] ERROR:  type "earth" does not exist at character 136,
2019-10-08 16:57:48.549 UTC [38] CONTEXT:  SQL function "ll_to_earth" during inlining,
2019-10-08 16:57:48.549 UTC [38] QUERY:  SELECT cube(cube(cube(earth()*cos(radians($1))*cos(radians($2))),earth()*cos(radians($1))*sin(radians($2))),earth()*sin(radians($1)))::earth

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bahree picture bahree  Â·  5Comments

phantom1584 picture phantom1584  Â·  4Comments

virtualm2000 picture virtualm2000  Â·  4Comments

natrlhy picture natrlhy  Â·  6Comments

bastrik picture bastrik  Â·  3Comments