{"action":"created","issue":{"url":"https://api.github.com/repos/vapor/redis/issues/112","repository_url":"https://api.github.com/repos/vapor/redis","labels_url":"https://api.github.com/repos/vapor/redis/issues/112/labels{/name}","comments_url":"https://api.github.com/repos/vapor/redis/issues/112/comments","events_url":"https://api.github.com/repos/vapor/redis/issues/112/events","html_url":"https://github.com/vapor/redis/issues/112","id":326865605,"number":112,"title":"Consistent crashes under heavy load","user":{"login":"Cellane","id":171604,"avatar_url":"https://avatars0.githubusercontent.com/u/171604?v=4","gravatar_id":"","url":"https://api.github.com/users/Cellane","html_url":"https://github.com/Cellane","followers_url":"https://api.github.com/users/Cellane/followers","following_url":"https://api.github.com/users/Cellane/following{/other_user}","gists_url":"https://api.github.com/users/Cellane/gists{/gist_id}","starred_url":"https://api.github.com/users/Cellane/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Cellane/subscriptions","organizations_url":"https://api.github.com/users/Cellane/orgs","repos_url":"https://api.github.com/users/Cellane/repos","events_url":"https://api.github.com/users/Cellane/events{/privacy}","received_events_url":"https://api.github.com/users/Cellane/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-05-28T00:42:17Z","updated_at":"2018-05-28T13:46:50Z","closed_at":null,"author_association":"NONE","body":"The code below causes Vapor consistently with an error message of `NIO-ELT-#3 (6): Assertion failed: illegal state: active: false, registered: true` after about 6-7 seconds of running the `wrk -t 8 -c 256 -d 30 http://localhost:8080/todos/latest` command. When calling the method manually, all seems to be working fine and behaves as expected, it’s only crashing under heavy load. According to a short discussion on Vapor Discord, the code itself should hopefully be fine, so I assume the issue is somewhere in Redis implementation.\r\n\r\n```swift\r\nfunc latest(_ req: Request) throws -> Future<Todo> {\r\n    let redis = try req.make(RedisDatabase.self)\r\n\r\n    return redis.newConnection(on: req).flatMap { client in\r\n        return client\r\n            .jsonGet(TodoRedisKeys.latest.rawValue, as: Todo.self)\r\n            .unwrap(or: Abort(.notFound))\r\n            .catchFlatMap { _ in\r\n                return try Todo\r\n                    .query(on: req)\r\n                    .sort(\\.id, .descending)\r\n                    .first()\r\n                    .unwrap(or: Abort(.notFound))\r\n            }\r\n    }\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/vapor/redis/issues/comments/392531476","html_url":"https://github.com/vapor/redis/issues/112#issuecomment-392531476","issue_url":"https://api.github.com/repos/vapor/redis/issues/112","id":392531476,"user":{"login":"pedantix","id":4356070,"avatar_url":"https://avatars2.githubusercontent.com/u/4356070?v=4","gravatar_id":"","url":"https://api.github.com/users/pedantix","html_url":"https://github.com/pedantix","followers_url":"https://api.github.com/users/pedantix/followers","following_url":"https://api.github.com/users/pedantix/following{/other_user}","gists_url":"https://api.github.com/users/pedantix/gists{/gist_id}","starred_url":"https://api.github.com/users/pedantix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pedantix/subscriptions","organizations_url":"https://api.github.com/users/pedantix/orgs","repos_url":"https://api.github.com/users/pedantix/repos","events_url":"https://api.github.com/users/pedantix/events{/privacy}","received_events_url":"https://api.github.com/users/pedantix/received_events","type":"User","site_admin":false},"created_at":"2018-05-28T13:46:50Z","updated_at":"2018-05-28T13:46:50Z","author_association":"MEMBER","body":"Documentation is still an in-progress thing. Thanks for being an early adopter!"}}
{"actor":{"display_login":"pedantix"}}