Summary: | ASTERISK-18879: Memory leak inside cel_pgsql | ||||
Reporter: | Nicolas Bouliane (acidfu) | Labels: | |||
Date Opened: | 2011-11-17 14:38:19.000-0600 | Date Closed: | 2011-12-22 16:33:15.000-0600 | ||
Priority: | Major | Regression? | |||
Status: | Closed/Complete | Components: | CEL/cel_pgsql | ||
Versions: | 1.8.7.1 | Frequency of Occurrence | Constant | ||
Related Issues: |
| ||||
Environment: | Attachments: | ||||
Description: | We ran sipp for a couple of hours and we then realized that the memory usage was about 1GB after ~190k calls. The problem seems to come from this piece of code: {code} [...] result = PQexec(conn, ast_str_buffer(sql)); if (PQresultStatus(result) != PGRES_COMMAND_OK) { pgerror = PQresultErrorMessage(result); ast_log(LOG_ERROR, "Failed to insert call detail record into database!\n"); ast_log(LOG_ERROR, "Reason: %s\n", pgerror); ast_log(LOG_ERROR, "Connection may have been lost... attempting to reconnect.\n"); PQreset(conn); if (PQstatus(conn) == CONNECTION_OK) { ast_log(LOG_ERROR, "Connection reestablished.\n"); connected = 1; PQclear(result); result = PQexec(conn, ast_str_buffer(sql)); if (PQresultStatus(result) != PGRES_COMMAND_OK) { pgerror = PQresultErrorMessage(result); ast_log(LOG_ERROR, "HARD ERROR! Attempted reconnection failed. DROPPING CALL RECORD!\n"); ast_log(LOG_ERROR, "Reason: %s\n", pgerror); } } ast_mutex_unlock(&pgsql_lock); PQclear(result); ast_free(sql); ast_free(sql2); return; } ast_mutex_unlock(&pgsql_lock); } } {code} The memory is freed ONLY when (PQresultStatus(result) != PGRES_COMMAND_OK) is true. | ||||
Comments: |