{"action":"created","issue":{"url":"https://api.github.com/repos/aws/aws-sdk-php/issues/1080","repository_url":"https://api.github.com/repos/aws/aws-sdk-php","labels_url":"https://api.github.com/repos/aws/aws-sdk-php/issues/1080/labels{/name}","comments_url":"https://api.github.com/repos/aws/aws-sdk-php/issues/1080/comments","events_url":"https://api.github.com/repos/aws/aws-sdk-php/issues/1080/events","html_url":"https://github.com/aws/aws-sdk-php/issues/1080","id":175727713,"number":1080,"title":"Unexpected consumer shutdown","user":{"login":"enVolt","id":5167147,"avatar_url":"https://avatars.githubusercontent.com/u/5167147?v=3","gravatar_id":"","url":"https://api.github.com/users/enVolt","html_url":"https://github.com/enVolt","followers_url":"https://api.github.com/users/enVolt/followers","following_url":"https://api.github.com/users/enVolt/following{/other_user}","gists_url":"https://api.github.com/users/enVolt/gists{/gist_id}","starred_url":"https://api.github.com/users/enVolt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/enVolt/subscriptions","organizations_url":"https://api.github.com/users/enVolt/orgs","repos_url":"https://api.github.com/users/enVolt/repos","events_url":"https://api.github.com/users/enVolt/events{/privacy}","received_events_url":"https://api.github.com/users/enVolt/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/aws/aws-sdk-php/labels/awaiting-reply","name":"awaiting-reply","color":"cccccc"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-09-08T11:16:36Z","updated_at":"2016-09-10T10:37:23Z","closed_at":null,"body":"In my system, an application is publishing messages to an SQS queue.\r\nI've written a consumer in PHP (Laravel Artisan command). \r\n\r\nSnippet from `handle()` function\r\n```php\r\n\t\twhile (TRUE) {\r\n\t\t\t$this->logInfo(\"Trying to get Messages\");\r\n\t\t\t$result = $client->receiveMessage([\r\n\t\t\t\t'QueueUrl'            => $queueUrl,\r\n\t\t\t\t'WaitTimeSeconds'     => 20,\r\n\t\t\t\t'MaxNumberOfMessages' => 10\r\n\t\t\t]);\r\n\r\n\t\t\tif (!$result['Messages']) {\r\n\t\t\t\t$this->logInfo(\"No Messages Received\");\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\r\n\t\t\t$this->logInfo(\"Messages Received\", $result->get(\"Messages\"));\r\n\t\t\t// Do Something with $result['Messages']\r\n\t\t}\r\n```\r\n\r\nWhere `logInfo()`  function is defined as, (JTLYK, not relevant)\r\n```php\r\n\tfunction logInfo()\r\n\t{\r\n\t\tforeach (func_get_args() as $input) {\r\n\t\t\tif (gettype($input) == \"string\") {\r\n\t\t\t\t$r[] = $input;\r\n\t\t\t} else {\r\n\t\t\t\t$r[] = json_encode($input);\r\n\t\t\t}\r\n\t\t}\r\n\t\t$string = implode($r, ', ');\r\n\t\t$this->info($string);\r\n\t\tLog::info(\"[ProcessMessaege] \" . $string);\r\n\t}\r\n```\r\n(nothing fancy, it print on stdout and Laravel log file)\r\n\r\nThis consumer is running by Supervisor to ensure that it is being executed forever.\r\n\r\nSupervisor Configuration File -\r\n```\r\n[program:processor]\r\nprocess_name=%(program_name)s_%(process_num)02d\r\ncommand=/usr/bin/php /home/user/public_html/artisan process:message\r\nautostart=true\r\nautorestart=true\r\n;user=apache\r\nnumprocs=1\r\nredirect_stderr=true\r\nstdout_logfile=/home/user/consumer.log\r\n```\r\n\r\nWhat's happening is that this consumer process it stopping unexpectedly. In `supervisorctl status`, process state is `RUNNING`. I've recently put log statement before and after (as in first Snippet), `receiveMessage` function, and I can only find `Trying to get Messages` in log files (not after receiveMessage log part). I'm relying on CloudWatch for all such alerts, that my consumer is not running properly.\r\n\r\nIs there any known issue around this (Supervisor/Infinite Loop/Laravel), or any input to improve this setup, or anything to minimize possibility of such failure.\r\n\r\nAws SDK version is 3.18.1\r\nLet me know if anything is needed for debugging purpose.\r\n"},"comment":{"url":"https://api.github.com/repos/aws/aws-sdk-php/issues/comments/246104740","html_url":"https://github.com/aws/aws-sdk-php/issues/1080#issuecomment-246104740","issue_url":"https://api.github.com/repos/aws/aws-sdk-php/issues/1080","id":246104740,"user":{"login":"enVolt","id":5167147,"avatar_url":"https://avatars.githubusercontent.com/u/5167147?v=3","gravatar_id":"","url":"https://api.github.com/users/enVolt","html_url":"https://github.com/enVolt","followers_url":"https://api.github.com/users/enVolt/followers","following_url":"https://api.github.com/users/enVolt/following{/other_user}","gists_url":"https://api.github.com/users/enVolt/gists{/gist_id}","starred_url":"https://api.github.com/users/enVolt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/enVolt/subscriptions","organizations_url":"https://api.github.com/users/enVolt/orgs","repos_url":"https://api.github.com/users/enVolt/repos","events_url":"https://api.github.com/users/enVolt/events{/privacy}","received_events_url":"https://api.github.com/users/enVolt/received_events","type":"User","site_admin":false},"created_at":"2016-09-10T10:37:23Z","updated_at":"2016-09-10T10:37:23Z","body":"Script is ending with no clue as it seems. Outside side while loop, there is again a Log statement, and script is never reaching to that point. I'll add further http debug params, and get back to you on this."}}
{"actor":{"display_login":"enVolt"}}