pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Re-simplify management of inStart in pqParseInput3's subroutines 6+ messages / 1 participants [nested] [flat]
* pgsql: Re-simplify management of inStart in pqParseInput3's subroutines @ 2021-03-11 19:44 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2021-03-11 19:44 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Re-simplify management of inStart in pqParseInput3's subroutines. Commit 92785dac2 copied some logic related to advancement of inStart from pqParseInput3 into getRowDescriptions and getAnotherTuple, because it wanted to allow user-defined row processor callbacks to potentially longjmp out of the library, and inStart would have to be updated before that happened to avoid an infinite loop. We later decided that that API was impossibly fragile and reverted it, but we didn't undo all of the related code changes, and this bit of messiness survived. Undo it now so that there's just one place in pqParseInput3's processing where inStart is advanced; this will simplify addition of better tracing support. getParamDescriptions had grown similar processing somewhere along the way (not in 92785dac2; I didn't track down just when), but it's actually buggy because its handling of corrupt-message cases seems to have been copied from the v2 logic where we lacked a known message length. The cases where we "goto not_enough_data" should not simply return EOF, because then we won't consume the message, potentially creating an infinite loop. That situation now represents a definitively corrupt message, and we should report it as such. Although no field reports of getParamDescriptions getting stuck in a loop have been seen, it seems appropriate to back-patch that fix. I chose to back-patch all of this to keep the logic looking more alike in supported branches. Discussion: https://postgr.es/m/2217283.1615411989@sss.pgh.pa.us Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/51c54bb603098416dc6f9d9d46a3d14861f8fc38 Modified Files -------------- src/interfaces/libpq/fe-protocol3.c | 80 +++++++++++-------------------------- 1 file changed, 23 insertions(+), 57 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Re-simplify management of inStart in pqParseInput3's subroutines @ 2021-03-11 19:44 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2021-03-11 19:44 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Re-simplify management of inStart in pqParseInput3's subroutines. Commit 92785dac2 copied some logic related to advancement of inStart from pqParseInput3 into getRowDescriptions and getAnotherTuple, because it wanted to allow user-defined row processor callbacks to potentially longjmp out of the library, and inStart would have to be updated before that happened to avoid an infinite loop. We later decided that that API was impossibly fragile and reverted it, but we didn't undo all of the related code changes, and this bit of messiness survived. Undo it now so that there's just one place in pqParseInput3's processing where inStart is advanced; this will simplify addition of better tracing support. getParamDescriptions had grown similar processing somewhere along the way (not in 92785dac2; I didn't track down just when), but it's actually buggy because its handling of corrupt-message cases seems to have been copied from the v2 logic where we lacked a known message length. The cases where we "goto not_enough_data" should not simply return EOF, because then we won't consume the message, potentially creating an infinite loop. That situation now represents a definitively corrupt message, and we should report it as such. Although no field reports of getParamDescriptions getting stuck in a loop have been seen, it seems appropriate to back-patch that fix. I chose to back-patch all of this to keep the logic looking more alike in supported branches. Discussion: https://postgr.es/m/2217283.1615411989@sss.pgh.pa.us Branch ------ REL_13_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/3580b4a0cde03d39e47c70a2078c23d2c0a96c97 Modified Files -------------- src/interfaces/libpq/fe-protocol3.c | 80 +++++++++++-------------------------- 1 file changed, 23 insertions(+), 57 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Re-simplify management of inStart in pqParseInput3's subroutines @ 2021-03-11 19:44 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2021-03-11 19:44 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Re-simplify management of inStart in pqParseInput3's subroutines. Commit 92785dac2 copied some logic related to advancement of inStart from pqParseInput3 into getRowDescriptions and getAnotherTuple, because it wanted to allow user-defined row processor callbacks to potentially longjmp out of the library, and inStart would have to be updated before that happened to avoid an infinite loop. We later decided that that API was impossibly fragile and reverted it, but we didn't undo all of the related code changes, and this bit of messiness survived. Undo it now so that there's just one place in pqParseInput3's processing where inStart is advanced; this will simplify addition of better tracing support. getParamDescriptions had grown similar processing somewhere along the way (not in 92785dac2; I didn't track down just when), but it's actually buggy because its handling of corrupt-message cases seems to have been copied from the v2 logic where we lacked a known message length. The cases where we "goto not_enough_data" should not simply return EOF, because then we won't consume the message, potentially creating an infinite loop. That situation now represents a definitively corrupt message, and we should report it as such. Although no field reports of getParamDescriptions getting stuck in a loop have been seen, it seems appropriate to back-patch that fix. I chose to back-patch all of this to keep the logic looking more alike in supported branches. Discussion: https://postgr.es/m/2217283.1615411989@sss.pgh.pa.us Branch ------ REL_12_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/56defbdd0f4e152545c50619385902ed060dca61 Modified Files -------------- src/interfaces/libpq/fe-protocol3.c | 80 +++++++++++-------------------------- 1 file changed, 23 insertions(+), 57 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Re-simplify management of inStart in pqParseInput3's subroutines @ 2021-03-11 19:44 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2021-03-11 19:44 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Re-simplify management of inStart in pqParseInput3's subroutines. Commit 92785dac2 copied some logic related to advancement of inStart from pqParseInput3 into getRowDescriptions and getAnotherTuple, because it wanted to allow user-defined row processor callbacks to potentially longjmp out of the library, and inStart would have to be updated before that happened to avoid an infinite loop. We later decided that that API was impossibly fragile and reverted it, but we didn't undo all of the related code changes, and this bit of messiness survived. Undo it now so that there's just one place in pqParseInput3's processing where inStart is advanced; this will simplify addition of better tracing support. getParamDescriptions had grown similar processing somewhere along the way (not in 92785dac2; I didn't track down just when), but it's actually buggy because its handling of corrupt-message cases seems to have been copied from the v2 logic where we lacked a known message length. The cases where we "goto not_enough_data" should not simply return EOF, because then we won't consume the message, potentially creating an infinite loop. That situation now represents a definitively corrupt message, and we should report it as such. Although no field reports of getParamDescriptions getting stuck in a loop have been seen, it seems appropriate to back-patch that fix. I chose to back-patch all of this to keep the logic looking more alike in supported branches. Discussion: https://postgr.es/m/2217283.1615411989@sss.pgh.pa.us Branch ------ REL_11_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/d3a557894ce0dce0d5241563b2159c24816e6b35 Modified Files -------------- src/interfaces/libpq/fe-protocol3.c | 80 +++++++++++-------------------------- 1 file changed, 23 insertions(+), 57 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Re-simplify management of inStart in pqParseInput3's subroutines @ 2021-03-11 19:44 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2021-03-11 19:44 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Re-simplify management of inStart in pqParseInput3's subroutines. Commit 92785dac2 copied some logic related to advancement of inStart from pqParseInput3 into getRowDescriptions and getAnotherTuple, because it wanted to allow user-defined row processor callbacks to potentially longjmp out of the library, and inStart would have to be updated before that happened to avoid an infinite loop. We later decided that that API was impossibly fragile and reverted it, but we didn't undo all of the related code changes, and this bit of messiness survived. Undo it now so that there's just one place in pqParseInput3's processing where inStart is advanced; this will simplify addition of better tracing support. getParamDescriptions had grown similar processing somewhere along the way (not in 92785dac2; I didn't track down just when), but it's actually buggy because its handling of corrupt-message cases seems to have been copied from the v2 logic where we lacked a known message length. The cases where we "goto not_enough_data" should not simply return EOF, because then we won't consume the message, potentially creating an infinite loop. That situation now represents a definitively corrupt message, and we should report it as such. Although no field reports of getParamDescriptions getting stuck in a loop have been seen, it seems appropriate to back-patch that fix. I chose to back-patch all of this to keep the logic looking more alike in supported branches. Discussion: https://postgr.es/m/2217283.1615411989@sss.pgh.pa.us Branch ------ REL_10_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/d2be6cdc55ad0eb0fa019a453491e1410c5315e8 Modified Files -------------- src/interfaces/libpq/fe-protocol3.c | 80 +++++++++++-------------------------- 1 file changed, 23 insertions(+), 57 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Re-simplify management of inStart in pqParseInput3's subroutines @ 2021-03-11 19:44 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2021-03-11 19:44 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Re-simplify management of inStart in pqParseInput3's subroutines. Commit 92785dac2 copied some logic related to advancement of inStart from pqParseInput3 into getRowDescriptions and getAnotherTuple, because it wanted to allow user-defined row processor callbacks to potentially longjmp out of the library, and inStart would have to be updated before that happened to avoid an infinite loop. We later decided that that API was impossibly fragile and reverted it, but we didn't undo all of the related code changes, and this bit of messiness survived. Undo it now so that there's just one place in pqParseInput3's processing where inStart is advanced; this will simplify addition of better tracing support. getParamDescriptions had grown similar processing somewhere along the way (not in 92785dac2; I didn't track down just when), but it's actually buggy because its handling of corrupt-message cases seems to have been copied from the v2 logic where we lacked a known message length. The cases where we "goto not_enough_data" should not simply return EOF, because then we won't consume the message, potentially creating an infinite loop. That situation now represents a definitively corrupt message, and we should report it as such. Although no field reports of getParamDescriptions getting stuck in a loop have been seen, it seems appropriate to back-patch that fix. I chose to back-patch all of this to keep the logic looking more alike in supported branches. Discussion: https://postgr.es/m/2217283.1615411989@sss.pgh.pa.us Branch ------ REL9_6_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/a98e53e10dd5e9278c62b49406f30c1d7e28ab0a Modified Files -------------- src/interfaces/libpq/fe-protocol3.c | 80 +++++++++++-------------------------- 1 file changed, 23 insertions(+), 57 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2021-03-11 19:44 UTC | newest] Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2021-03-11 19:44 pgsql: Re-simplify management of inStart in pqParseInput3's subroutines Tom Lane <tgl@sss.pgh.pa.us> 2021-03-11 19:44 pgsql: Re-simplify management of inStart in pqParseInput3's subroutines Tom Lane <tgl@sss.pgh.pa.us> 2021-03-11 19:44 pgsql: Re-simplify management of inStart in pqParseInput3's subroutines Tom Lane <tgl@sss.pgh.pa.us> 2021-03-11 19:44 pgsql: Re-simplify management of inStart in pqParseInput3's subroutines Tom Lane <tgl@sss.pgh.pa.us> 2021-03-11 19:44 pgsql: Re-simplify management of inStart in pqParseInput3's subroutines Tom Lane <tgl@sss.pgh.pa.us> 2021-03-11 19:44 pgsql: Re-simplify management of inStart in pqParseInput3's subroutines Tom Lane <tgl@sss.pgh.pa.us>
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