pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Help needed for the resolution of memory leak
8+ messages / 2 participants
[nested] [flat]

* Help needed for the resolution of memory leak
@ 2024-01-15 17:32  Sasmit Utkarsh <utkarshsasmit@gmail.com>
  0 siblings, 1 reply; 8+ messages in thread

From: Sasmit Utkarsh @ 2024-01-15 17:32 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

Hi Team,

I am trying to test a code which basically tries to read some data from
postgresql db in a loop through a function SQL_get_tpf_rw() whose
definition and other details are shared in the attached file along with the
memory leak report resulted during testing. Could you let me know if i
missed calling  anywhere PQclear()
in SQL_get_tpf_rw() which resulted in the below .

Last few lines from the report
















*===================================================================49697==ERROR:
LeakSanitizer: detected memory leaksDirect leak of 197920 byte(s) in 1237
object(s) allocated from:    #0 0xf79e300b in __interceptor_malloc
(/nix/store/7z4l4r0kpgzvsi6zkjz52cvgb8ra06bd-gcc-12.2.0-lib/lib/libasan.so.8+0xbe00b)
  #1 0xf78dd3f3 in PQmakeEmptyPGresult
(/nix/store/y03rfw0iycp00dxcf8vrmss4nj700fia-postgresql-14.9-lib/lib/libpq.so.5+0x113f3)Indirect
leak of 2525184 byte(s) in 1233 object(s) allocated from:    #0 0xf79e300b
in __interceptor_malloc
(/nix/store/7z4l4r0kpgzvsi6zkjz52cvgb8ra06bd-gcc-12.2.0-lib/lib/libasan.so.8+0xbe00b)
  #1 0xf78dd04c in pqResultAlloc
(/nix/store/y03rfw0iycp00dxcf8vrmss4nj700fia-postgresql-14.9-lib/lib/libpq.so.5+0x1104c)Indirect
leak of 632832 byte(s) in 1236 object(s) allocated from:    #0 0xf79e300b
in __interceptor_malloc
(/nix/store/7z4l4r0kpgzvsi6zkjz52cvgb8ra06bd-gcc-12.2.0-lib/lib/libasan.so.8+0xbe00b)
  #1 0xf78dc7e0 in pqAddTuple
(/nix/store/y03rfw0iycp00dxcf8vrmss4nj700fia-postgresql-14.9-lib/lib/libpq.so.5+0x107e0)SUMMARY:
AddressSanitizer: 3355936 byte(s) leaked in 3706 allocation(s).*

Regards,
Sasmit Utkarsh
+91-7674022625

Attachments:

  LeakSanitizer report.txt (text/plain, 407.2K) download

fun_def_and_other_details.txt (text/plain, 7.2K) download /*************************************************************************** * PostgreSQL read * * select FileAddress from shc_data fs_data table * mmap_ptr becomes the pointer to the return from SELECT. * core_blk is also teh pointer to the return from SELECT * * call this routine with get_tpf_rw(), tpfasm.h has a #if to specify SQL path or FILE path ***************************************************************************/ int SQL_get_tpf_rw( int32_t fa, unsigned char **core_blk, size_t *st_size, unsigned char *bid, unsigned char *rcc, int *fd, bool hold, unsigned char **mmap_ptr) { char *p; char *c; int rc; struct stat statbuf; PGresult *res; uint32_t fa2 = htonl(fa); char *fa_val = (char *)&fa2; bool hold2 = hold; char *hold_val = (char *)&hold2; const char *paramValues[2] = {fa_val, hold_val}; int paramLengths[2] = {sizeof(fa2), sizeof(hold2)}; int paramFormats[2] = {1, 1}; // identify parameter as binary if(SQL_vsn10) { paramValues[0] = fa_val; paramValues[1] = NULL; paramLengths[0] = sizeof(fa2); paramLengths[1] = 0; paramFormats[0] = 1; paramFormats[1] = 0; } int resultFormat = 1; // binary int nFields = 0; int nTuples = 0; int blk_size = 0; if(bid) { LOG_TRACE("%s() SQL read data from File Address fa(%i) fa(%08X) fa2 htonl(%i) bid (%02X%02X)",__func__,fa,fa,fa2,*bid,*(bid+1)); } else { LOG_TRACE("%s() SQL read data from File Address fa(%i) fa(%08X) fa2 htonl(%i) bid (0)",__func__,fa,fa,fa2); } //LOG_DEBUG("%s() CALL SQL_select_data_procedure1(%i, %i, NULL);",__func__,fa2,hold2); //LOG_DEBUG("%s() SELECT data FROM fs_data WHERE file_address = %i","SQL_select_data_procedure1",fa2); bool is_data_found = false; LOG_DEBUG("%s() SelectDataCommand = %s %i",__func__,SelectDataCommand,fa); LOG_DEBUG("%s() SelectDataNParams = %i",__func__,SelectDataNParams); if(is_shadow_db) { res = PQexecPrepared(shadow_db_conn, SelectDataName, SelectDataNParams, paramValues, paramLengths, paramFormats, resultFormat); if (PQresultStatus(res) == PGRES_TUPLES_OK && ( PQnfields(res) != 0 || PQnfields(res) != 0) ) { is_data_found = true; LOG_DEBUG("SELECT operation succeeded on Shadow DB"); } else LOG_ERROR("SELECT failed on Shadow DB: %s", PQerrorMessage(shadow_db_conn )); } if(is_data_found !=true) { res = PQexecPrepared(conn, SelectDataName, SelectDataNParams, paramValues, paramLengths, paramFormats, resultFormat); } LOG_DEBUG("%s() res = %s",__func__,PQresStatus(PQresultStatus(res))); if ( hold ) { if ( SQL_vsn10 ) { SQL_lock_row(fa); } printSQL(0); } if (PQresultStatus(res) != PGRES_TUPLES_OK) { LOG_ERROR("SELECT failed: %s", PQerrorMessage(conn)); LOG_DEBUG("ROLLBACK TRANSACTION AND CHAIN"); res = PQexec(conn,"ROLLBACK TRANSACTION AND CHAIN"); LOG_ERROR("INVALID_FILE_ADDRESS %08X",fa); rc = ERR_INVALID_FILE_ADDRESS; if ( ((uint32_t)fa)>>24 != 0x94) { if ( bid != NULL ) { LOG_INFO("missing data: %08x %02x %02x", fa, *bid,*(bid+1)); char str1[8]; int16_t a=*bid; int16_t b=*(bid+1); sprintf(str1,"%02x%02x",a,b); FA[COUNT]=fa; memcpy(REC_ID1[COUNT],str1,5); COUNT++; } else { bid=0x0000; LOG_INFO("missing data: %08x", fa); FA[COUNT++]=fa; REC_ID1[COUNT][0]=0x00; } } PQclear(res); } else { nFields = PQnfields(res); // number of columns nTuples = PQntuples(res); // number of rows //LOG_DEBUG("%s() nFields(cols)=%i nTuples(rows)=%i",__func__,nFields,nTuples); if( nFields == 0 || nTuples == 0) { LOG_ERROR("SELECT failed: NO ROWS RETURNED"); res = PQexec(conn,"ROLLBACK TRANSACTION AND CHAIN"); LOG_ERROR("INVALID_FILE_ADDRESS %08X",fa); rc = ERR_INVALID_FILE_ADDRESS; if ( ((uint32_t)fa)>>24 != 0x94) { if ( bid != NULL ) { LOG_INFO("missing data: %08x %02x %02x", fa, *bid,*(bid+1)); char str1[8]; int16_t a=*bid; int16_t b=*(bid+1); sprintf(str1,"%02x%02x",a,b); FA[COUNT]=fa; memcpy(REC_ID1[COUNT],str1,5); COUNT++; } else { bid=0x0000; LOG_INFO("missing data: %08x", fa); FA[COUNT++]=fa; REC_ID1[COUNT][0]=0x00; } } PQclear(res); } else { blk_size = ntohl(*(uint32_t *)PQgetvalue (res, 0, 0)); //LOG_DEBUG("%s() blk_size returned is %i",__func__,blk_size); if(blk_size < 127 || blk_size > 4096) { LOG_ERROR("SELECT failed: NO ROWS RETURNED"); res = PQexec(conn,"ROLLBACK TRANSACTION AND CHAIN"); LOG_ERROR("INVALID_FILE_ADDRESS %08X",fa); rc = ERR_INVALID_FILE_ADDRESS; if ( ((uint32_t)fa)>>24 != 0x94) { if ( bid != NULL ) { LOG_INFO("missing data: %08x %02x %02x", fa, *bid,*(bid+1)); char str1[8]; int16_t a=*bid; int16_t b=*(bid+1); sprintf(str1,"%02x%02x",a,b); FA[COUNT]=fa; memcpy(REC_ID1[COUNT],str1,5); COUNT++; } else { bid=0x0000; LOG_INFO("missing data: %08x", fa); FA[COUNT++]=fa; REC_ID1[COUNT][0]=0x00; } } PQclear(res); } else { *fd = fa; // use File Address as File Descriptor c = PQgetvalue(res, 0, 1); // SELECT has data as second field //dump_hex(c,16); //printf(" PQgetlength of data = %i\n",PQgetlength(res,0,1)); p = c; // use same pointer for both mmap and core_blk //LOG_DEBUG("Core block address %p for FA %08X (RW)", p, fa); //dump_hex(p,32); /* probably need some validation of block size? */ if (bid != NULL && memcmp(bid, p, 2) != 0 && memcmp(bid, "\x00\x00", 2) != 0) { rc = ERR_RID_MISMATCH; int b1 = *(unsigned char *)p; int b2 = *(unsigned char *)(p+1); int a1 = *(unsigned char *)(bid); int a2 = *(unsigned char *)(bid+1); LOG_ERROR("Error record id mismatch %02X%02X != %02X%02X FA %08X", b1, b2, a1, a2, fa); } else if (rcc != NULL && *rcc != 0 && memcmp(rcc, p+2, 1) != 0) { rc = ERR_RCC_MISMATCH; int b1 = *(unsigned char *)(p+2); int a1 = *(unsigned char *)(rcc); LOG_ERROR("Error rcc mismatch %02X != %02X FA %08X", b1, a1, fa); } else { rc = 0; } *mmap_ptr = c; *core_blk = p; *st_size = blk_size; //dump_hex(*mmap_ptr,1055); } } } //LOG_DEBUG("%s() rc = %i",__func__,rc); return rc; } /**** sprintf(SelectDataName,"%s","SelectData"); if(SQL_vsn10) { sprintf(SelectDataCommand,"%s","SELECT blk_size,data FROM fs_data WHERE file_address = $1"); SelectDataNParams = 1; SelectDataParamTypes[0] = 23; // {int} } else { sprintf(SelectDataCommand,"%s","CALL SQL_select_data_procedure($1, $2, NULL, NULL)"); SelectDataNParams = 2; SelectDataParamTypes[0] = 23; // {int} SelectDataParamTypes[1] = 16; // {bool} } ***/
^ permalink raw reply [nested|flat] 8+ messages in thread

* Re: Help needed for the resolution of memory leak
@ 2024-01-15 20:00  Merlin Moncure <mmoncure@gmail.com>
  parent: Sasmit Utkarsh <utkarshsasmit@gmail.com>
  0 siblings, 1 reply; 8+ messages in thread

From: Merlin Moncure @ 2024-01-15 20:00 UTC (permalink / raw)
  To: Sasmit Utkarsh <utkarshsasmit@gmail.com>; +Cc: pgsql-general@lists.postgresql.org

On Mon, Jan 15, 2024 at 11:32 AM Sasmit Utkarsh <utkarshsasmit@gmail.com>
wrote:

> Hi Team,
>
> I am trying to test a code which basically tries to read some data from
> postgresql db in a loop through a function SQL_get_tpf_rw() whose
> definition and other details are shared in the attached file along with the
> memory leak report resulted during testing. Could you let me know if i
> missed calling  anywhere PQclear()
> in SQL_get_tpf_rw() which resulted in the below .
>
> Last few lines from the report
>
>
yep:  for example,

      if (PQresultStatus(*res*) != PGRES_TUPLES_OK)
        {
                LOG_ERROR("SELECT failed: %s", PQerrorMessage(conn));
		LOG_DEBUG("ROLLBACK TRANSACTION AND CHAIN");
		*res* = PQexec(conn,"ROLLBACK TRANSACTION AND CHAIN");
		LOG_ERROR("INVALID_FILE_ADDRESS %08X",fa);
		rc = ERR_INVALID_FILE_ADDRESS;


See highlighted bits.  You're reusing the res object before clearing
it.  there may be other cases, but this jumped off the page.


merlin

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: Help needed for the resolution of memory leak
@ 2024-01-16 15:09  Sasmit Utkarsh <utkarshsasmit@gmail.com>
  parent: Merlin Moncure <mmoncure@gmail.com>
  0 siblings, 1 reply; 8+ messages in thread

From: Sasmit Utkarsh @ 2024-01-16 15:09 UTC (permalink / raw)
  To: Merlin Moncure <mmoncure@gmail.com>; pgsql-general@lists.postgresql.org

Hi Merlin et al.

I have tried to have the above change added in the missing places. Still, I
see the below leaks reported by the address sanitizer. Please see
the attachments for the leak reported and the function definition updated.
Not sure for PQexecPrepared if we call PQclear(res) for cleaning up as
well. let me know if you need any more information



















*===================================================================176473==ERROR:
LeakSanitizer: detected memory leaksDirect leak of 197920 byte(s) in 1237
object(s) allocated from:    #0 0xf79bc00b in __interceptor_malloc
(/nix/store/7z4l4r0kpgzvsi6zkjz52cvgb8ra06bd-gcc-12.2.0-lib/lib/libasan.so.8+0xbe00b)
  #1 0xf78b63f3 in PQmakeEmptyPGresult
(/nix/store/y03rfw0iycp00dxcf8vrmss4nj700fia-postgresql-14.9-lib/lib/libpq.so.5+0x113f3)Indirect
leak of 2531328 byte(s) in 1236 object(s) allocated from:    #0 0xf79bc00b
in __interceptor_malloc
(/nix/store/7z4l4r0kpgzvsi6zkjz52cvgb8ra06bd-gcc-12.2.0-lib/lib/libasan.so.8+0xbe00b)
  #1 0xf78b604c in pqResultAlloc
(/nix/store/y03rfw0iycp00dxcf8vrmss4nj700fia-postgresql-14.9-lib/lib/libpq.so.5+0x1104c)Indirect
leak of 632832 byte(s) in 1236 object(s) allocated from:    #0 0xf79bc00b
in __interceptor_malloc
(/nix/store/7z4l4r0kpgzvsi6zkjz52cvgb8ra06bd-gcc-12.2.0-lib/lib/libasan.so.8+0xbe00b)
  #1 0xf78b57e0 in pqAddTuple
(/nix/store/y03rfw0iycp00dxcf8vrmss4nj700fia-postgresql-14.9-lib/lib/libpq.so.5+0x107e0)SUMMARY:
AddressSanitizer: 3362080 byte(s) leaked in 3709 allocation(s).*


Regards,
Sasmit Utkarsh
+91-7674022625


On Tue, Jan 16, 2024 at 12:21 PM Sasmit Utkarsh <utkarshsasmit@gmail.com>
wrote:

> Thanks Merlin,
>
> will try to check in other places as well and get back in case any further
> questions
>
>
> Regards,
> Sasmit Utkarsh
> +91-7674022625
>
>
> On Tue, Jan 16, 2024 at 1:30 AM Merlin Moncure <mmoncure@gmail.com> wrote:
>
>> On Mon, Jan 15, 2024 at 11:32 AM Sasmit Utkarsh <utkarshsasmit@gmail.com>
>> wrote:
>>
>>> Hi Team,
>>>
>>> I am trying to test a code which basically tries to read some data from
>>> postgresql db in a loop through a function SQL_get_tpf_rw() whose
>>> definition and other details are shared in the attached file along with the
>>> memory leak report resulted during testing. Could you let me know if i
>>> missed calling  anywhere PQclear()
>>> in SQL_get_tpf_rw() which resulted in the below .
>>>
>>> Last few lines from the report
>>>
>>>
>> yep:  for example,
>>
>>       if (PQresultStatus(*res*) != PGRES_TUPLES_OK)
>>         {
>>                 LOG_ERROR("SELECT failed: %s", PQerrorMessage(conn));
>> 		LOG_DEBUG("ROLLBACK TRANSACTION AND CHAIN");
>> 		*res* = PQexec(conn,"ROLLBACK TRANSACTION AND CHAIN");
>> 		LOG_ERROR("INVALID_FILE_ADDRESS %08X",fa);
>> 		rc = ERR_INVALID_FILE_ADDRESS;
>>
>>
>> See highlighted bits.  You're reusing the res object before clearing it.  there may be other cases, but this jumped off the page.
>>
>>
>> merlin
>>
>>
>>

Attachments:

fun_def_and_other_details.txt (text/plain, 25.2K) download /*************************************************************************** * PostgreSQL read * * select FileAddress from shc_data fs_data table * mmap_ptr becomes the pointer to the return from SELECT. * core_blk is also teh pointer to the return from SELECT * * call this routine with get_tpf_rw(), tpfasm.h has a #if to specify SQL path or FILE path ***************************************************************************/ int SQL_get_tpf_rw( int32_t fa, unsigned char **core_blk, size_t *st_size, unsigned char *bid, unsigned char *rcc, int *fd, bool hold, unsigned char **mmap_ptr) { char *p; char *c; int rc; struct stat statbuf; PGresult *res; uint32_t fa2 = htonl(fa); char *fa_val = (char *)&fa2; bool hold2 = hold; char *hold_val = (char *)&hold2; const char *paramValues[2] = {fa_val, hold_val}; int paramLengths[2] = {sizeof(fa2), sizeof(hold2)}; int paramFormats[2] = {1, 1}; // identify parameter as binary if(SQL_vsn10) { paramValues[0] = fa_val; paramValues[1] = NULL; paramLengths[0] = sizeof(fa2); paramLengths[1] = 0; paramFormats[0] = 1; paramFormats[1] = 0; } int resultFormat = 1; // binary int nFields = 0; int nTuples = 0; int blk_size = 0; if(bid) { LOG_TRACE("%s() SQL read data from File Address fa(%i) fa(%08X) fa2 htonl(%i) bid (%02X%02X)",__func__,fa,fa,fa2,*bid,*(bid+1)); } else { LOG_TRACE("%s() SQL read data from File Address fa(%i) fa(%08X) fa2 htonl(%i) bid (0)",__func__,fa,fa,fa2); } //LOG_DEBUG("%s() CALL SQL_select_data_procedure1(%i, %i, NULL);",__func__,fa2,hold2); //LOG_DEBUG("%s() SELECT data FROM fs_data WHERE file_address = %i","SQL_select_data_procedure1",fa2); bool is_data_found = false; LOG_DEBUG("%s() SelectDataCommand = %s %i",__func__,SelectDataCommand,fa); LOG_DEBUG("%s() SelectDataNParams = %i",__func__,SelectDataNParams); if(is_shadow_db) { res = PQexecPrepared(shadow_db_conn, SelectDataName, SelectDataNParams, paramValues, paramLengths, paramFormats, resultFormat); if (PQresultStatus(res) == PGRES_TUPLES_OK && ( PQnfields(res) != 0 || PQnfields(res) != 0) ) { is_data_found = true; LOG_DEBUG("SELECT operation succeeded on Shadow DB"); } else LOG_ERROR("SELECT failed on Shadow DB: %s", PQerrorMessage(shadow_db_conn )); } if(is_data_found !=true) { res = PQexecPrepared(conn, SelectDataName, SelectDataNParams, paramValues, paramLengths, paramFormats, resultFormat); } LOG_DEBUG("%s() res = %s",__func__,PQresStatus(PQresultStatus(res))); if ( hold ) { if ( SQL_vsn10 ) { SQL_lock_row(fa); } printSQL(0); } if (PQresultStatus(res) != PGRES_TUPLES_OK) { LOG_ERROR("SELECT failed: %s", PQerrorMessage(conn)); LOG_DEBUG("ROLLBACK TRANSACTION AND CHAIN"); PQclear(res); res = PQexec(conn,"ROLLBACK TRANSACTION AND CHAIN"); LOG_ERROR("INVALID_FILE_ADDRESS %08X",fa); rc = ERR_INVALID_FILE_ADDRESS; if ( ((uint32_t)fa)>>24 != 0x94) { if ( bid != NULL ) { LOG_INFO("missing data: %08x %02x %02x", fa, *bid,*(bid+1)); char str1[8]; int16_t a=*bid; int16_t b=*(bid+1); sprintf(str1,"%02x%02x",a,b); FA[COUNT]=fa; memcpy(REC_ID1[COUNT],str1,5); COUNT++; } else { bid=0x0000; LOG_INFO("missing data: %08x", fa); FA[COUNT++]=fa; REC_ID1[COUNT][0]=0x00; } } PQclear(res); } else { nFields = PQnfields(res); // number of columns nTuples = PQntuples(res); // number of rows //LOG_DEBUG("%s() nFields(cols)=%i nTuples(rows)=%i",__func__,nFields,nTuples); if( nFields == 0 || nTuples == 0) { LOG_ERROR("SELECT failed: NO ROWS RETURNED"); PQclear(res); res = PQexec(conn,"ROLLBACK TRANSACTION AND CHAIN"); LOG_ERROR("INVALID_FILE_ADDRESS %08X",fa); rc = ERR_INVALID_FILE_ADDRESS; if ( ((uint32_t)fa)>>24 != 0x94) { if ( bid != NULL ) { LOG_INFO("missing data: %08x %02x %02x", fa, *bid,*(bid+1)); char str1[8]; int16_t a=*bid; int16_t b=*(bid+1); sprintf(str1,"%02x%02x",a,b); FA[COUNT]=fa; memcpy(REC_ID1[COUNT],str1,5); COUNT++; } else { bid=0x0000; LOG_INFO("missing data: %08x", fa); FA[COUNT++]=fa; REC_ID1[COUNT][0]=0x00; } } PQclear(res); } else { blk_size = ntohl(*(uint32_t *)PQgetvalue (res, 0, 0)); //LOG_DEBUG("%s() blk_size returned is %i",__func__,blk_size); if(blk_size < 127 || blk_size > 4096) { LOG_ERROR("SELECT failed: NO ROWS RETURNED"); PQclear(res); res = PQexec(conn,"ROLLBACK TRANSACTION AND CHAIN"); LOG_ERROR("INVALID_FILE_ADDRESS %08X",fa); rc = ERR_INVALID_FILE_ADDRESS; if ( ((uint32_t)fa)>>24 != 0x94) { if ( bid != NULL ) { LOG_INFO("missing data: %08x %02x %02x", fa, *bid,*(bid+1)); char str1[8]; int16_t a=*bid; int16_t b=*(bid+1); sprintf(str1,"%02x%02x",a,b); FA[COUNT]=fa; memcpy(REC_ID1[COUNT],str1,5); COUNT++; } else { bid=0x0000; LOG_INFO("missing data: %08x", fa); FA[COUNT++]=fa; REC_ID1[COUNT][0]=0x00; } } PQclear(res); } else { *fd = fa; // use File Address as File Descriptor c = PQgetvalue(res, 0, 1); // SELECT has data as second field //dump_hex(c,16); //printf(" PQgetlength of data = %i\n",PQgetlength(res,0,1)); p = c; // use same pointer for both mmap and core_blk //LOG_DEBUG("Core block address %p for FA %08X (RW)", p, fa); //dump_hex(p,32); /* probably need some validation of block size? */ if (bid != NULL && memcmp(bid, p, 2) != 0 && memcmp(bid, "\x00\x00", 2) != 0) { rc = ERR_RID_MISMATCH; int b1 = *(unsigned char *)p; int b2 = *(unsigned char *)(p+1); int a1 = *(unsigned char *)(bid); int a2 = *(unsigned char *)(bid+1); LOG_ERROR("Error record id mismatch %02X%02X != %02X%02X FA %08X", b1, b2, a1, a2, fa); } else if (rcc != NULL && *rcc != 0 && memcmp(rcc, p+2, 1) != 0) { rc = ERR_RCC_MISMATCH; int b1 = *(unsigned char *)(p+2); int a1 = *(unsigned char *)(rcc); LOG_ERROR("Error rcc mismatch %02X != %02X FA %08X", b1, a1, fa); } else { rc = 0; } *mmap_ptr = c; *core_blk = p; *st_size = blk_size; //dump_hex(*mmap_ptr,1055); } } } //LOG_DEBUG("%s() rc = %i",__func__,rc); return rc; } /**** sprintf(SelectDataName,"%s","SelectData"); if(SQL_vsn10) { sprintf(SelectDataCommand,"%s","SELECT blk_size,data FROM fs_data WHERE file_address = $1"); SelectDataNParams = 1; SelectDataParamTypes[0] = 23; // {int} } else { sprintf(SelectDataCommand,"%s","CALL SQL_select_data_procedure($1, $2, NULL, NULL)"); SelectDataNParams = 2; SelectDataParamTypes[0] = 23; // {int} SelectDataParamTypes[1] = 16; // {bool} } ***/ /*********************************************************** * Connect to PostgreSQL database ***********************************************************/ void SQL_init_db_connection(void) { PGresult *res; LOG_DEBUG("%s() conninfo=%s",__func__,conninfo); if(is_shadow_db) { shadow_db_conn = PQconnectdb(shadow_db_conn_info); if ( PQstatus(shadow_db_conn ) != CONNECTION_OK ) { LOG_ERROR("Connection to shadow database failed! %s", PQerrorMessage(conn)); PQfinish(shadow_db_conn); exit(1); } res = PQexec(shadow_db_conn, "SET bytea_output = 'escape'"); LOG_DEBUG("%s() Connection to shadow_shc_data database SUCCESSFUL",__func__); // execute_stored_procedure(shadow_db_conn); } conn = PQconnectdb(conninfo); if ( PQstatus(conn) != CONNECTION_OK ) { LOG_ERROR("Connection to database failed! %s", PQerrorMessage(conn)); PQfinish(conn); exit(1); } else { res = PQexec(conn, "SET bytea_output = 'escape'"); LOG_DEBUG("%s() Connection to shc_data database SUCCESSFUL",__func__); } res = PQexec(conn, "START TRANSACTION"); if (PQresultStatus(res) != PGRES_COMMAND_OK) { LOG_ERROR("START TRANSACTION failed: %s", PQerrorMessage(conn)); SQL_exit_nicely(conn,res); } PQclear(res); LOG_INFO("PostgreSQL Server Version = %d.%d protocol %i",PQserverVersion(conn)/100,PQserverVersion(conn)%100,PQprotocolVersion(conn)); if(PQserverVersion(conn)/100 < 1100) SQL_vsn10 = 1; /*------------------------------------------------------------------------------------------------------------------------------------*/ sprintf(SelectDataName,"%s","SelectData"); if(SQL_vsn10) { sprintf(SelectDataCommand,"%s","SELECT blk_size,data FROM fs_data WHERE file_address = $1"); SelectDataNParams = 1; SelectDataParamTypes[0] = 23; // {int} } else { sprintf(SelectDataCommand,"%s","CALL SQL_select_data_procedure($1, $2, NULL, NULL)"); SelectDataNParams = 2; SelectDataParamTypes[0] = 23; // {int} SelectDataParamTypes[1] = 16; // {bool} } //------------------------------------------- sprintf(InsertDataName,"%s","InsertData"); if(SQL_vsn10) { sprintf(InsertDataCommand,"%s","INSERT INTO fs_data (file_address, face_type, ordinal, xaddr, recid, blk_size, data) VALUES ($1, $2, $3, $4, $5, $6, $7) RETURNING data"); } else { sprintf(InsertDataCommand,"%s","CALL SQL_insert_data_procedure($1, $2, $3, $4, $5, $6, $7, NULL)"); } InsertDataNParams = 7; InsertDataParamTypes[0] = 23; // {int} InsertDataParamTypes[1] = 23; // {int} InsertDataParamTypes[2] = 23; // {int} InsertDataParamTypes[3] = 25; // {text} InsertDataParamTypes[4] = 25; // {text} InsertDataParamTypes[5] = 23; // {int} InsertDataParamTypes[6] = 17; // {bytea} //------------------------------------------- sprintf(UpdateDataName,"%s","UpdateData"); if(SQL_vsn10) { sprintf(UpdateDataCommand,"%s","UPDATE fs_data SET data = $1 WHERE file_address = $2"); UpdateDataNParams = 2; UpdateDataParamTypes[0] = 17; // {bytea} UpdateDataParamTypes[1] = 23; // {int} } else { sprintf(UpdateDataCommand,"%s","CALL SQL_update_data_procedure($1, $2, $3)"); UpdateDataNParams = 3; UpdateDataParamTypes[0] = 17; // {bytea} UpdateDataParamTypes[1] = 16; // {bool} UpdateDataParamTypes[2] = 23; // {int} } //------------------------------------------- sprintf(SelectSizeName,"%s","SelectSize"); if(SQL_vsn10) { sprintf(SelectSizeCommand,"%s","SELECT size FROM riat WHERE id = $1 AND rtp = $2"); } else { sprintf(SelectSizeCommand,"%s","CALL SQL_select_size_procedure($1, $2, NULL)"); } SelectSizeNParams = 2; SelectSizeParamTypes[0] = 25; // {text} SelectSizeParamTypes[1] = 23; // {int} /*------------------------------------------------------------------------------------------------------------------------------------*/ // SELECT advisory_lock(FileAddress) if(is_shadow_db) { res = PQprepare(shadow_db_conn, AdvisoryLockDataName, AdvisoryLockDataCommand, AdvisoryLockDataNParams, AdvisoryLockDataParamTypes); LOG_DEBUG("%s() PREPARE AdvisoryLockData for shadow db PQresultStatus = %s",__func__,PQresStatus(PQresultStatus(res))); if(PQresultStatus(res) != PGRES_COMMAND_OK) { LOG_ERROR("PREPARE failed for shadow db! %s", PQerrorMessage(conn)); SQL_exit_nicely(conn,res); } PQclear(res); } res = PQprepare(conn, AdvisoryLockDataName, AdvisoryLockDataCommand, AdvisoryLockDataNParams, AdvisoryLockDataParamTypes); LOG_DEBUG("%s() PREPARE AdvisoryLockData PQresultStatus = %s",__func__,PQresStatus(PQresultStatus(res))); if(PQresultStatus(res) != PGRES_COMMAND_OK) { LOG_ERROR("PREPARE failed! %s", PQerrorMessage(conn)); SQL_exit_nicely(conn,res); } PQclear(res); // SELECT advisory_unlock(FileAddress) if(is_shadow_db) { res = PQprepare(shadow_db_conn, AdvisoryUnLockDataName, AdvisoryUnLockDataCommand, AdvisoryUnLockDataNParams, AdvisoryUnLockDataParamTypes); LOG_DEBUG("%s() PREPARE AdvisoryUnLockData for shadow db PQresultStatus = %s",__func__,PQresStatus(PQresultStatus(res))); if(PQresultStatus(res) != PGRES_COMMAND_OK) { LOG_ERROR("PREPARE failed for shadow db! %s", PQerrorMessage(conn)); SQL_exit_nicely(conn,res); } PQclear(res); } res = PQprepare(conn, AdvisoryUnLockDataName, AdvisoryUnLockDataCommand, AdvisoryUnLockDataNParams, AdvisoryUnLockDataParamTypes); LOG_DEBUG("%s() PREPARE AdvisoryUnLockData PQresultStatus = %s",__func__,PQresStatus(PQresultStatus(res))); if(PQresultStatus(res) != PGRES_COMMAND_OK) { LOG_ERROR("PREPARE failed! %s", PQerrorMessage(conn)); SQL_exit_nicely(conn,res); } PQclear(res); if ( sql_db ) { /* CREATE OR REPLACE PROCEDURE sql_select_size_procedure(id text, rtp integer, INOUT size_data text) LANGUAGE plpgsql AS $$ BEGIN SELECT size FROM riat WHERE id = id AND rtp = rtp INTO size_data; END; $$; */ if(!SQL_vsn10) { /*** if(is_shadow_db) { res = PQexec(shadow_db_conn," CREATE OR REPLACE PROCEDURE sql_select_size_procedure(hexid text, rtp_in integer, INOUT size_data text) LANGUAGE plpgsql AS $$ BEGIN SELECT size FROM riat WHERE id = hexid AND rtp = rtp_in INTO size_data; END; $$;"); LOG_DEBUG("%s() CREATE sql_select_size_procedure for shadow db PQresultStatus = %s",__func__,PQresStatus(PQresultStatus(res))); if(PQresultStatus(res) != PGRES_COMMAND_OK) { LOG_ERROR("CREATE sql_select_size_procedure failed for shadow db! %s", PQerrorMessage(conn)); SQL_exit_nicely(conn,res); } PQclear(res); } ***/ res = PQexec(conn," CREATE OR REPLACE PROCEDURE sql_select_size_procedure(hexid text, rtp_in integer, INOUT size_data text) LANGUAGE plpgsql AS $$ BEGIN SELECT size FROM riat WHERE id = hexid AND rtp = rtp_in INTO size_data; END; $$;"); LOG_DEBUG("%s() CREATE sql_select_size_procedure PQresultStatus = %s",__func__,PQresStatus(PQresultStatus(res))); if(PQresultStatus(res) != PGRES_COMMAND_OK) { LOG_ERROR("CREATE sql_select_size_procedure failed! %s", PQerrorMessage(conn)); SQL_exit_nicely(conn,res); } PQclear(res); } // SELECT size FROM riat WHERE id = $1 AND rtp = $2; /** if(is_shadow_db) { res = PQprepare(shadow_db_conn, SelectSizeName, SelectSizeCommand, SelectSizeNParams, SelectSizeParamTypes); LOG_DEBUG("%s() PREPARE SelectSize PQresultStatus = %s",__func__,PQresStatus(PQresultStatus(res))); if(PQresultStatus(res) != PGRES_COMMAND_OK) { LOG_ERROR("PREPARE failed for RIAT! %s", PQerrorMessage(conn)); SQL_exit_nicely(conn,res); } PQclear(res); } **/ res = PQprepare(conn, SelectSizeName, SelectSizeCommand, SelectSizeNParams, SelectSizeParamTypes); LOG_DEBUG("%s() PREPARE SelectSize PQresultStatus = %s",__func__,PQresStatus(PQresultStatus(res))); if(PQresultStatus(res) != PGRES_COMMAND_OK) { LOG_ERROR("PREPARE failed for RIAT! %s", PQerrorMessage(conn)); SQL_exit_nicely(conn,res); } PQclear(res); /* // SQL commands to create the stored procedure for select and hold CREATE OR REPLACE PROCEDURE sql_select_data_procedure(fa integer, hold bool, INOUT blksize integer, INOUT fadata bytea) LANGUAGE plpgsql AS $$ BEGIN IF (hold) THEN PERFORM pg_advisory_lock(fa); END IF; SELECT blk_size,data FROM fs_data WHERE file_address = fa INTO blksize,fadata; END; $$; */ if(!SQL_vsn10) { if(is_shadow_db) { res = PQexec(shadow_db_conn," CREATE OR REPLACE PROCEDURE sql_select_data_procedure(fa integer, hold bool, INOUT blksize integer, INOUT fadata bytea) LANGUAGE plpgsql AS $$ BEGIN IF (hold) THEN PERFORM pg_advisory_lock(fa); END IF; SELECT blk_size,data FROM fs_data WHERE file_address = fa INTO blksize,fadata; END; $$;"); LOG_DEBUG("%s() CREATE sql_select_data_procedure for shadow db PQresultStatus = %s",__func__,PQresStatus(PQresultStatus(res))); if(PQresultStatus(res) != PGRES_COMMAND_OK) { LOG_ERROR("CREATE sql_select_data_procedure for shadow db failed! %s", PQerrorMessage(conn)); SQL_exit_nicely(conn,res); } PQclear(res); } res = PQexec(conn," CREATE OR REPLACE PROCEDURE sql_select_data_procedure(fa integer, hold bool, INOUT blksize integer, INOUT fadata bytea) LANGUAGE plpgsql AS $$ BEGIN IF (hold) THEN PERFORM pg_advisory_lock(fa); END IF; SELECT blk_size,data FROM fs_data WHERE file_address = fa INTO blksize,fadata; END; $$;"); LOG_DEBUG("%s() CREATE sql_select_data_procedure PQresultStatus = %s",__func__,PQresStatus(PQresultStatus(res))); if(PQresultStatus(res) != PGRES_COMMAND_OK) { LOG_ERROR("CREATE sql_select_data_procedure failed! %s", PQerrorMessage(conn)); SQL_exit_nicely(conn,res); } PQclear(res); } // SELECT data FROM fs_data WHERE file_address = $1; if(is_shadow_db) { res = PQprepare(shadow_db_conn, SelectDataName, SelectDataCommand, SelectDataNParams, SelectDataParamTypes); LOG_DEBUG("%s() PREPARE SelectData PQresultStatus = %s",__func__,PQresStatus(PQresultStatus(res))); if(PQresultStatus(res) != PGRES_COMMAND_OK) { LOG_ERROR("Prepare failed! from shadow_db %s", PQerrorMessage(conn)); SQL_exit_nicely(conn,res); } PQclear(res); } res = PQprepare(conn, SelectDataName, SelectDataCommand, SelectDataNParams, SelectDataParamTypes); LOG_DEBUG("%s() PREPARE SelectData PQresultStatus = %s",__func__,PQresStatus(PQresultStatus(res))); if(PQresultStatus(res) != PGRES_COMMAND_OK) { LOG_ERROR("CREATE failed! %s", PQerrorMessage(conn)); SQL_exit_nicely(conn,res); } PQclear(res); /* INSERT data CREATE PROCEDURE sql_insert_data_procedure(fa integer, ft integer, ord integer, xaddr text, recid text, blk_size integer, data bytea, INOUT data) LANGUAGE plpgsql AS $$ BEGIN INSERT INTO fs_data (file_address, face_type, ordinal, xaddr, recid, blk_size, data) VALUES (fa,ft,ord,xaddr,recid,blk_size,data) RETURNING data; END; $$; */ if(!SQL_vsn10) { if(is_shadow_db) { res = PQexec(shadow_db_conn,"CREATE OR REPLACE PROCEDURE sql_insert_data_procedure(fa integer, ft integer, ord integer, xaddr text, recid text, blk_size integer, indata bytea, INOUT outdata bytea) LANGUAGE plpgsql AS $$ BEGIN INSERT INTO fs_data (file_address, face_type, ordinal, xaddr, recid, blk_size, data) VALUES (fa, ft, ord, xaddr, recid, blk_size, indata) RETURNING data INTO outdata; END; $$;"); LOG_DEBUG("%s() CREATE sql_insert_data_procedure for shadow db PQresultStatus = %s",__func__,PQresStatus(PQresultStatus(res))); if(PQresultStatus(res) != PGRES_COMMAND_OK) { LOG_ERROR("CREATE sql_insert_data_procedure for shadow db failed! %s", PQerrorMessage(conn)); SQL_exit_nicely(conn,res); } PQclear(res); } res = PQexec(conn,"CREATE OR REPLACE PROCEDURE sql_insert_data_procedure(fa integer, ft integer, ord integer, xaddr text, recid text, blk_size integer, indata bytea, INOUT outdata bytea) LANGUAGE plpgsql AS $$ BEGIN INSERT INTO fs_data (file_address, face_type, ordinal, xaddr, recid, blk_size, data) VALUES (fa, ft, ord, xaddr, recid, blk_size, indata) RETURNING data INTO outdata; END; $$;"); LOG_DEBUG("%s() CREATE sql_insert_data_procedure PQresultStatus = %s",__func__,PQresStatus(PQresultStatus(res))); if(PQresultStatus(res) != PGRES_COMMAND_OK) { LOG_ERROR("CREATE sql_insert_data_procedure failed! %s", PQerrorMessage(conn)); SQL_exit_nicely(conn,res); } PQclear(res); } if(is_shadow_db) { res = PQprepare(shadow_db_conn, InsertDataName, InsertDataCommand, InsertDataNParams, InsertDataParamTypes); LOG_DEBUG("%s() PREPARE InsertData PQresultStatus = %s",__func__,PQresStatus(PQresultStatus(res))); if(PQresultStatus(res) != PGRES_COMMAND_OK) { LOG_ERROR("PREPARE failed from shadow_db! %s", PQerrorMessage(conn)); SQL_exit_nicely(conn,res); } PQclear(res); } res = PQprepare(conn, InsertDataName, InsertDataCommand, InsertDataNParams, InsertDataParamTypes); LOG_DEBUG("%s() PREPARE InsertData PQresultStatus = %s",__func__,PQresStatus(PQresultStatus(res))); if(PQresultStatus(res) != PGRES_COMMAND_OK) { LOG_ERROR("PREPARE failed! %s", PQerrorMessage(conn)); SQL_exit_nicely(conn,res); } PQclear(res); /* // SQL commands to create the stored procedure for unpdate and unhold CREATE OR REPLACE PROCEDURE sql_update_data_procedure(indata bytea, unhold bool, fa integer) LANGUAGE plpgsql AS $$ BEGIN UPDATE fs_data SET data = indata WHERE file_address = fa; IF (unhold) THEN PERFORM pg_advisory_unlock(fa); END IF; END; -- COMMIT TRANSACTION $$; */ if(!SQL_vsn10) { if(is_shadow_db) { res = PQexec(shadow_db_conn,"CREATE OR REPLACE PROCEDURE sql_update_data_procedure(indata bytea, unhold bool, fa integer) LANGUAGE plpgsql AS $$ BEGIN UPDATE fs_data SET data = indata WHERE file_address = fa; IF (unhold) THEN PERFORM pg_advisory_unlock(fa); END IF; END; -- COMMIT TRANSACTION $$;"); LOG_DEBUG("%s() CREATE sql_update_data_procedure for shadow db PQresultStatus = %s",__func__,PQresStatus(PQresultStatus(res))); if(PQresultStatus(res) != PGRES_COMMAND_OK) { LOG_ERROR("CREATE sql_update_data_procedure for shadow db failed! %s", PQerrorMessage(conn)); SQL_exit_nicely(conn,res); } PQclear(res); } res = PQexec(conn,"CREATE OR REPLACE PROCEDURE sql_update_data_procedure(indata bytea, unhold bool, fa integer) LANGUAGE plpgsql AS $$ BEGIN UPDATE fs_data SET data = indata WHERE file_address = fa; IF (unhold) THEN PERFORM pg_advisory_unlock(fa); END IF; END; -- COMMIT TRANSACTION $$;"); LOG_DEBUG("%s() CREATE sql_update_data_procedure PQresultStatus = %s",__func__,PQresStatus(PQresultStatus(res))); if(PQresultStatus(res) != PGRES_COMMAND_OK) { LOG_ERROR("CREATE sql_update_data_procedure failed! %s", PQerrorMessage(conn)); SQL_exit_nicely(conn,res); } PQclear(res); } // UPDATE fs_data SET data = $1 WHERE file_address = $2 if(is_shadow_db) { res = PQprepare(shadow_db_conn, UpdateDataName, UpdateDataCommand, UpdateDataNParams, UpdateDataParamTypes); LOG_DEBUG("%s() PREPARE UpdateData from shadow_db PQresultStatus = %s",__func__,PQresStatus(PQresultStatus(res))); if(PQresultStatus(res) != PGRES_COMMAND_OK) { LOG_ERROR("PREPARE failed! for shadow db %s", PQerrorMessage(conn)); SQL_exit_nicely(conn,res); } PQclear(res); } res = PQprepare(conn, UpdateDataName, UpdateDataCommand, UpdateDataNParams, UpdateDataParamTypes); LOG_DEBUG("%s() PREPARE UpdateData PQresultStatus = %s",__func__,PQresStatus(PQresultStatus(res))); if(PQresultStatus(res) != PGRES_COMMAND_OK) { LOG_ERROR("PREPARE failed! %s", PQerrorMessage(conn)); SQL_exit_nicely(conn,res); } PQclear(res); } res = PQexec(conn, "END TRANSACTION"); PQclear(res); }
LeaskSanitizer report 2.txt (text/plain, 259.7K) download ^ permalink raw reply [nested|flat] 8+ messages in thread

* Re: Help needed for the resolution of memory leak
@ 2024-01-16 22:41  Merlin Moncure <mmoncure@gmail.com>
  parent: Sasmit Utkarsh <utkarshsasmit@gmail.com>
  0 siblings, 1 reply; 8+ messages in thread

From: Merlin Moncure @ 2024-01-16 22:41 UTC (permalink / raw)
  To: Sasmit Utkarsh <utkarshsasmit@gmail.com>; +Cc: pgsql-general@lists.postgresql.org

On Tue, Jan 16, 2024 at 9:10 AM Sasmit Utkarsh <utkarshsasmit@gmail.com>
wrote:

> Hi Merlin et al.
>
> I have tried to have the above change added in the missing places. Still,
> I see the below leaks reported by the address sanitizer. Please see
> the attachments for the leak reported and the function definition updated.
> Not sure for PQexecPrepared if we call PQclear(res) for cleaning up as
> well. let me know if you need any more information
>

You have many other leaks.    See code below, you are making up to thee
sequential calls to create a result before calling clear.  *All *calls
creating and returning returning PGresult have to be cleared before the
pointer is reused.

merlin



	LOG_DEBUG("%s() conninfo=%s",__func__,conninfo);	

	if(is_shadow_db)
	{
		shadow_db_conn = PQconnectdb(shadow_db_conn_info);
		if ( PQstatus(shadow_db_conn ) != CONNECTION_OK )
		{
		   LOG_ERROR("Connection to shadow database failed! %s",
PQerrorMessage(conn));
		   PQfinish(shadow_db_conn);
		   exit(1);
		}
		*res *= PQexec(shadow_db_conn, "SET bytea_output = 'escape'");
		LOG_DEBUG("%s() Connection to shadow_shc_data database SUCCESSFUL",__func__);
		// execute_stored_procedure(shadow_db_conn);
	}

	conn = PQconnectdb(conninfo);
	if ( PQstatus(conn) != CONNECTION_OK ) {
		LOG_ERROR("Connection to database failed! %s", PQerrorMessage(conn));
		PQfinish(conn);
		exit(1);
	} else {
		*res =* PQexec(conn, "SET bytea_output = 'escape'");
		LOG_DEBUG("%s() Connection to shc_data database SUCCESSFUL",__func__);
	}

	*res *= PQexec(conn, "START TRANSACTION");
	if (PQresultStatus(res) != PGRES_COMMAND_OK)
	{
		LOG_ERROR("START TRANSACTION failed: %s", PQerrorMessage(conn));
		SQL_exit_nicely(conn,res);
	}
	PQclear(res);

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: Help needed for the resolution of memory leak
@ 2024-01-17 07:22  Sasmit Utkarsh <utkarshsasmit@gmail.com>
  parent: Merlin Moncure <mmoncure@gmail.com>
  0 siblings, 1 reply; 8+ messages in thread

From: Sasmit Utkarsh @ 2024-01-17 07:22 UTC (permalink / raw)
  To: Merlin Moncure <mmoncure@gmail.com>; +Cc: pgsql-general@lists.postgresql.org

Thanks, I'll take a look.

Regards,
Sasmit Utkarsh
+91-7674022625


On Wed, Jan 17, 2024 at 4:12 AM Merlin Moncure <mmoncure@gmail.com> wrote:

> On Tue, Jan 16, 2024 at 9:10 AM Sasmit Utkarsh <utkarshsasmit@gmail.com>
> wrote:
>
>> Hi Merlin et al.
>>
>> I have tried to have the above change added in the missing places. Still,
>> I see the below leaks reported by the address sanitizer. Please see
>> the attachments for the leak reported and the function definition updated.
>> Not sure for PQexecPrepared if we call PQclear(res) for cleaning up as
>> well. let me know if you need any more information
>>
>
> You have many other leaks.    See code below, you are making up to thee
> sequential calls to create a result before calling clear.  *All *calls
> creating and returning returning PGresult have to be cleared before the
> pointer is reused.
>
> merlin
>
>
>
> 	LOG_DEBUG("%s() conninfo=%s",__func__,conninfo);	
>
> 	if(is_shadow_db)
> 	{
> 		shadow_db_conn = PQconnectdb(shadow_db_conn_info);
> 		if ( PQstatus(shadow_db_conn ) != CONNECTION_OK )
> 		{
> 		   LOG_ERROR("Connection to shadow database failed! %s", PQerrorMessage(conn));
> 		   PQfinish(shadow_db_conn);
> 		   exit(1);
> 		}
> 		*res *= PQexec(shadow_db_conn, "SET bytea_output = 'escape'");
> 		LOG_DEBUG("%s() Connection to shadow_shc_data database SUCCESSFUL",__func__);
> 		// execute_stored_procedure(shadow_db_conn);
> 	}
>
> 	conn = PQconnectdb(conninfo);
> 	if ( PQstatus(conn) != CONNECTION_OK ) {
> 		LOG_ERROR("Connection to database failed! %s", PQerrorMessage(conn));
> 		PQfinish(conn);
> 		exit(1);
> 	} else {
> 		*res =* PQexec(conn, "SET bytea_output = 'escape'");
> 		LOG_DEBUG("%s() Connection to shc_data database SUCCESSFUL",__func__);
> 	}
>
> 	*res *= PQexec(conn, "START TRANSACTION");
> 	if (PQresultStatus(res) != PGRES_COMMAND_OK)
> 	{
> 		LOG_ERROR("START TRANSACTION failed: %s", PQerrorMessage(conn));
> 		SQL_exit_nicely(conn,res);
> 	}
> 	PQclear(res);
>
>

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: Help needed for the resolution of memory leak
@ 2024-01-17 19:14  Sasmit Utkarsh <utkarshsasmit@gmail.com>
  parent: Sasmit Utkarsh <utkarshsasmit@gmail.com>
  0 siblings, 1 reply; 8+ messages in thread

From: Sasmit Utkarsh @ 2024-01-17 19:14 UTC (permalink / raw)
  To: Merlin Moncure <mmoncure@gmail.com>; +Cc: pgsql-general@lists.postgresql.org

Hi Merlin et al.

Below are some couple of observations attached as an "overview_of_code" and
other attachments "function_def_other_details" and leak sanitizer report.
Please assist with some clarifications given in overview_of_code with
(***). Let me know if you need any more information

Regards,
Sasmit Utkarsh
+91-7674022625


On Wed, Jan 17, 2024 at 12:52 PM Sasmit Utkarsh <utkarshsasmit@gmail.com>
wrote:

> Thanks, I'll take a look.
>
> Regards,
> Sasmit Utkarsh
> +91-7674022625
>
>
> On Wed, Jan 17, 2024 at 4:12 AM Merlin Moncure <mmoncure@gmail.com> wrote:
>
>> On Tue, Jan 16, 2024 at 9:10 AM Sasmit Utkarsh <utkarshsasmit@gmail.com>
>> wrote:
>>
>>> Hi Merlin et al.
>>>
>>> I have tried to have the above change added in the missing places.
>>> Still, I see the below leaks reported by the address sanitizer. Please see
>>> the attachments for the leak reported and the function definition updated.
>>> Not sure for PQexecPrepared if we call PQclear(res) for cleaning up as
>>> well. let me know if you need any more information
>>>
>>
>> You have many other leaks.    See code below, you are making up to thee
>> sequential calls to create a result before calling clear.  *All *calls
>> creating and returning returning PGresult have to be cleared before the
>> pointer is reused.
>>
>> merlin
>>
>>
>>
>> 	LOG_DEBUG("%s() conninfo=%s",__func__,conninfo);	
>>
>> 	if(is_shadow_db)
>> 	{
>> 		shadow_db_conn = PQconnectdb(shadow_db_conn_info);
>> 		if ( PQstatus(shadow_db_conn ) != CONNECTION_OK )
>> 		{
>> 		   LOG_ERROR("Connection to shadow database failed! %s", PQerrorMessage(conn));
>> 		   PQfinish(shadow_db_conn);
>> 		   exit(1);
>> 		}
>> 		*res *= PQexec(shadow_db_conn, "SET bytea_output = 'escape'");
>> 		LOG_DEBUG("%s() Connection to shadow_shc_data database SUCCESSFUL",__func__);
>> 		// execute_stored_procedure(shadow_db_conn);
>> 	}
>>
>> 	conn = PQconnectdb(conninfo);
>> 	if ( PQstatus(conn) != CONNECTION_OK ) {
>> 		LOG_ERROR("Connection to database failed! %s", PQerrorMessage(conn));
>> 		PQfinish(conn);
>> 		exit(1);
>> 	} else {
>> 		*res =* PQexec(conn, "SET bytea_output = 'escape'");
>> 		LOG_DEBUG("%s() Connection to shc_data database SUCCESSFUL",__func__);
>> 	}
>>
>> 	*res *= PQexec(conn, "START TRANSACTION");
>> 	if (PQresultStatus(res) != PGRES_COMMAND_OK)
>> 	{
>> 		LOG_ERROR("START TRANSACTION failed: %s", PQerrorMessage(conn));
>> 		SQL_exit_nicely(conn,res);
>> 	}
>> 	PQclear(res);
>>
>>

Attachments:

  LeaskSanitizer report 3.txt (text/plain, 636.2K) download

overview_of_code.txt (text/plain, 4.6K) download I notice something below as well. Below are some observations main()->load_core_resident_fs_data()->get_tpf_rw() called suppose 1236 times in loop and get_tpf_rw() calls SQL_get_tpf_rw() and inside SQL_get_tpf_rw, if you see at last few lines (full definition shared in other attachment fun_def_and_other_details.txt) int SQL_get_tpf_rw( int32_t fa, unsigned char **core_blk, size_t *st_size, unsigned char *bid, unsigned char *rcc, int *fd, bool hold, unsigned char **mmap_ptr) { char *p; char *c; int rc; PGresult *res; .... ... //Please see here *fd = fa; // use File Address as File Descriptor c = PQgetvalue(res, 0, 1); // SELECT has data as second field //dump_hex(c,16); //printf(" PQgetlength of data = %i\n",PQgetlength(res,0,1)); p = c; // use same pointer for both mmap and core_blk //LOG_DEBUG("Core block address %p for FA %08X (RW)", p, fa); //dump_hex(p,32); /* probably need some validation of block size? */ if (bid != NULL && memcmp(bid, p, 2) != 0 && memcmp(bid, "\x00\x00", 2) != 0) { rc = ERR_RID_MISMATCH; int b1 = *(unsigned char *)p; int b2 = *(unsigned char *)(p+1); int a1 = *(unsigned char *)(bid); int a2 = *(unsigned char *)(bid+1); LOG_ERROR("Error record id mismatch %02X%02X != %02X%02X FA %08X", b1, b2, a1, a2, fa); } else if (rcc != NULL && *rcc != 0 && memcmp(rcc, p+2, 1) != 0) { rc = ERR_RCC_MISMATCH; int b1 = *(unsigned char *)(p+2); int a1 = *(unsigned char *)(rcc); LOG_ERROR("Error rcc mismatch %02X != %02X FA %08X", b1, a1, fa); } else { rc = 0; } *mmap_ptr = c; *core_blk = p; *st_size = blk_size; //dump_hex(*mmap_ptr,1055); } and once after every call is made SQL_get_tpf_rw(), in load_core_resident_fs_data() we then call release_tpf() and FREEC() whose definition is given below my doubt is we are doing FILE_release_tpf() and FREEC() in case of file_path/sql_db = false(data comes from file). how can we avoid mem leaks reported in case of PGresult created when sql_db=true (and it means the data comes from PostgreSQL). ***How do we handle for the case clearing when PGresult object is assigned a pointer to the data of the specified field within the existing PGresult object? i.e when SQL_get_tpf_rw() actually completes in each iteration? ****Is the leak reported due to improper handling of the above case ? or is it due to some other flow c = PQgetvalue(res, 0, 1); // SELECT has data as second field //Below are some more functions definitions int get_tpf_rw( int32_t fa, unsigned char **core_blk, size_t *st_size, unsigned char *bid, unsigned char *rcc, int *fd, bool hold, unsigned char * *mmap_ptr) { if(sql_db == 1)// { return SQL_get_tpf_rw(fa, core_blk, st_size, bid, rcc, fd, hold, mmap_ptr ); // } else //if(sql_db == 0) return FILE_get_tpf_rw(fa, core_blk, st_size, bid, rcc, fd, hold, mmap_ptr ); } void FILE_release_tpf(int32_t fd, unsigned char *mmap_ptr, size_t st_size) { LOG_TRACE("%s() - fd = %i mmap = %p st_size = %i ------------",__func__,fd,mmap_ptr,(int)st_size); munmap(mmap_ptr, st_size); } void release_tpf(int32_t fd, unsigned char *mmap_ptr, size_t st_size) { LOG_TRACE("%s() - fd = %i mmap = %p st_size = %i ------------",__func__,fd,mmap_ptr,(int)st_size); if(!sql_db) { FILE_release_tpf(fd, mmap_ptr, st_size); } } void FREEC( int32_t block) { LOG_TRACE("%s() block %08x ----------------------------------",__func__,block); if(!sql_db) free( (void *)block ); }
fun_def_and_other_details.txt (text/plain, 11.8K) download /*************************************************************************** * PostgreSQL read * * select FileAddress from shc_data fs_data table * mmap_ptr becomes the pointer to the return from SELECT. * core_blk is also teh pointer to the return from SELECT * * call this routine with get_tpf_rw(), tpfasm.h has a #if to specify SQL path or FILE path ***************************************************************************/ int SQL_get_tpf_rw( int32_t fa, unsigned char **core_blk, size_t *st_size, unsigned char *bid, unsigned char *rcc, int *fd, bool hold, unsigned char **mmap_ptr) { char *p; char *c; int rc; struct stat statbuf; PGresult *res; uint32_t fa2 = htonl(fa); char *fa_val = (char *)&fa2; bool hold2 = hold; char *hold_val = (char *)&hold2; const char *paramValues[2] = {fa_val, hold_val}; int paramLengths[2] = {sizeof(fa2), sizeof(hold2)}; int paramFormats[2] = {1, 1}; // identify parameter as binary if(SQL_vsn10) { paramValues[0] = fa_val; paramValues[1] = NULL; paramLengths[0] = sizeof(fa2); paramLengths[1] = 0; paramFormats[0] = 1; paramFormats[1] = 0; } int resultFormat = 1; // binary int nFields = 0; int nTuples = 0; int blk_size = 0; if(bid) { LOG_TRACE("%s() SQL read data from File Address fa(%i) fa(%08X) fa2 htonl(%i) bid (%02X%02X)",__func__,fa,fa,fa2,*bid,*(bid+1)); } else { LOG_TRACE("%s() SQL read data from File Address fa(%i) fa(%08X) fa2 htonl(%i) bid (0)",__func__,fa,fa,fa2); } //LOG_DEBUG("%s() CALL SQL_select_data_procedure1(%i, %i, NULL);",__func__,fa2,hold2); //LOG_DEBUG("%s() SELECT data FROM fs_data WHERE file_address = %i","SQL_select_data_procedure1",fa2); bool is_data_found = false; LOG_DEBUG("%s() SelectDataCommand = %s %i",__func__,SelectDataCommand,fa); LOG_DEBUG("%s() SelectDataNParams = %i",__func__,SelectDataNParams); if(is_shadow_db) { res = PQexecPrepared(shadow_db_conn, SelectDataName, SelectDataNParams, paramValues, paramLengths, paramFormats, resultFormat); if (PQresultStatus(res) == PGRES_TUPLES_OK && ( PQnfields(res) != 0 || PQnfields(res) != 0) ) { is_data_found = true; LOG_DEBUG("SELECT operation succeeded on Shadow DB"); } else LOG_ERROR("SELECT failed on Shadow DB: %s", PQerrorMessage(shadow_db_conn )); } if(is_data_found !=true) { res = PQexecPrepared(conn, SelectDataName, SelectDataNParams, paramValues, paramLengths, paramFormats, resultFormat); } LOG_DEBUG("%s() res = %s",__func__,PQresStatus(PQresultStatus(res))); if ( hold ) { if ( SQL_vsn10 ) { SQL_lock_row(fa); } printSQL(0); } if (PQresultStatus(res) != PGRES_TUPLES_OK) { LOG_ERROR("SELECT failed: %s", PQerrorMessage(conn)); LOG_DEBUG("ROLLBACK TRANSACTION AND CHAIN"); PQclear(res); res = PQexec(conn,"ROLLBACK TRANSACTION AND CHAIN"); LOG_ERROR("INVALID_FILE_ADDRESS %08X",fa); rc = ERR_INVALID_FILE_ADDRESS; if ( ((uint32_t)fa)>>24 != 0x94) { if ( bid != NULL ) { LOG_INFO("missing data: %08x %02x %02x", fa, *bid,*(bid+1)); char str1[8]; int16_t a=*bid; int16_t b=*(bid+1); sprintf(str1,"%02x%02x",a,b); FA[COUNT]=fa; memcpy(REC_ID1[COUNT],str1,5); COUNT++; } else { bid=0x0000; LOG_INFO("missing data: %08x", fa); FA[COUNT++]=fa; REC_ID1[COUNT][0]=0x00; } } PQclear(res); } else { nFields = PQnfields(res); // number of columns nTuples = PQntuples(res); // number of rows //LOG_DEBUG("%s() nFields(cols)=%i nTuples(rows)=%i",__func__,nFields,nTuples); if( nFields == 0 || nTuples == 0) { LOG_ERROR("SELECT failed: NO ROWS RETURNED"); PQclear(res); res = PQexec(conn,"ROLLBACK TRANSACTION AND CHAIN"); LOG_ERROR("INVALID_FILE_ADDRESS %08X",fa); rc = ERR_INVALID_FILE_ADDRESS; if ( ((uint32_t)fa)>>24 != 0x94) { if ( bid != NULL ) { LOG_INFO("missing data: %08x %02x %02x", fa, *bid,*(bid+1)); char str1[8]; int16_t a=*bid; int16_t b=*(bid+1); sprintf(str1,"%02x%02x",a,b); FA[COUNT]=fa; memcpy(REC_ID1[COUNT],str1,5); COUNT++; } else { bid=0x0000; LOG_INFO("missing data: %08x", fa); FA[COUNT++]=fa; REC_ID1[COUNT][0]=0x00; } } PQclear(res); } else { blk_size = ntohl(*(uint32_t *)PQgetvalue (res, 0, 0)); //LOG_DEBUG("%s() blk_size returned is %i",__func__,blk_size); if(blk_size < 127 || blk_size > 4096) { LOG_ERROR("SELECT failed: NO ROWS RETURNED"); PQclear(res); res = PQexec(conn,"ROLLBACK TRANSACTION AND CHAIN"); LOG_ERROR("INVALID_FILE_ADDRESS %08X",fa); rc = ERR_INVALID_FILE_ADDRESS; if ( ((uint32_t)fa)>>24 != 0x94) { if ( bid != NULL ) { LOG_INFO("missing data: %08x %02x %02x", fa, *bid,*(bid+1)); char str1[8]; int16_t a=*bid; int16_t b=*(bid+1); sprintf(str1,"%02x%02x",a,b); FA[COUNT]=fa; memcpy(REC_ID1[COUNT],str1,5); COUNT++; } else { bid=0x0000; LOG_INFO("missing data: %08x", fa); FA[COUNT++]=fa; REC_ID1[COUNT][0]=0x00; } } PQclear(res); } else { *fd = fa; // use File Address as File Descriptor c = PQgetvalue(res, 0, 1); // SELECT has data as second field //dump_hex(c,16); //printf(" PQgetlength of data = %i\n",PQgetlength(res,0,1)); p = c; // use same pointer for both mmap and core_blk //LOG_DEBUG("Core block address %p for FA %08X (RW)", p, fa); //dump_hex(p,32); /* probably need some validation of block size? */ if (bid != NULL && memcmp(bid, p, 2) != 0 && memcmp(bid, "\x00\x00", 2) != 0) { rc = ERR_RID_MISMATCH; int b1 = *(unsigned char *)p; int b2 = *(unsigned char *)(p+1); int a1 = *(unsigned char *)(bid); int a2 = *(unsigned char *)(bid+1); LOG_ERROR("Error record id mismatch %02X%02X != %02X%02X FA %08X", b1, b2, a1, a2, fa); } else if (rcc != NULL && *rcc != 0 && memcmp(rcc, p+2, 1) != 0) { rc = ERR_RCC_MISMATCH; int b1 = *(unsigned char *)(p+2); int a1 = *(unsigned char *)(rcc); LOG_ERROR("Error rcc mismatch %02X != %02X FA %08X", b1, a1, fa); } else { rc = 0; } *mmap_ptr = c; *core_blk = p; *st_size = blk_size; //dump_hex(*mmap_ptr,1055); } } } //LOG_DEBUG("%s() rc = %i",__func__,rc); return rc; } /**** sprintf(SelectDataName,"%s","SelectData"); if(SQL_vsn10) { sprintf(SelectDataCommand,"%s","SELECT blk_size,data FROM fs_data WHERE file_address = $1"); SelectDataNParams = 1; SelectDataParamTypes[0] = 23; // {int} } else { sprintf(SelectDataCommand,"%s","CALL SQL_select_data_procedure($1, $2, NULL, NULL)"); SelectDataNParams = 2; SelectDataParamTypes[0] = 23; // {int} SelectDataParamTypes[1] = 16; // {bool} } ***/ void load_core_resident_fs_data(int fd,char RECbid[],int32_t ordinal_count, int ordinal_ranges[], int ordinal_range_count, int bytes_first_ordinal, int bytes_next_ordinals, int header_strip_bytes, char *base_global,int first_header_strip_bytes, char *SSU) { char RECid[4 + 1] = {0}; if (NULL!= RECbid) { strncpy(RECid, RECbid, 4); } uint16_t Hexid = ascii2hex(RECbid); memcpy(RECbid,&Hexid,2); unsigned char *pREC; int offset; int length; int rep; int fd1; int32_t RECsize = 0; unsigned char *RECcore_blk; size_t RECst_size; int pREClen = 0; int32_t RECfa; int ordinal; int rc; int ordinal_itm = 0; /* Array index for Ordinal ranges */ int max_ordinal_itm = 0; /* Number of ordinal ranges */ unsigned char *copystart; /* Starting position of each ordinal to be copied */ int copylen; /* Length of each ordinal to be copied */ unsigned char *RECrcc = 0x00; unsigned char *RECmmap_ptr; int32_t fa = 0xE8108000; int hashGLOBL =39; int i; init_face_table(); RECsize = (bytes_first_ordinal * 8) + ((ordinal_count-1)*(bytes_next_ordinals)*8); for(ordinal_itm=0; ordinal_itm <=ordinal_range_count ; ordinal_itm+=2) { for(ordinal=ordinal_ranges[ordinal_itm]; ordinal <= ordinal_ranges[ordinal_itm+1]; ordinal++) { if( memcmp(SSU,"CM",2) == 0) { RECfa = ord_to_fa(hashGLOBL, ordinal); }else if( memcmp(SSU,"9X",2) == 0) { if( ordinal > 4095) { fa = 0xE8590000; } RECfa = (fa+ordinal); }else { LOG_ERROR ( " BAD SSU " ); } if (RECfa == -1) { LOG_ERROR("%s() file address NOT FOUND for %s record type %i ordinal %i",__func__,RECid,hashGLOBL,ordinal); } else { rc = get_tpf_rw(RECfa, &RECcore_blk, &RECst_size, (unsigned char*)RECbid, RECrcc, &fd1, false, &RECmmap_ptr); if (rc != 0) { LOG_ERROR("%s() CANNOT READ file address for ID \"%s\"", __func__, RECid); } if (ordinal==ordinal_ranges[0]) { copystart = RECcore_blk + first_header_strip_bytes; copylen = bytes_first_ordinal * 8; } else { copystart = RECcore_blk + header_strip_bytes; copylen = bytes_next_ordinals * 8; } int bytes = write(fd,copystart,copylen); if( bytes == -1 ){ LOG_ERROR("%s() WRITE IF FAILED for \"%x\" %d",__func__,RECcore_blk,bytes); } //FILE_release_tpf(fd1, RECmmap_ptr, RECst_size); release_tpf(fd1, RECmmap_ptr, RECst_size); FREEC((int32_t)RECcore_blk); } } } } int get_tpf_rw( int32_t fa, unsigned char **core_blk, size_t *st_size, unsigned char *bid, unsigned char *rcc, int *fd, bool hold, unsigned char * *mmap_ptr) { if(sql_db == 1)// { return SQL_get_tpf_rw(fa, core_blk, st_size, bid, rcc, fd, hold, mmap_ptr ); // } else //if(sql_db == 0) return FILE_get_tpf_rw(fa, core_blk, st_size, bid, rcc, fd, hold, mmap_ptr ); } void FILE_release_tpf(int32_t fd, unsigned char *mmap_ptr, size_t st_size) { LOG_TRACE("%s() - fd = %i mmap = %p st_size = %i ------------",__func__,fd,mmap_ptr,(int)st_size); munmap(mmap_ptr, st_size); } void release_tpf(int32_t fd, unsigned char *mmap_ptr, size_t st_size) { LOG_TRACE("%s() - fd = %i mmap = %p st_size = %i ------------",__func__,fd,mmap_ptr,(int)st_size); if(!sql_db) { FILE_release_tpf(fd, mmap_ptr, st_size); } } void FREEC( int32_t block) { LOG_TRACE("%s() block %08x ----------------------------------",__func__,block); if(!sql_db) free( (void *)block ); }
^ permalink raw reply [nested|flat] 8+ messages in thread

* Re: Help needed for the resolution of memory leak
@ 2024-01-18 01:05  Merlin Moncure <mmoncure@gmail.com>
  parent: Sasmit Utkarsh <utkarshsasmit@gmail.com>
  0 siblings, 1 reply; 8+ messages in thread

From: Merlin Moncure @ 2024-01-18 01:05 UTC (permalink / raw)
  To: Sasmit Utkarsh <utkarshsasmit@gmail.com>; +Cc: pgsql-general@lists.postgresql.org

On Wed, Jan 17, 2024 at 1:14 PM Sasmit Utkarsh <utkarshsasmit@gmail.com>
wrote:

> Hi Merlin et al.
>
> Below are some couple of observations attached as an "overview_of_code"
> and other attachments "function_def_other_details" and leak sanitizer
> report. Please assist with some clarifications given in overview_of_code
> with (***). Let me know if you need any more information
>

***How do we handle for the case clearing when PGresult object is
assigned a pointer to the data of the specified field within the
existing PGresult object?
i.e when SQL_get_tpf_rw() actually completes in each iteration?



It is your responsibility to close PGResult and PGConn objects.  Each
one created must be cleaned up.  This is basic libpq usage.  I suggest
studying the documentation.



Start here: https://www.postgresql.org/docs/current/libpq-exec.html

Also Study here: https://www.postgresql.org/docs/current/libpq-example.html


You should not reuse a pointer unless you have cleared the object first.


****Is the leak reported due to improper handling of the above case ?
or is it due to some other flow

Your leaks look mostly due to not cleaning PGResult.  However, the
real issue here is you need to learn basic libpq usage a little
better...try writing a smaller program and see when it starts to
complain about leaks.


merlin

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: Help needed for the resolution of memory leak
@ 2024-01-18 05:58  Sasmit Utkarsh <utkarshsasmit@gmail.com>
  parent: Merlin Moncure <mmoncure@gmail.com>
  0 siblings, 0 replies; 8+ messages in thread

From: Sasmit Utkarsh @ 2024-01-18 05:58 UTC (permalink / raw)
  To: Merlin Moncure <mmoncure@gmail.com>; +Cc: pgsql-general@lists.postgresql.org

ok Thanks Merlin, I will go through the above specified doc and get back in
case of further questions

Regards,
Sasmit Utkarsh
+91-7674022625


On Thu, Jan 18, 2024 at 6:36 AM Merlin Moncure <mmoncure@gmail.com> wrote:

> On Wed, Jan 17, 2024 at 1:14 PM Sasmit Utkarsh <utkarshsasmit@gmail.com>
> wrote:
>
>> Hi Merlin et al.
>>
>> Below are some couple of observations attached as an "overview_of_code"
>> and other attachments "function_def_other_details" and leak sanitizer
>> report. Please assist with some clarifications given in overview_of_code
>> with (***). Let me know if you need any more information
>>
>
> ***How do we handle for the case clearing when PGresult object is assigned a pointer to the data of the specified field within the existing PGresult object?
> i.e when SQL_get_tpf_rw() actually completes in each iteration?
>
>
>
> It is your responsibility to close PGResult and PGConn objects.  Each one created must be cleaned up.  This is basic libpq usage.  I suggest studying the documentation.
>
>
>
> Start here: https://www.postgresql.org/docs/current/libpq-exec.html
>
> Also Study here: https://www.postgresql.org/docs/current/libpq-example.html
>
>
> You should not reuse a pointer unless you have cleared the object first.
>
>
> ****Is the leak reported due to improper handling of the above case ? or is it due to some other flow
>
> Your leaks look mostly due to not cleaning PGResult.  However, the real issue here is you need to learn basic libpq usage a little better...try writing a smaller program and see when it starts to complain about leaks.
>
>
> merlin
>
>

^ permalink  raw  reply  [nested|flat] 8+ messages in thread


end of thread, other threads:[~2024-01-18 05:58 UTC | newest]

Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-01-15 17:32 Help needed for the resolution of memory leak Sasmit Utkarsh <utkarshsasmit@gmail.com>
2024-01-15 20:00 ` Merlin Moncure <mmoncure@gmail.com>
2024-01-16 15:09   ` Sasmit Utkarsh <utkarshsasmit@gmail.com>
2024-01-16 22:41     ` Merlin Moncure <mmoncure@gmail.com>
2024-01-17 07:22       ` Sasmit Utkarsh <utkarshsasmit@gmail.com>
2024-01-17 19:14         ` Sasmit Utkarsh <utkarshsasmit@gmail.com>
2024-01-18 01:05           ` Merlin Moncure <mmoncure@gmail.com>
2024-01-18 05:58             ` Sasmit Utkarsh <utkarshsasmit@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox