View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0000168 | Pgpool-II | Bug | public | 2016-03-03 03:11 | 2016-03-03 15:03 |
| Reporter | test11 | Assigned To | t-ishii | ||
| Priority | urgent | Severity | major | Reproducibility | always |
| Status | resolved | Resolution | open | ||
| Summary | 0000168: 3.5.0 issues with php-pdo | ||||
| Description | If you run a syntactically erroneous query with a php-pdo client, pgpool-II 3.5.0 will not forward the error message to the frontend, and the client will wait for it infinitely. This bug appeared in version 3.5, in stream replication mode. It's something correlated with this block of code: else if (STREAM) { /* XXX fix me:even with streaming replication mode, couldn't we have a deadlock */ pool_set_query_in_progress(); pool_extended_send_and_wait(query_context, "P", len, contents, 1, MASTER_NODE_ID, true); pool_extended_send_and_wait(query_context, "P", len, contents, -1, MASTER_NODE_ID, true); pool_add_sent_message(session_context->uncompleted_message); pool_unset_query_in_progress(); } if you comment out the line pool_unset_query_in_progress();, everything works as expected, but i'm not sure about the drawbacks of this change. | ||||
| Steps To Reproduce | php -r '$p = new PDO("pgsql:host=127.0.0.1","postgres","your_pw");try{$s=$p->prepare("blah");$s->execute();}catch(Exception $e){var_dump($e);}' | ||||
| Additional Information | 2016-03-02 19:06:22: pid 146308: DETAIL: received kind 'P'(50) from frontend 2016-03-02 19:06:22: pid 146308: DEBUG: session context: clearing doing extended query messaging. DONE 2016-03-02 19:06:22: pid 146308: DEBUG: session context: setting doing extended query messaging. DONE 2016-03-02 19:06:22: pid 146308: DEBUG: Parse: statement name <pdo_stmt_00000001> 2016-03-02 19:06:22: pid 146308: LOG: Unable to parse the query: "insert blah" from client 10.0.0.30(51264) 2016-03-02 19:06:22: pid 146308: DEBUG: session context: setting query in progress. DONE 2016-03-02 19:06:22: pid 146308: DEBUG: decide where to send the queries 2016-03-02 19:06:22: pid 146308: DETAIL: destination = 0 for query= "insert blah" 2016-03-02 19:06:22: pid 146308: DEBUG: session context: setting query in progress. DONE 2016-03-02 19:06:22: pid 146308: DEBUG: pool_write: to backend: kind:P 2016-03-02 19:06:22: pid 146308: DEBUG: called by pool_add_sent_message: sent message: address: 1d6e7e0 kind: P name: =pdo_stmt_00000001= 2016-03-02 19:06:22: pid 146308: DEBUG: session context: unsetting query in progress. DONE 2016-03-02 19:06:22: pid 146308: DEBUG: processing frontend response 2016-03-02 19:06:22: pid 146308: DETAIL: received kind 'S'(53) from frontend 2016-03-02 19:06:22: pid 146308: DEBUG: session context: clearing doing extended query messaging. DONE 2016-03-02 19:06:22: pid 146308: DEBUG: session context: setting doing extended query messaging. DONE 2016-03-02 19:06:22: pid 146308: DEBUG: session context: setting query in progress. DONE 2016-03-02 19:06:22: pid 146308: DEBUG: pool_write: to backend: kind:S 2016-03-02 19:06:22: pid 146308: DEBUG: pool_read: read 86 bytes from backend 0 2016-03-02 19:06:22: pid 146308: DEBUG: reading backend data packet kind 2016-03-02 19:06:22: pid 146308: DETAIL: master node id: 0 2016-03-02 19:06:22: pid 146308: DEBUG: reading backend data packet kind 2016-03-02 19:06:22: pid 146308: DETAIL: backend:0 of 3 kind = 'E' 2016-03-02 19:06:22: pid 146308: DEBUG: read_kind_from_backend max_count:1.000000 num_executed_nodes:1 2016-03-02 19:06:22: pid 146308: DEBUG: processing backend response 2016-03-02 19:06:22: pid 146308: DETAIL: received kind 'E'(45) from backend 2016-03-02 19:06:22: pid 146308: DEBUG: SimpleForwardToFrontend: packet:E length:81 2016-03-02 19:06:22: pid 146308: DEBUG: session context: clearing transaction isolation. DONE 2016-03-02 19:06:22: pid 146308: DEBUG: session context: setting ignore till sync. DONE 2016-03-02 19:06:22: pid 146308: DEBUG: session context: unsetting query in progress. DONE 2016-03-02 19:06:22: pid 146308: DEBUG: pool_read: read 6 bytes from backend 0 2016-03-02 19:06:22: pid 146308: DEBUG: detect error: kind: Z 2016-03-02 19:06:22: pid 146308: DEBUG: detect error: kind: Z 2016-03-02 19:06:22: pid 146308: DEBUG: detect error: kind: Z | ||||
| Tags | No tags attached. | ||||
|
|
Sounds like a similar problem in: http://www.pgpool.net/mantisbt/view.php?id=167 Can you please try the fix attached to above (bug167.diff)? |
|
|
In my case, the load_balancing mode on/off, is irrelevant (the query cannot be parsed, why should it be load balanced?). Anyway, i've tried the bug167.diff, and the behaviour (and the debug output) is the same in all of scenarios: with or without path, with or without load balancing. It's really easy to reproduce, just run that cli command against pgpool 3.5 or against 3.4/raw postgres php -r '$p = new PDO("pgsql:host=127.0.0.1 port=5432","postgres","pass");$s=$p->prepare("blah");$s->execute();var_dump($s->errorInfo());' the result should be (3.4/raw postgres): array(3) { [0]=> string(5) "42601" [1]=> int(7) [2]=> string(61) "ERROR: syntax error at or near "blah" LINE 1: blah ^" } but in 3.5 the client will hang up waiting for pgpool response |
|
|
|
|
|
I found different cause of your problem. Can you please try attached patch (pdo.diff) against V3_5_STABLE? You need the latest V3_5_STABLE head source. If you don't have that, you can try the patch: http://git.postgresql.org/gitweb/?p=pgpool2.git;a=commit;h=d8a8eb83e735734895a4def9a96a7ff83dd56517 |
|
|
Yes, it works. Thank you! |
|
|
Glad to hear that. Thanks for the feedback! |
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2016-03-03 03:11 | test11 | New Issue | |
| 2016-03-03 07:35 | t-ishii | Assigned To | => t-ishii |
| 2016-03-03 07:35 | t-ishii | Status | new => feedback |
| 2016-03-03 07:39 | t-ishii | Note Added: 0000664 | |
| 2016-03-03 13:49 | test11 | Note Added: 0000665 | |
| 2016-03-03 13:49 | test11 | Status | feedback => assigned |
| 2016-03-03 13:51 | test11 | Note Edited: 0000665 | |
| 2016-03-03 14:19 | t-ishii | File Added: pdo.diff | |
| 2016-03-03 14:22 | t-ishii | Note Added: 0000666 | |
| 2016-03-03 14:42 | t-ishii | Status | assigned => feedback |
| 2016-03-03 14:47 | test11 | Note Added: 0000667 | |
| 2016-03-03 14:47 | test11 | Status | feedback => assigned |
| 2016-03-03 15:02 | t-ishii | Note Added: 0000668 | |
| 2016-03-03 15:03 | t-ishii | Status | assigned => resolved |