resgateio/resgate

Access timeout error stored

Closed this issue · 1 comments

Issue

If an access request returns an error other than system.accessDenied, such as system.timeout, the error will be stored in Resgate memory and used to deny access for any subsequent request.

Solution

Only system.accessDenied should be considered a valid error response. All other error responses should be seen as temporary, and should not be persisted.

Recreating the issue

  1. Start book-collection example service
  2. Load example client
  3. Stop example service
  4. Edit a book entry and click OK
  5. After a Timeout error, start service
  6. Edit the same book entry and click OK
  7. Error is still Timeout

Log

$ resgate --config=config.debug.json
08:12:02 [Main] Starting server
08:12:02 [Main] Connecting to messaging system
08:12:02 [Main] Starting HTTP server
08:12:02 [Main] Listening on http://0.0.0.0:8080
08:12:15 [bia8ljt8smghgb2g5ol0] Connected
08:12:15 [bia8ljt8smghgb2g5ol0] --> {"id":1,"method":"subscribe.library.books"}
08:12:15 [NATS] <== access.library.books: {"token":null,"cid":"bia8ljt8smghgb2g5ol0"}
08:12:15 [NATS] <== get.library.books: {}
08:12:15 [NATS] ==> _INBOX.cerdnYTSkhu6JlTQDbK56F: {"result":{"get":true,"call":"*"}}
08:12:15 [NATS] ==> _INBOX.cerdnYTSkhu6JlTQDbK5B0: {"result":{"collection":[{"rid":"library.book.1"},{"rid":"library.book.2"},{"rid":"library.book.3"}]}}
08:12:15 [NATS] <== get.library.book.3: {}
08:12:15 [NATS] <== get.library.book.2: {}
08:12:15 [NATS] <== get.library.book.1: {}
08:12:15 [NATS] ==> _INBOX.cerdnYTSkhu6JlTQDbK5PH: {"result":{"model":{"id":3,"title":"Coraline","author":"Neil Gaiman"}}}
08:12:15 [NATS] ==> _INBOX.cerdnYTSkhu6JlTQDbK5Fl: {"result":{"model":{"id":2,"title":"Brave New World","author":"Aldous Huxley"}}}
08:12:15 [NATS] ==> _INBOX.cerdnYTSkhu6JlTQDbK5KW: {"result":{"model":{"id":1,"title":"Animal Farm","author":"George Orwell"}}}
08:12:15 [bia8ljt8smghgb2g5ol0] <-- {"result":{"models":{"library.book.1":{"author":"George Orwell","id":1,"title":"Animal Farm"},"library.book.2":{"author":"Aldous Huxley","id":2,"title":"Brave New World"},"library.book.3":{"author":"Neil Gaiman","id":3,"title":"Coraline"}},"collections":{"library.books":[{"rid":"library.book.1"},{"rid":"library.book.2"},{"rid":"library.book.3"}]}},"id":1}
08:12:30 [bia8ljt8smghgb2g5ol0] --> {"id":2,"method":"call.library.book.1.set","params":{"title":"Animal Farming","author":"George Orwell"}}
08:12:30 [NATS] <== access.library.book.1: {"token":null,"cid":"bia8ljt8smghgb2g5ol0"}
08:12:32 [NATS] x=> Request timeout
08:12:32 [bia8ljt8smghgb2g5ol0] <-- {"error":{"code":"system.timeout","message":"Request timeout"},"id":2}
08:12:37 [NATS] ==> system.reset: {"resources":["library.>"]}
08:12:37 [NATS] <== get.library.book.3: {}
08:12:37 [NATS] <== get.library.book.1: {}
08:12:37 [NATS] <== get.library.books: {}
08:12:37 [NATS] <== get.library.book.2: {}
08:12:37 [NATS] ==> _INBOX.cerdnYTSkhu6JlTQDbK5Yn: {"result":{"model":{"id":3,"title":"Coraline","author":"Neil Gaiman"}}}
08:12:37 [NATS] ==> _INBOX.cerdnYTSkhu6JlTQDbK5dY: {"result":{"model":{"id":1,"title":"Animal Farm","author":"George Orwell"}}}
08:12:37 [NATS] ==> _INBOX.cerdnYTSkhu6JlTQDbK5iJ: {"result":{"collection":[{"rid":"library.book.1"},{"rid":"library.book.2"},{"rid":"library.book.3"}]}}
08:12:37 [NATS] ==> _INBOX.cerdnYTSkhu6JlTQDbK5n4: {"result":{"model":{"id":2,"title":"Brave New World","author":"Aldous Huxley"}}}
08:12:42 [bia8ljt8smghgb2g5ol0] --> {"id":3,"method":"call.library.book.1.set","params":{"title":"Animal Farming","author":"George Orwell"}}
08:12:42 [bia8ljt8smghgb2g5ol0] <-- {"error":{"code":"system.timeout","message":"Request timeout"},"id":3}
08:12:46 [Main] Stopping server...
08:12:46 [Main] Disconnecting all ws connections...
08:12:46 [bia8ljt8smghgb2g5ol0] Disconnecting - Server is shutting down
08:12:46 [bia8ljt8smghgb2g5ol0] Disconnected: read tcp [::1]:8080->[::1]:54711: use of closed network connection
08:12:46 [Main] All ws connections gracefully closed
08:12:46 [Main] Stopping HTTP server...
08:12:46 [Main] HTTP server gracefully stopped
08:12:46 [Main] Closing the messaging system's client connection...
08:12:46 [Main] Message queue connection closed
08:12:46 [Main] http: Server closed
08:12:46 [Main] Stopping rescache workers...
08:12:46 [Main] rescache stopped
08:12:46 [Main] Service stopped

Fixed in #73