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

App doesn't delete client on logout #113

Closed
picciux opened this issue May 28, 2020 · 2 comments · Fixed by #114
Closed

App doesn't delete client on logout #113

picciux opened this issue May 28, 2020 · 2 comments · Fixed by #114

Comments

@picciux
Copy link

picciux commented May 28, 2020

Hi guys,

first of all, wonderful work!
I noticed something I suspect it's a bug: when logging out the android app, found that its client is never removed from the db, and logging in again creates a new one (as it's supposed to).
Examining the logs, I found that app correctly reports "Delete client with id xx", but in server logs I can't find the related DELETE request, so obviously client stay where it is. From WebUI it works correctly, deleting the client on logout.
Here are relevant logs extracts (please ignore date/time offset between the logs):

Android

2020-05-28T10:48:08.416Z INFO: Entering LogsActivity
2020-05-28T10:48:00.930Z INFO: Entering LoginActivity
2020-05-28T10:48:00.757Z INFO: Delete client with id 22
2020-05-28T10:48:00.740Z WARN: Destroy WebSocketService
2020-05-28T10:48:00.739Z INFO: WebSocket: closing existing connection.
2020-05-28T10:47:46.688Z INFO: Removing message with id 99
2020-05-28T10:47:39.559Z INFO: WebSocket: received message {"id":99,"appid":1,"message":"Test dalla shell 4","title":"KStars","priority":5,"date":"2020-05-28T03:42:32.188597049+02:00"}
2020-05-28T10:47:23.252Z INFO: WebSocket: opened
2020-05-28T10:47:23.245Z WARN: WebSocket: closed
2020-05-28T10:47:23.210Z INFO: WebSocket: starting...
2020-05-28T10:47:23.207Z INFO: WebSocket: closing existing connection.
2020-05-28T10:47:18.258Z INFO: Loading more messages for -1
2020-05-28T10:47:18.248Z INFO: Entering MessagesActivity
2020-05-28T10:47:18.201Z INFO: WebSocket: scheduling a restart in 5 second(s)
2020-05-28T10:47:18.201Z INFO: Network reconnected
2020-05-28T10:47:18.174Z INFO: Server version: 2.0.16@2020-05-09-16:00:37
2020-05-28T10:47:18.168Z INFO: WebSocket: opened
2020-05-28T10:47:18.157Z INFO: WebSocket: starting...
2020-05-28T10:47:18.146Z INFO: Starting WebSocketService
2020-05-28T10:47:18.144Z INFO: Create WebSocketService
2020-05-28T10:47:18.110Z INFO: Authenticated as ********
2020-05-28T10:47:18.074Z INFO: Entering InitializationActivity

Server

May 28 03:41:32 astroberry-pi4 gotify[1234]: [GIN] 2020/05/28 - 03:41:32 | 200 |     177.848µs |     10.42.0.193 | GET      "/version"
May 28 03:42:08 astroberry-pi4 gotify[1234]: [GIN] 2020/05/28 - 03:42:08 | 200 |  201.510244ms |     10.42.0.193 | GET      "/current/user"
May 28 03:42:10 astroberry-pi4 gotify[1234]: [GIN] 2020/05/28 - 03:42:10 | 200 |  200.669558ms |     10.42.0.193 | POST     "/client"
May 28 03:42:10 astroberry-pi4 gotify[1234]: [GIN] 2020/05/28 - 03:42:10 | 200 |     929.961µs |     10.42.0.193 | GET      "/current/user"
May 28 03:42:10 astroberry-pi4 gotify[1234]: [GIN] 2020/05/28 - 03:42:10 | 200 |      34.814µs |     10.42.0.193 | GET      "/version"
May 28 03:42:10 astroberry-pi4 gotify[1234]: [GIN] 2020/05/28 - 03:42:10 | 200 |    1.018589ms |     10.42.0.193 | GET      "/message?limit=1&since=0"
May 28 03:42:10 astroberry-pi4 gotify[1234]: [GIN] 2020/05/28 - 03:42:10 | 200 |     876.332µs |     10.42.0.193 | GET      "/stream?token=C1KTZt2qKtBY6Di"
May 28 03:42:10 astroberry-pi4 gotify[1234]: [GIN] 2020/05/28 - 03:42:10 | 200 |    1.223233ms |     10.42.0.193 | GET      "/message?limit=100&since=0"
May 28 03:42:10 astroberry-pi4 gotify[1234]: [GIN] 2020/05/28 - 03:42:10 | 200 |    3.430999ms |     10.42.0.193 | GET      "/application"
May 28 03:42:11 astroberry-pi4 gotify[1234]: [GIN] 2020/05/28 - 03:42:11 | 304 |     173.978µs |     10.42.0.193 | GET      "/image/uVJ32bfGoQkCsXoqL4jFfyT_j.png"
May 28 03:42:11 astroberry-pi4 gotify[1234]: [GIN] 2020/05/28 - 03:42:11 | 304 |     317.734µs |     10.42.0.193 | GET      "/image/3AHOkQEm4hgS.mSCB.SXqcTBk.png"
May 28 03:42:11 astroberry-pi4 gotify[1234]: [GIN] 2020/05/28 - 03:42:11 | 304 |     216.384µs |     10.42.0.193 | GET      "/image/yl_cMP-A7j6zld_mmvvmWSPFX.png"
May 28 03:42:11 astroberry-pi4 gotify[1234]: [GIN] 2020/05/28 - 03:42:11 | 304 |     167.071µs |     10.42.0.193 | GET      "/image/DOIB6FdlzPGTDg3-bBsRv-ZDp.png"
May 28 03:42:11 astroberry-pi4 gotify[1234]: [GIN] 2020/05/28 - 03:42:11 | 304 |     139.441µs |     10.42.0.193 | GET      "/image/cYAKaucudlbxQOcBF2O-MwSVb.png"
May 28 03:42:11 astroberry-pi4 gotify[1234]: [GIN] 2020/05/28 - 03:42:11 | 304 |     163.978µs |     10.42.0.193 | GET      "/image/OwHwFIfMGqYmXrY.1uvu5Vn9x.png"
May 28 03:42:11 astroberry-pi4 gotify[1234]: [GIN] 2020/05/28 - 03:42:11 | 304 |     133.127µs |     10.42.0.193 | GET      "/image/Ft9DTl1AzeaHWxBgBJSWb4kH0.png"
May 28 03:42:15 astroberry-pi4 gotify[1234]: [GIN] 2020/05/28 - 03:42:15 | 200 |    1.163011ms |     10.42.0.193 | GET      "/stream?token=C1KTZt2qKtBY6Di"
May 28 03:42:32 astroberry-pi4 gotify[1234]: [GIN] 2020/05/28 - 03:42:32 | 200 |   14.007785ms |             ::1 | POST     "/message?token=AcIfvsi.ngxtG80"
May 28 03:42:32 astroberry-pi4 gotify[1234]: [GIN] 2020/05/28 - 03:42:32 | 206 |     807.075µs |     10.42.0.114 | GET      "/static/notification.ogg"
May 28 03:42:32 astroberry-pi4 gotify[1234]: [GIN] 2020/05/28 - 03:42:32 | 200 |    1.185437ms |     10.42.0.114 | GET      "/static/favicon-196x196.png"
May 28 03:42:32 astroberry-pi4 gotify[1234]: [GIN] 2020/05/28 - 03:42:32 | 304 |     139.183µs |     10.42.0.193 | GET      "/image/yl_cMP-A7j6zld_mmvvmWSPFX.png"
May 28 03:42:39 astroberry-pi4 gotify[1234]: [GIN] 2020/05/28 - 03:42:39 | 200 |   14.781212ms |     10.42.0.193 | DELETE   "/message/99"
May 28 03:42:53 astroberry-pi4 gotify[1234]: [GIN] 2020/05/28 - 03:42:53 | 200 |     1.20364ms |     10.42.0.193 | GET      "/client"

Server is native linux deployment, tested directly and behind an nginx reverse proxy, with very same result.
Here is server config:

config.yml

server:
  listenaddr: "" # the address to bind on, leave empty to bind on all addresses
  port: 2121 # the port the HTTP server will listen on

  ssl:
    enabled: false # if https should be enabled
    redirecttohttps: true # redirect to https if site is accessed by http
    listenaddr: "" # the address to bind on, leave empty to bind on all addresses
    port: 443 # the https port
    certfile: # the cert file (leave empty when using letsencrypt)
    certkey: # the cert key (leave empty when using letsencrypt)
    letsencrypt:
      enabled: false # if the certificate should be requested from letsencrypt
      accepttos: false # if you accept the tos from letsencrypt
      cache: data/certs # the directory of the cache from letsencrypt
      hosts: # the hosts for which letsencrypt should request certificates
#      - mydomain.tld
#      - myotherdomain.tld

  responseheaders: # response headers are added to every response (default: none)
#    X-Custom-Header: "custom value"

  cors: # Sets cors headers only when needed and provides support for multiple allowed origins. Overrides Access-Control-* Headers in response headers.
    alloworigins:
#      - ".+.example.com"
#      - "otherdomain.com"
    allowmethods:
#      - "GET"
#      - "POST"
    allowheaders:
#      - "Authorization"
#      - "content-type"
  stream:
    allowedorigins: # allowed origins for websocket connections (same origin is always allowed)
#      - ".+.example.com"
#      - "otherdomain.com"

database: # for database see (configure database section)
  dialect: sqlite3
  connection: /var/lib/gotify/data/gotify.db

defaultuser: # on database creation, gotify creates an admin user
  name: admin # the username of the default user
  pass: admin # the password of the default user
passstrength: 10 # the bcrypt password strength (higher = better but also slower)
uploadedimagesdir: /var/lib/gotify/images # the directory for storing uploaded images
pluginsdir: /var/lib/gotify/plugins # the directory where plugin resides

It's me or someone experienced same behavior?
Thanks

Matteo

@jmattheis
Copy link
Member

Looks possible. In

public void doLogout(DialogInterface dialog, int which) {
setContentView(R.layout.splash);
new DeleteClientAndNavigateToLogin().execute();
finish();
}

The activity will be finished before the async task (DeleteClientAndNavigateToLogin) deletes the client. Removing the finish() may fix the problem. (finish will already be called inside the async task).

I'll have a look at it on the weekend.

@picciux
Copy link
Author

picciux commented May 31, 2020

Thanks!

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

Successfully merging a pull request may close this issue.

2 participants