{"action":"created","issue":{"url":"https://api.github.com/repos/senecajs/seneca/issues/400","repository_url":"https://api.github.com/repos/senecajs/seneca","labels_url":"https://api.github.com/repos/senecajs/seneca/issues/400/labels{/name}","comments_url":"https://api.github.com/repos/senecajs/seneca/issues/400/comments","events_url":"https://api.github.com/repos/senecajs/seneca/issues/400/events","html_url":"https://github.com/senecajs/seneca/issues/400","id":149496925,"number":400,"title":"seneca.use internal timeouts and high cpu and memory usage","user":{"login":"pibi","id":191260,"avatar_url":"https://avatars.githubusercontent.com/u/191260?v=3","gravatar_id":"","url":"https://api.github.com/users/pibi","html_url":"https://github.com/pibi","followers_url":"https://api.github.com/users/pibi/followers","following_url":"https://api.github.com/users/pibi/following{/other_user}","gists_url":"https://api.github.com/users/pibi/gists{/gist_id}","starred_url":"https://api.github.com/users/pibi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pibi/subscriptions","organizations_url":"https://api.github.com/users/pibi/orgs","repos_url":"https://api.github.com/users/pibi/repos","events_url":"https://api.github.com/users/pibi/events{/privacy}","received_events_url":"https://api.github.com/users/pibi/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/senecajs/seneca/labels/investigate","name":"investigate","color":"f7c6c7"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2016-04-19T15:32:11Z","updated_at":"2016-05-08T22:26:40Z","closed_at":null,"body":"Hello\r\nI'm opening this issue after a discussion on gitter. \r\nMy problem: I'm working on a API server with many APIs grouped by roles. These API are exposed from an API-gateway and every role matches a microservice. \r\nA single API is quite simple: an HAPI route that acts the related role and command, packed in a seneca plugin.\r\nAPIs plugins are located in a folder, on startup a loader plugin reads all the modules and loads every single plugin right from this folder.\r\nSame pattern is used on the microservices to load actions.\r\n\r\nWe are experiencing random timeout errors on startup whenever the API-gateway tries to load more than 2 plugins. With 3/4 plugins sometimes seneca still fires the ready callback and everything work as expected With 5 or more plugins it simply doesn't work. \r\n\r\nLoader seems to work smoothly on the microservice side, no matter how many action files we are using.\r\n\r\nHere the complete error message and program usage:\r\nhttps://gist.github.com/pibi/c53dfdb1d5196cd9d2fde6d69a9b2669\r\nHere a barebone repo I built to reproduce the issue:\r\nhttps://github.com/pibi/senecatest\r\n\r\nTo reproduce the error, simply start the API-gateway:\r\n```\r\nnpm install\r\n\r\nnode api-gateway/api-gateway.js\r\n```\r\n\r\nThe repo uses 3 plugins, if it works, please retry by cloning the api-gateway/api/dw.js file, rename it and change the SRV_NAME variable.\r\n\r\nthanks to @mcdonnelldean and @jreeter I already tried some workaround, with no success:\r\n\r\n- using require on seneca.use(): from `seneca.use(\"filename.js\")` to `seneca.use(require(\"filename.js\"))`\r\n- disabling beanstalkd transport\r\n\r\nThank you very much for your support"},"comment":{"url":"https://api.github.com/repos/senecajs/seneca/issues/comments/217750015","html_url":"https://github.com/senecajs/seneca/issues/400#issuecomment-217750015","issue_url":"https://api.github.com/repos/senecajs/seneca/issues/400","id":217750015,"user":{"login":"rjrodger","id":138608,"avatar_url":"https://avatars.githubusercontent.com/u/138608?v=3","gravatar_id":"","url":"https://api.github.com/users/rjrodger","html_url":"https://github.com/rjrodger","followers_url":"https://api.github.com/users/rjrodger/followers","following_url":"https://api.github.com/users/rjrodger/following{/other_user}","gists_url":"https://api.github.com/users/rjrodger/gists{/gist_id}","starred_url":"https://api.github.com/users/rjrodger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rjrodger/subscriptions","organizations_url":"https://api.github.com/users/rjrodger/orgs","repos_url":"https://api.github.com/users/rjrodger/repos","events_url":"https://api.github.com/users/rjrodger/events{/privacy}","received_events_url":"https://api.github.com/users/rjrodger/received_events","type":"User","site_admin":false},"created_at":"2016-05-08T22:26:40Z","updated_at":"2016-05-08T22:26:40Z","body":"@pibi it would still be helpful to understand why you are loading plugins this way\r\nTo fully exclude this as an issue, I would modify your test case to load the plugins directly using seneca.use, and see how that affects things\r\n"}}