SCM

[#1010464] Error reading response in NpgsqlError

View Trackers | Bugs | Download .csv | Monitor

Date:
2008-09-01 13:55
Priority:
3
State:
Open
Submitted by:
Michail Ushakov (migel_u)
Assigned to:
Nobody (None)
Npgsql Version:
cvs
Category:
Group:
Resolution:
None
Summary:
Error reading response in NpgsqlError

Detailed description
Hello We found stranges in NoticeResponse handling.
Here is strange code:
NpgsqlError line 201:
case ProtocolVersion.Version3:
// Check the messageLength value. If it is 1178686529, this would be the
// "FATA" string, which would mean a protocol 2.0 error string.
if (PGUtil.ReadInt32(stream) == 1178686529)
{
// code here
}
else
{
for (char field = (char) stream.ReadByte(); field != 0; field = (char) stream.ReadByte())
{
//....
}
}

We working with PostgreSQL 8.3 so We never get 2.0 protocol response but reading 4 bytes in ReadInt32 offsets stream reading position that will be never reverted back. So we got not only strange error messages but wrong response processing at all.
For example:
We get postgresql.fp.protocol received 67 error when call LargeObjectManager.Create().
It is big mistake since back end return NoticeResponse 102 bytes long and only small part of them was handled in NpgsqlError.NpgsqlError(ProtocolVersion protocolVersion, Stream stream)


Followup

Message
Date: 2008-09-01 14:31
Sender: Michail Ushakov

Proposed solution:
Remove extraneous reading back end message length in the
FastPath.cs
FastPath.FastpathV3(..) line 179
//------------------------------
// Notice from backend
case 'N':
Int32 l_nlen = PGUtil.ReadInt32(stream); // <<<< REMOVE this
conn.Connector.FireNotice(new
NpgsqlError(conn.BackendProtocolVersion, stream));

break;

Attached Files:

Changes:

No Changes Have Been Made to This Item

Powered By FusionForge