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

server crashing on own server install #202

Closed
mstormi opened this issue Jul 7, 2020 · 3 comments
Closed

server crashing on own server install #202

mstormi opened this issue Jul 7, 2020 · 3 comments

Comments

@mstormi
Copy link

mstormi commented Jul 7, 2020

I tried to setup an own server on Raspbian (no Docker desired) but came across a number of difficulties.
The installation instruction are pretty sparse. They neither explain the alternatives (make production ?) nor show how to use them.

  1. scipy needs to be a recent version. I've created PR make version requirements less strict for scipy to fix build #201 to fix

[ I think I now know it has to see a specific number of measurements
2) Starting in $GOPATH/src/github.com/schollz/find3/server/main, the main server sometimes creates a xxxxxx.sqlite3.db file in data/, but not always ... I only saw it with GPS on and enough samples, but I have not found out what's really needed to make it create it. ]

  1. I used http://hostname:port/ in the app (note the trailing slash) from my mobile to be in the same (WiFi) LAN and no proxy inbetween for my testing. The request shows up as
2020-07-08 12:36:42 [INFO] [PID-3137] server.go func1:1360 [2003:ea:a723:ee00:29c0:7b52:f6f3:b3c7]:57116 GET //ws?family=diestorms&device=myprism 10.945µs

Note the two leading slashes.
I think does not work - when I insert a NGINX into the path I can see that find is responding with a 404.

When I remove the trailing slash however, main crashes, giving

2020-07-08 12:44:26 [DEBUG] [PID-3245] db.go getRows:1055 getting columns
panic: interface conversion: interface {} is string, not []uint8

goroutine 44 [running]:
github.com/schollz/find3/server/main/src/database.(*Database).getRows(0x2d73ae0, 0x24a05a0, 0x24a05a0, 0x1, 0x24a05a0, 0x0, 0x0)
        /home/openhabian/go/src/github.com/schollz/find3/server/main/src/database/db.go:1097 +0xbcc
github.com/schollz/find3/server/main/src/database.(*Database).GetAllFromPreparedQuery(0x2d73ae0, 0x769b90, 0x46, 0x28a3e6c, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, ...)
        /home/openhabian/go/src/github.com/schollz/find3/server/main/src/database/db.go:1044 +0x10c
github.com/schollz/find3/server/main/src/database.(*Database).GetLatest(0x2d73ae0, 0x2d32c20, 0x7, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /home/openhabian/go/src/github.com/schollz/find3/server/main/src/database/db.go:641 +0xcc
github.com/schollz/find3/server/main/src/server.sendOutLocation(0x2d32c0f, 0x9, 0x2d32c20, 0x7, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /home/openhabian/go/src/github.com/schollz/find3/server/main/src/server/server.go:870 +0x98
created by github.com/schollz/find3/server/main/src/server.wshandler
        /home/openhabian/go/src/github.com/schollz/find3/server/main/src/server/websockets.go:66 +0x318
  1. I cannot access the dashboard. Accessing the web interface via proxy or direct results in a download file that is empty, plus the server giving an error about interface conversion (attached below).
    Seems find3 might be having trouble to convert DNS names or IP addresses ?
[12:03:04] openhabian@devpi:~/go/src/github.com/schollz/find3/server/main$ 2020-07-08 12:03:14 [INFO] [PID-1926] server.go func1:1360 [2003:ea:a723:ee00:506d:5eba:328:d20b]:58324 POST / 889.833µs
2020-07-08 12:03:14 [DEBUG] [PID-1926] db.go GetSensorFromGreaterTime:429 using minimum timestamp of 1594198750686
2020-07-08 12:03:14 [DEBUG] [PID-1926] db.go getRows:1055 getting columns
2020-07-08 12:03:14 [DEBUG] [PID-1926] db.go getRows:1062 getting sensorstringsizer
2020-07-08 12:03:14 [DEBUG] [PID-1926] db.go getRows:1079 getting locations
2020-07-08 12:03:14 [DEBUG] [PID-1926] db.go getRows:1085 got locations


2020/07/08 12:03:14 [Recovery] 2020/07/08 - 12:03:14 panic recovered:
interface conversion: interface {} is string, not []uint8
/usr/lib/go-1.11/src/runtime/panic.go:513 (0x413b7)
        gopanic: reflectcall(nil, unsafe.Pointer(d.fn), deferArgs(d), uint32(d.siz), uint32(d.siz))
/usr/lib/go-1.11/src/runtime/iface.go:248 (0x1e23b)
        panicdottypeE: panic(&TypeAssertionError{iface, have, want, ""})
/home/openhabian/go/src/github.com/schollz/find3/server/main/src/database/db.go:1097 (0x36607b)
        (*Database).getRows: deviceID := string((*arr[1].(*interface{})).([]uint8))
/home/openhabian/go/src/github.com/schollz/find3/server/main/src/database/db.go:1044 (0x3653a3)
        (*Database).GetAllFromPreparedQuery: s, err = d.getRows(rows)
/home/openhabian/go/src/github.com/schollz/find3/server/main/src/database/db.go:429 (0x3610af)
        (*Database).GetSensorFromGreaterTime: sensors, err = d.GetAllFromPreparedQuery("SELECT * FROM sensors WHERE timestamp > ? GROUP BY deviceid ORDER BY timestamp DESC", minimumTimestamp)
/home/openhabian/go/src/github.com/schollz/find3/server/main/src/server/server.go:365 (0x577ec7)
        Run.func14.1: sensors, err := d.GetSensorFromGreaterTime(millisecondsAgo)
/home/openhabian/go/src/github.com/schollz/find3/server/main/src/server/server.go:537 (0x57aa8f)
        Run.func14: }(family)
/home/openhabian/go/src/github.com/gin-gonic/gin/context.go:165 (0x55a1d7)
        (*Context).Next: c.handlers[c.index](c)
/home/openhabian/go/src/github.com/gin-contrib/gzip/handler.go:60 (0x56b753)
        (*gzipHandler).Handle: c.Next()
/home/openhabian/go/src/github.com/gin-contrib/gzip/gzip.go:17 (0x56c367)
        (*gzipHandler).Handle-fm: return newGzipHandler(level, options...).Handle
/home/openhabian/go/src/github.com/gin-gonic/gin/context.go:165 (0x55a1d7)
        (*Context).Next: c.handlers[c.index](c)
/home/openhabian/go/src/github.com/gin-gonic/gin/recovery.go:83 (0x569c8f)
        RecoveryWithWriter.func1: c.Next()
/home/openhabian/go/src/github.com/gin-gonic/gin/context.go:165 (0x55a1d7)
        (*Context).Next: c.handlers[c.index](c)
/home/openhabian/go/src/github.com/schollz/find3/server/main/src/server/server.go:1357 (0x57ee67)
        middleWareHandler.func1: c.Next()
/home/openhabian/go/src/github.com/gin-gonic/gin/context.go:165 (0x55a1d7)
        (*Context).Next: c.handlers[c.index](c)
/home/openhabian/go/src/github.com/gin-gonic/gin/gin.go:420 (0x562577)
        (*Engine).handleHTTPRequest: c.Next()
/home/openhabian/go/src/github.com/gin-gonic/gin/gin.go:376 (0x561e7b)
        (*Engine).ServeHTTP: engine.handleHTTPRequest(c)
/usr/lib/go-1.11/src/net/http/server.go:2741 (0x2714cf)
        serverHandler.ServeHTTP: handler.ServeHTTP(rw, req)
/usr/lib/go-1.11/src/net/http/server.go:1847 (0x26e003)
        (*conn).serve: serverHandler{c.server}.ServeHTTP(w, w.req)
/usr/lib/go-1.11/src/runtime/asm_arm.s:867 (0x6d9b7)
        goexit: MOVW    R0, R0  // NOP

2020-07-08 12:03:14 [INFO] [PID-1926] server.go func1:1360 [2003:ea:a723:ee00:506d:5eba:328:d20b]:58324 GET /view/dashboard/diestorms 48.26713ms
@mstormi mstormi changed the title own server install server crashing on own server install Jul 8, 2020
@schollz
Copy link
Owner

schollz commented Jul 15, 2020

What is hostname:port ?

Can you just use localIP:port?

@mstormi
Copy link
Author

mstormi commented Jul 15, 2020

What is hostname:port ?

a local DNS (resolvable) or IP, I tried both. Port is 8005 (where server is started on).
Below is the log of a fresh start, at 00:35:20 I've started learning on the app, that made it crash.
Now that I was able to reproduce it I believe it was because of file access rights to the DB files in data/*.
Deleted those and started again as root, now it's no longer crashing.

So much for that one, BUT...
... now it's running but does not generating any DB data. I see HTTP requests going only when I start/restart learning via app,
there's no data files to appear in data/*

[00:35:07] openhabian@devpi:~/go/src/github.com/schollz/find3/server/main$ ./main -debug -port 8005
2020-07-16 00:35:11 [DEBUG] [PID-14652] mode.go Run:61 current families: [diestorms]
2020-07-16 00:35:11 [INFO] [PID-14652] server.go Run:579 Running on 0.0.0.0:8005
2020-07-16 00:35:20 [INFO] [PID-14652] server.go func1:1360 192.168.178.43:56608 GET /ws?family=diestorms&device=myprism 504.071µs
2020-07-16 00:35:20 [DEBUG] [PID-14652] db.go getRows:1055 getting columns
2020-07-16 00:35:20 [DEBUG] [PID-14652] db.go getRows:1062 getting sensorstringsizer
2020-07-16 00:35:20 [DEBUG] [PID-14652] db.go getRows:1079 getting locations
2020-07-16 00:35:20 [DEBUG] [PID-14652] db.go getRows:1085 got locations
panic: interface conversion: interface {} is string, not []uint8

goroutine 51 [running]:
github.com/schollz/find3/server/main/src/database.(*Database).getRows(0x2036020, 0x2518370, 0x2518370, 0x1, 0x2518370, 0x0, 0x0)
/home/openhabian/go/src/github.com/schollz/find3/server/main/src/database/db.go:1097 +0xbcc
github.com/schollz/find3/server/main/src/database.(*Database).GetAllFromPreparedQuery(0x2036020, 0x769b90, 0x46, 0x1c41e6c, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, ...)
/home/openhabian/go/src/github.com/schollz/find3/server/main/src/database/db.go:1044 +0x10c
github.com/schollz/find3/server/main/src/database.(*Database).GetLatest(0x2036020, 0x24fcec0, 0x7, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
/home/openhabian/go/src/github.com/schollz/find3/server/main/src/database/db.go:641 +0xcc
github.com/schollz/find3/server/main/src/server.sendOutLocation(0x24fceaf, 0x9, 0x24fcec0, 0x7, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
/home/openhabian/go/src/github.com/schollz/find3/server/main/src/server/server.go:870 +0x98
created by github.com/schollz/find3/server/main/src/server.wshandler
/home/openhabian/go/src/github.com/schollz/find3/server/main/src/server/websockets.go:66 +0x318

@mstormi
Copy link
Author

mstormi commented Sep 15, 2020

fixed after reinstall although cannot tell for sure what it was

@mstormi mstormi closed this as completed Sep 15, 2020
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