Title: QueueTimer keeps Node process from terminating gracefully · Issue #42 · exceptionless/Exceptionless.JavaScript · GitHub
Open Graph Title: QueueTimer keeps Node process from terminating gracefully · Issue #42 · exceptionless/Exceptionless.JavaScript
X Title: QueueTimer keeps Node process from terminating gracefully · Issue #42 · exceptionless/Exceptionless.JavaScript
Description: var client = require('exceptionless').ExceptionlessClient.default; client.config.apiKey = "***"; client.config.useDebugLogger(); This program will run and exit as expected. No events are submitted. Console output: [info] Exceptionless: P...
Open Graph Description: var client = require('exceptionless').ExceptionlessClient.default; client.config.apiKey = "***"; client.config.useDebugLogger(); This program will run and exit as expected. No events are submitted....
X Description: var client = require('exceptionless').ExceptionlessClient.default; client.config.apiKey = "***"; client.config.useDebugLogger(); This program will run and exit as expected. No eve...
Opengraph URL: https://github.com/exceptionless/Exceptionless.JavaScript/issues/42
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"QueueTimer keeps Node process from terminating gracefully","articleBody":"``` js\nvar client = require('exceptionless').ExceptionlessClient.default;\nclient.config.apiKey = \"***\";\nclient.config.useDebugLogger();\n```\n\nThis program will run and exit as expected. No events are submitted. Console output:\n\n```\n[info] Exceptionless: Processing queue...\nfranks-macbook:Exceptionless.JavaScript Frank$ \n```\n\nWhereas, if we modify the code to submit an event:\n\n``` js\nvar client = require('exceptionless').ExceptionlessClient.default;\nclient.config.apiKey = \"***\";\nclient.config.useDebugLogger();\nclient.submitLog('Test');\n```\n\nThis program will run forever, unless you terminate it by sending SIGINT:\n\n```\n[info] Exceptionless: Enqueuing event: 1456470547394 type=log \n[info] Exceptionless: Processing queue...\n[info] Exceptionless: Sending 1 events to https://collector.exceptionless.io.\n[info] Exceptionless: Sent 1 events.\n[info] Exceptionless: Finished processing queue.\n[info] Exceptionless: Processing queue...\n[info] Exceptionless: Processing queue...\n[info] Exceptionless: Processing queue...\n```\n\nIf we `npm install wtfnode` and call `.dump()`, it clearly shows what's going on: \n\n```\n[WTF Node?] open handles:\n- Sockets:\n - undefined:undefined -\u003e undefined:undefined\n - Listeners:\n - undefined:undefined -\u003e undefined:undefined\n - Listeners:\n- Timers:\n - (10000 ~ 10 s) wrapper @ /Users/Frank/Entw..../exceptionless.node.js:242\n```\n\nFrom [Node docs](http://nodejs.org/en/about/): \n\n\u003e In Node there is no such start-the-event-loop call. Node simply enters the event loop after executing the input script. Node exits the event loop when there are no more callbacks to perform. \n\nSo, our timer is the last single callback in Node's event loop and therefore blocks it from exiting. This is probably not an issue for service-like applications, but it sucks for console tools or anything that should just exit when the work is finished.\n\nThoughts:\n- Can we use a shorter timespan for the timer in combination with a `lastEventTimestamp` field?\n- Can we leverage the same private API that `wtfnode` uses to figure out if we are the single reason that the process is still running?\n- How long do we want to wait for events to be submitted if the program has no work to do otherwise, before exiting? Should it wait forever if events cannot be submitted due to network problems? Should it make a difference between InMemory and LocalStorage?\n","author":{"url":"https://github.com/frankebersoll","@type":"Person","name":"frankebersoll"},"datePublished":"2016-02-26T07:23:17.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":8},"url":"https://github.com/42/Exceptionless.JavaScript/issues/42"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:a3c88dae-1714-0d2f-239f-4c94fe521557 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BAAC:1462F2:433641:5F5E38:697245BF |
| html-safe-nonce | f54d42dd007b054702873ece7f544f3d4248dd8fb1e5f39769cb09aaadb663e3 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQUFDOjE0NjJGMjo0MzM2NDE6NUY1RTM4OjY5NzI0NUJGIiwidmlzaXRvcl9pZCI6Ijg0NTQ2NDU4NzI3MjQxNjYwNzkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 37fbff0210ec83033cf3945b90d12acd904a1ed56254be6d307efd7b05e86b3e |
| hovercard-subject-tag | issue:136618145 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/exceptionless/Exceptionless.JavaScript/42/issue_layout |
| twitter:image | https://opengraph.githubassets.com/48e5220655a40d96e1989c0846c36f4f115719481eb7ebaed759ea0cf1e99fc2/exceptionless/Exceptionless.JavaScript/issues/42 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/48e5220655a40d96e1989c0846c36f4f115719481eb7ebaed759ea0cf1e99fc2/exceptionless/Exceptionless.JavaScript/issues/42 |
| og:image:alt | var client = require('exceptionless').ExceptionlessClient.default; client.config.apiKey = "***"; client.config.useDebugLogger(); This program will run and exit as expected. No events are submitted.... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | frankebersoll |
| hostname | github.com |
| expected-hostname | github.com |
| None | 2c16db4e575031f6e3be03e0437c1ab663e0b4643ba5cbbfba48c1e4fc056a11 |
| turbo-cache-control | no-preview |
| go-import | github.com/exceptionless/Exceptionless.JavaScript git https://github.com/exceptionless/Exceptionless.JavaScript.git |
| octolytics-dimension-user_id | 5912469 |
| octolytics-dimension-user_login | exceptionless |
| octolytics-dimension-repository_id | 29558878 |
| octolytics-dimension-repository_nwo | exceptionless/Exceptionless.JavaScript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 29558878 |
| octolytics-dimension-repository_network_root_nwo | exceptionless/Exceptionless.JavaScript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 584fea6daacd0ba6f8dbec869937910ee0ae2e64 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width