Getting blocked when receinving response from a Parse message...

Started by Francisco Figueiredo Jr.almost 23 years ago8 messageshackers
Jump to latest
#1Francisco Figueiredo Jr.
francisco@npgsql.org

Hi all,

I'm playing with this for one week with no luck... :(

I'm implementing the 3.0 protocol version in Npgsql, a .Net Data
provider for postgresql.

I could get it working using the simple query and so, I started to work
in the extended query.

I stopped in the first message: Parse :(

I send the parse message but I don't receive the ParseComplete or the
ErrorResponse. My code simply freezes while reading the byte from
network stream.

I added some elog lines to check that I was sending the message
correctly. I could even check that pq_putemptymessage('1') is being
called in the exec_parse_message() method, but I don't know why I'm
getting blocked when reading the data.

It is strange because all the simple query mode tests I did work very
well. Just this Parse message isn't working for me.

Am I missing something?

I'm using the latest cvs code on cygwin.

Thanks in advance.

--
Regards,

Francisco Figueiredo Jr.

------
"My grandfather once told me that there are two
kinds of people: those
who work and those who take the credit. He told me
to try to be in the
first group; there was less competition there."
- Indira Gandhi

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Francisco Figueiredo Jr. (#1)
Re: Getting blocked when receinving response from a Parse message...

"Francisco Figueiredo Jr." <fxjrlists@yahoo.com.br> writes:

I'm implementing the 3.0 protocol version in Npgsql, a .Net Data
provider for postgresql.

I stopped in the first message: Parse :(
I send the parse message but I don't receive the ParseComplete or the
ErrorResponse. My code simply freezes while reading the byte from
network stream.

You must send either Flush or Sync after the Parse to force the backend
to emit its response to Parse. The assumption is that in many cases
you'll be sending Parse as part of a batch of commands, and the backend
should batch its responses to minimize the number of network packets
sent. So you have to tell it where the batch boundaries are --- thus,
Flush or Sync. See the docs concerning the difference between the two.

regards, tom lane

#3Carlos Guzman Alvarez
carlosga@telefonica.net
In reply to: Tom Lane (#2)
Re: Getting blocked when receinving response from a Parse message...

Hello:

You must send either Flush or Sync after the Parse to force the backend
to emit its response to Parse. The assumption is that in many cases
you'll be sending Parse as part of a batch of commands, and the backend
should batch its responses to minimize the number of network packets
sent. So you have to tell it where the batch boundaries are --- thus,
Flush or Sync. See the docs concerning the difference between the two.

I have the same problem some days ago with the implementation of the
version 3.0 protocol in C# and now using Flush it's working quite well :)

--
Best regards

#4Francisco Figueiredo Jr.
francisco@npgsql.org
In reply to: Tom Lane (#2)
Re: Getting blocked when receinving response from a Parse

Tom Lane wrote:

"Francisco Figueiredo Jr." <fxjrlists@yahoo.com.br> writes:

I'm implementing the 3.0 protocol version in Npgsql, a .Net Data
provider for postgresql.

I stopped in the first message: Parse :(
I send the parse message but I don't receive the ParseComplete or the
ErrorResponse. My code simply freezes while reading the byte from
network stream.

You must send either Flush or Sync after the Parse to force the backend
to emit its response to Parse. The assumption is that in many cases
you'll be sending Parse as part of a batch of commands, and the backend
should batch its responses to minimize the number of network packets
sent. So you have to tell it where the batch boundaries are --- thus,
Flush or Sync. See the docs concerning the difference between the two.

Oohh, thanks, Tom Lane!
I didn't read carefully the final part of extended query where it says
about the Flush message :)

I didn't realize the idea of holding responses to minimize network
traffic. I was thinking in the send reply style :)

--
Regards,

Francisco Figueiredo Jr.

------
"My grandfather once told me that there are two
kinds of people: those
who work and those who take the credit. He told me
to try to be in the
first group; there was less competition there."
- Indira Gandhi

#5Francisco Figueiredo Jr.
francisco@npgsql.org
In reply to: Carlos Guzman Alvarez (#3)
Re: Getting blocked when receinving response from a Parse

Carlos Guzman Alvarez wrote:

Hello:

You must send either Flush or Sync after the Parse to force the backend
to emit its response to Parse. The assumption is that in many cases
you'll be sending Parse as part of a batch of commands, and the backend
should batch its responses to minimize the number of network packets
sent. So you have to tell it where the batch boundaries are --- thus,
Flush or Sync. See the docs concerning the difference between the two.

I have the same problem some days ago with the implementation of the
version 3.0 protocol in C# and now using Flush it's working quite well :)

Thanks Carlos.

Uhmmm, if you don't mind... are you implementing something like a data
provider for Postgresql, or it is just an ad hoc program?

--
Regards,

Francisco Figueiredo Jr.

------
"My grandfather once told me that there are two
kinds of people: those
who work and those who take the credit. He told me
to try to be in the
first group; there was less competition there."
- Indira Gandhi

#6Carlos Guzman Alvarez
carlosga@telefonica.net
In reply to: Francisco Figueiredo Jr. (#5)
Re: Getting blocked when receinving response from a Parse

Hello:

Uhmmm, if you don't mind... are you implementing something like a data
provider for Postgresql, or it is just an ad hoc program?

Well i start making a simple library for 3.0 protocol for curiosity only
:), the protocol have a great documentation, but after some some days
i decide to try to make a Data Provider for protocol 3.0 only (I already
have made a Data Provider for other RDMBMS :)),

--
Best regards

Carlos Guzm�n �lvarez
Vigo-Spain

#7Francisco Figueiredo Jr.
francisco@npgsql.org
In reply to: Carlos Guzman Alvarez (#6)
Re: Getting blocked when receinving response from a Parse

Carlos Guzman Alvarez wrote:

Hello:

Uhmmm, if you don't mind... are you implementing something like a data
provider for Postgresql, or it is just an ad hoc program?

Well i start making a simple library for 3.0 protocol for curiosity only
:), the protocol have a great documentation, but after some some days i
decide to try to make a Data Provider for protocol 3.0 only (I already
have made a Data Provider for other RDMBMS :)),

That's very good!
Do you know about Npgsql?
Please, have a look at gborg.postgresql.org/project/npgsql.
It is a Postgresql .net data provider written 100% in C#.
Maybe you could give some tips, suggestions, improvements, bug fixes... :)

I'm right now implementing the extended query mode and as you and Tom
Lane said, the Flush message worked very well. Thanks again.

--
Regards,

Francisco Figueiredo Jr.

------
"My grandfather once told me that there are two
kinds of people: those
who work and those who take the credit. He told me
to try to be in the
first group; there was less competition there."
- Indira Gandhi

#8Carlos Guzman Alvarez
carlosga@telefonica.net
In reply to: Francisco Figueiredo Jr. (#7)
Re: Getting blocked when receinving response from a Parse

Hello:

That's very good!
Do you know about Npgsql?

Yes i know about it, but i have no see it in deep ( i use Firebird as
RDBMS at this moment ), i decide to take a glance at the 3.0 protocol
using C# when i know about the plans for a native Windows version in 7.4
version :) , but i'm not sure if i'm going to finish the .NET data
provider implementation.

Please, have a look at gborg.postgresql.org/project/npgsql.
It is a Postgresql .net data provider written 100% in C#.
Maybe you could give some tips, suggestions, improvements, bug fixes... :)

:)

--
Best regards

Carlos Guzm�n �lvarez
Vigo-Spain