Odd response from server

From: Rui Pacheco <rui(dot)pacheco(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Odd response from server
Date: 2017-02-18 23:54:42
Message-ID: 317D1663-254D-4122-8E54-A782772CC8F3@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I’m trying to send a Parse message with the name “my_name” and the statement “select * from departments” and no type id’s, along with a flush message:

'P','\0','\0','\0','(','m','y','_','n','a','m','e','\0','s','e','l','e','c','t',' ','*',' ','f','r','o','m',' ','d','e','p','a','r','t','m','e','n','t','s','\0','\0','\0','\0','\0','\0','H','\0','\0','\0','\x04’

I get the ParseComplete response AND a FATAL error:

'1','\0','\0','\0','\x04','E','\0','\0','\0','T','S','F','A','T','A','L','\0','C','0','8','P','0','1','\0','M','i','n','v','a','l','i','d',' ','f','r','o','n','t','e','n','d',' ','m','e','s','s','a','g','e',' ','t','y','p','e',' ','0','\0','F','p','o','s','t','g','r','e','s','.','c','\0','L','4','8','4','\0','R','S','o','c','k','e','t','B','a','c','k','e','n','d','\0','\0’

After this my program exits and the only message sent after this is the terminate message, for which no error is returned.

I’ve broken down my app and these are the only messages being sent to the server, apart from the login/terminate exchange. Postgres logs also show that the statement is parsed but then the error is raised:

2017-02-19 00:51:12 CET DEBUG: forked new backend, pid=93376 socket=12
2017-02-19 00:51:15 CET [unknown]DEBUG: postgres child[93376]: starting with (
2017-02-19 00:51:15 CET [unknown]DEBUG: postgres
2017-02-19 00:51:15 CET [unknown]DEBUG: )
2017-02-19 00:51:15 CET [unknown]DEBUG: InitPostgres
2017-02-19 00:51:15 CET [unknown]DEBUG: my backend ID is 2
2017-02-19 00:51:15 CET [unknown]DEBUG: StartTransaction
2017-02-19 00:51:15 CET [unknown]DEBUG: name: unnamed; blockState: DEFAULT; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
2017-02-19 00:51:15 CET [unknown]DEBUG: CommitTransaction
2017-02-19 00:51:15 CET [unknown]DEBUG: name: unnamed; blockState: STARTED; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
2017-02-19 00:51:15 CET [unknown]DEBUG: parse my_name: select * from departments
2017-02-19 00:51:15 CET [unknown]STATEMENT: select * from departments
2017-02-19 00:51:15 CET [unknown]DEBUG: StartTransactionCommand
2017-02-19 00:51:15 CET [unknown]STATEMENT: select * from departments
2017-02-19 00:51:15 CET [unknown]DEBUG: StartTransaction
2017-02-19 00:51:15 CET [unknown]STATEMENT: select * from departments
2017-02-19 00:51:15 CET [unknown]DEBUG: name: unnamed; blockState: DEFAULT; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
2017-02-19 00:51:15 CET [unknown]STATEMENT: select * from departments
2017-02-19 00:51:15 CET [unknown]FATAL: invalid frontend message type 0
2017-02-19 00:51:15 CET [unknown]DEBUG: shmem_exit(1): 1 before_shmem_exit callbacks to make
2017-02-19 00:51:15 CET [unknown]DEBUG: shmem_exit(1): 6 on_shmem_exit callbacks to make
2017-02-19 00:51:15 CET [unknown]DEBUG: proc_exit(1): 3 callbacks to make
2017-02-19 00:51:15 CET [unknown]DEBUG: exit(1)
2017-02-19 00:51:15 CET [unknown]LOG: could not send data to client: Bad file descriptor
2017-02-19 00:51:15 CET [unknown]DEBUG: shmem_exit(-1): 0 before_shmem_exit callbacks to make
2017-02-19 00:51:15 CET [unknown]DEBUG: shmem_exit(-1): 0 on_shmem_exit callbacks to make
2017-02-19 00:51:15 CET [unknown]DEBUG: proc_exit(-1): 0 callbacks to make
2017-02-19 00:51:15 CET DEBUG: reaping dead processes

What I find strange is that if the server seems to be able to parse the message then why raise the FATAL error?

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2017-02-19 00:26:23 Re: Odd response from server
Previous Message Tomas Vondra 2017-02-18 23:06:43 Re: Unexpected WAL-archive restore behaviour