[pgpool-general: 7968] Re: Hang with Skunk because Flush not honoured
ishii at sraoss.co.jp
Sun Jan 9 15:57:06 JST 2022
> We are trying to use a Scala Skunk client with a Pgpool-II server. Skunk uses the extended protocol for prepared statements and checks every step for errors. To this end, it uses the following protocol sequence:
> 1. Parse
> 2. Flush
> 3. Await response and check for errors
> 4. Describe statement
> 5. Flush
> 6. Await response and check for errors
> 7. Bind
> 8. Flush
> 9. Await response and check for errors
> 10. Execute
> 11. Flush
> 12. Await response and check for errors
> 13. Close portal
> 14. Flush
> 15. Await response and check for errors
> 16. Close statement
> 17. Flush
> 18. Await response and check for errors
> However, while Pgpool-II forwards the Flush commands to the upstream PostgreSQL server, it buffers the ParseComplete and BindComplete responses despite the Flush. They never reach the downstream Skunk client, and the connection sits idle forever. The client duly awaits the response data and cannot proceed further, but it has no way to force Pgpool-II to send it. If I understand correctly, Pgpool-II is technically in the wrong here, as much as Skunk’s approach may not be the most efficient.
> The same issue was observed with Describe back in March and worked around by forcing RowDescription messages to be flushed always:
> However, this clearly affects more than just Describe.
> (I can confirm that if I hack Skunk to send Parse and Describe together, it does receive the responses up to RowDescription and hangs waiting for BindComplete instead.)
> I see the Pgpool-II TODO wiki page mentions Flush tracking.
I am thinking about to implement the flush tracking for the next
Pgpool-II major release.
> But until that is implemented, shouldn’t SimpleForwardToFrontend rather default to flushing *all* responses and have a list of specific exceptions that are allowed to be buffered because the protocol guarantees that they are followed by flushable messages?
I think the change is too risky for major applications such as JDBC in
term of performance degration. Instead of this, I have implemented
"simple" flush message tracking. It remebers there is a pending flush
request when a flush message is sent from client. When a response
message from backend is received, the response is flushed to
frontend. The limitation is that it only flushes last 1 reply
will work as expected. Because Parse complete is flushed.
may not work as expected.
Parse complete is flushed but Bind complete may not be flushed.
What do you think?
SRA OSS, Inc. Japan
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 2012 bytes
Desc: not available
More information about the pgpool-general