{ "id": "174168", "key": "DAEMON-285", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "12519", "key": "DAEMON", "name": "Appcelerator Daemon" }, "fixVersions": [ { "id": "20870", "description": "", "name": "Appc Daemon 3.1.0", "archived": false, "released": true, "releaseDate": "2019-11-07" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2019-09-24T15:04:24.000+0000", "created": "2019-09-24T10:18:38.000+0000", "priority": { "name": "None", "id": "6" }, "labels": [], "versions": [ { "id": "20826", "description": "", "name": "Appc Daemon 3.0.0", "archived": false, "released": true, "releaseDate": "2019-08-13" } ], "issuelinks": [], "assignee": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "updated": "2019-09-24T15:04:32.000+0000", "status": { "description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.", "name": "Resolved", "id": "5", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "15614", "name": "appcd-plugin" } ], "description": "Canceling a subscription to a service dispatcher in external plugins won't properly trigger the cleanup logic since the plugin isn't notified about the end of response stream like it is happening in internal plugins.\r\n\r\n*Steps to reproduce the behavior*\r\n# Open a subscription to any internal plugin, e.g. {{appcd exec /appcd/status/system/memory --subscribe}}, and then cancel the subscription by CTRL+C\r\n# Notice that the subscription will be properly cleaned up as indicated by the following logs:\r\n{code}\r\n2019-09-24T10:15:47.154Z appcd:http:webserver 127.0.0.1:59795 disconnected\r\n2019-09-24T10:15:47.155Z appcd:http:webserver 127.0.0.1:59795 closed WebSocket\r\n2019-09-24T10:15:47.155Z appcd:service-dispatcher cleanup\r\n2019-09-24T10:15:47.155Z appcd:service-dispatcher Stream ended, cleaning up\r\n2019-09-24T10:15:47.155Z appcd:service-dispatcher [782e2d4a-b194-4f9a-806f-9b3cfc47b2f3] Unsubscribing: system.memory\r\n2019-09-24T10:15:47.155Z appcd:service-dispatcher [782e2d4a-b194-4f9a-806f-9b3cfc47b2f3] No more listeners, removing descriptor: system.memory\r\n2019-09-24T10:15:47.156Z appcd:service-dispatcher [782e2d4a-b194-4f9a-806f-9b3cfc47b2f3] Calling service's destroySubscription(): system.memory\r\n2019-09-24T10:15:47.156Z appcd:data-service-dispatcher Removing gawk watch\r\n2019-09-24T10:15:47.156Z appcd:core:websocket-session stream ended\r\n2019-09-24T10:15:47.157Z appcd:core:websocket-session [0] 127.0.0.1:59795 [finish] /appcd/status/system/memory 200 2874ms\r\n{code}\r\n# Now, do the same for an external plugin, e.g. run {{appcd exec /titanium/latest/sdk --subscribe}} and then cancel the subscription by CTRL+C\r\n# No subscription cleanup is done as you can see in the following logs\r\n{code}\r\n2019-09-24T10:10:04.797Z appcd:http:webserver 127.0.0.1:59613 disconnected\r\n2019-09-24T10:10:04.797Z appcd:http:webserver 127.0.0.1:59613 closed WebSocket\r\n2019-09-24T10:10:04.798Z appcd:core:websocket-session stream ended\r\n2019-09-24T10:10:04.798Z appcd:core:websocket-session [0] 127.0.0.1:59613 [finish] /titanium/latest/sdk 200 7006ms\r\n{code}\r\n\r\n*Actual behavior*\r\nSubscriptions in external plugins are not properly cleaned up and a service dispatchers {{onUnsubscribe}} and {{destroySubscription}} are not being called.\r\n\r\n*Expected behavior*\r\nA subscriptions cleanup logic is properly being executed for external plugins.", "attachment": [], "flagged": false, "summary": "Unsubscribe in external plugin service dispatcher not called when forcefully closing connection", "creator": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "environment": null, "closedSprints": [ { "id": 1165, "state": "closed", "name": "2019 Sprint 20", "startDate": "2019-09-23T15:38:43.949Z", "endDate": "2019-10-06T15:38:00.000Z", "completeDate": "2019-10-07T18:33:11.953Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "451600", "author": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "body": "PR: https://github.com/appcelerator/appc-daemon/pull/431", "updateAuthor": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "created": "2019-09-24T11:03:49.000+0000", "updated": "2019-09-24T11:03:49.000+0000" } ], "maxResults": 1, "total": 1, "startAt": 0 } } }