Summary: | ASTERISK-27021: GET /recordings/stored returns 500 Internal Server Error | ||
Reporter: | Tim Morgan (morganuci) | Labels: | |
Date Opened: | 2017-05-28 17:34:01 | Date Closed: | 2017-06-01 10:49:26 |
Priority: | Critical | Regression? | No |
Status: | Closed/Complete | Components: | Resources/res_ari_recordings |
Versions: | 14.4.0 | Frequency of Occurrence | Constant |
Related Issues: | |||
Environment: | Asterisk 14.4, Centos 7 | Attachments: | |
Description: | Performing a GET on /recordings/stored fails, returning HTTP error code 500, Internal Server Error.
I determined that the problem is with this line: {noformat} if (ast_asprintf(&filepath, "%s/%s", dir_name, filename) ) { return -1; } {noformat} in res/stasis_recording/stored.c, handle_scan_file(). Because ast_asprintf() returns a positive value when it is successful, this test incorrectly causes handle_scan_file to return -1. I suspect it also causes a memory leak, since ast_asprintf() has successfully allocated some memory but it's believed to have failed. After changing the test to: {noformat} if (ast_asprintf(&filepath, "%s/%s", dir_name, filename) < 0) { {noformat} then "GET /recordings/stored" worked for me. I haven't tried this GET operation with earlier versions, so I don't know when the problem was introduced. | ||
Comments: | By: Asterisk Team (asteriskteam) 2017-05-28 17:34:03.093-0500 Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution. A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report. Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process]. By: Sean Bright (seanbright) 2017-06-01 08:02:28.217-0500 Proposed patch is [here|https://gerrit.asterisk.org/#/c/5739]. By: Friendly Automation (friendly-automation) 2017-06-01 10:49:27.247-0500 Change 5739 merged by Jenkins2: stasis_recording: Correct ast_asprintf error checking [https://gerrit.asterisk.org/5739|https://gerrit.asterisk.org/5739] By: Friendly Automation (friendly-automation) 2017-06-01 10:59:04.003-0500 Change 5740 merged by Jenkins2: stasis_recording: Correct ast_asprintf error checking [https://gerrit.asterisk.org/5740|https://gerrit.asterisk.org/5740] By: Friendly Automation (friendly-automation) 2017-06-01 11:07:49.209-0500 Change 5741 merged by Jenkins2: stasis_recording: Correct ast_asprintf error checking [https://gerrit.asterisk.org/5741|https://gerrit.asterisk.org/5741] |