{"action":"created","issue":{"url":"https://api.github.com/repos/killbill/killbill-admin-ui/issues/49","labels_url":"https://api.github.com/repos/killbill/killbill-admin-ui/issues/49/labels{/name}","comments_url":"https://api.github.com/repos/killbill/killbill-admin-ui/issues/49/comments","events_url":"https://api.github.com/repos/killbill/killbill-admin-ui/issues/49/events","html_url":"https://github.com/killbill/killbill-admin-ui/issues/49","id":107298051,"number":49,"title":"run_in_parallel can lead to infinite loop of calls","user":{"login":"sbrossie","id":246910,"avatar_url":"https://avatars.githubusercontent.com/u/246910?v=3","gravatar_id":"","url":"https://api.github.com/users/sbrossie","html_url":"https://github.com/sbrossie","followers_url":"https://api.github.com/users/sbrossie/followers","following_url":"https://api.github.com/users/sbrossie/following{/other_user}","gists_url":"https://api.github.com/users/sbrossie/gists{/gist_id}","starred_url":"https://api.github.com/users/sbrossie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sbrossie/subscriptions","organizations_url":"https://api.github.com/users/sbrossie/orgs","repos_url":"https://api.github.com/users/sbrossie/repos","events_url":"https://api.github.com/users/sbrossie/events{/privacy}","received_events_url":"https://api.github.com/users/sbrossie/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-09-19T00:10:25Z","updated_at":"2015-09-19T14:25:14Z","closed_at":null,"body":"I ran into the following use case when using the following database config:\r\n\r\n```\r\ntest:\r\n  adapter: mysql2\r\n  database: kaui_test\r\n  username: <%= ENV.fetch('MYSQL_USER', 'root') %>\r\n  password: <%= ENV.fetch('MYSQL_PASSWORD', 'root') %>\r\n  host: 127.0.0.1\r\n  port: 3306\r\n  pool: 5\r\n  timeout: 5000\r\n```\r\n\r\nWhen showing an account page, we do 5 calls in parallel (fetch_upcoming_invoice_date, fetch_overdue_state, fetch_account_tags, fetch_account_emails, fetch_payment_methods), and somehow once of the task end up with an exception `#<ActiveRecord::ConnectionTimeoutError: could not obtain a database connection within 5.000 seconds (waited 5.001 seconds)>`\r\n\r\n*There is a question already here on why we end up with a 5 sec timeout, but this is not the point of this bug*\r\n\r\nThe point of this bug is that because of the exception, all 5 tasks get restarted forever and we have an infinite loop of requests.\r\n"},"comment":{"url":"https://api.github.com/repos/killbill/killbill-admin-ui/issues/comments/141673205","html_url":"https://github.com/killbill/killbill-admin-ui/issues/49#issuecomment-141673205","issue_url":"https://api.github.com/repos/killbill/killbill-admin-ui/issues/49","id":141673205,"user":{"login":"pierre","id":51940,"avatar_url":"https://avatars.githubusercontent.com/u/51940?v=3","gravatar_id":"","url":"https://api.github.com/users/pierre","html_url":"https://github.com/pierre","followers_url":"https://api.github.com/users/pierre/followers","following_url":"https://api.github.com/users/pierre/following{/other_user}","gists_url":"https://api.github.com/users/pierre/gists{/gist_id}","starred_url":"https://api.github.com/users/pierre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pierre/subscriptions","organizations_url":"https://api.github.com/users/pierre/orgs","repos_url":"https://api.github.com/users/pierre/repos","events_url":"https://api.github.com/users/pierre/events{/privacy}","received_events_url":"https://api.github.com/users/pierre/received_events","type":"User","site_admin":false},"created_at":"2015-09-19T14:25:14Z","updated_at":"2015-09-19T14:25:14Z","body":"We should probably make sure in `perform_redirect_after_error` (https://github.com/killbill/killbill-admin-ui/blob/redesign/app/controllers/kaui/engine_controller.rb#L77-L840) not to redirect to the account page if the error is thrown from the account page (i.e. have `try_to_redirect_to_account_path` set to false)."}}