Skip to content

Random error while 'SELECT', PostgreSQL v17.11-3, Zebra MC3401, Android 14, Visual Studio 2022, C#, .Net9.0, Ngpsql 8.0.9, Npgsql 9.0.5, Npgsql 10.0.3 #6652

Description

@eaktivo

if I call the same SQL 10 times, 2 times it is executed OK and 8 times it is executed with a random error.

C# code from Android application:

System.Data.DataTable DT;
DT = new DataTable();

NpgsqlCommand pgCommand = new NpgsqlCommand( SQL, pgConnection );
NpgsqlDataAdapter pgDataAdapter = new NpgsqlDataAdapter( pgCommand );

try
{
  // with the same query (same SQL) - this will cause a random error (see below) or execution without error
  pgDataAdapter.Fill( DT ); 
}
catch (PostgresException PE)
{
  ...
}
catch (Exception E)
{
  // random error
}

The query is executed after pressing a button in the application.
This is the result:

  1. SELECT: OK
  2. EXCEPTION: The read on this field has not consumed all of its bytes (pos: 2, len: 536870915)
  3. SELECT: OK
  4. EXCEPTION: Index and count must refer to a location within the buffer. (Parameter 'bytes')
  5. EXCEPTION: The read on this field has not consumed all of its bytes (pos: 4, len: 131092)
  6. EXCEPTION: The read on this field has not consumed all of its bytes (pos: 4, len: 1028)
  7. EXCEPTION: The read on this field has not consumed all of its bytes (pos: 2, len: 2050)
  8. EXCEPTION: Unable to translate bytes [B0] at index 3 from specified code page to Unicode.
  9. EXCEPTION: Exception while reading form stream
  10. EXCEPTION: The read on this field has not consumed all of its bytes (pos: 8, len: 2097160)
  11. SELECT: OK
  12. EXCEPTION: The read on this field has not consumed all of its bytes (pos: 8, len: 65544)
  13. EXCEPTION: The read on this field has not consumed all of its bytes (pos: 4, len: 260)
  14. EXCEPTION: Reading as 'System.Object' is not supported for fields having DataTypeName '-.-'
  15. EXCEPTION: The read on this field has consumed all of its bytes and read into the subsequent bytes (pos: 4, len: -16843010)
  16. SELECT: OK
  17. FREEZE. (RESTART APPLICATION)
  18. EXCEPTION ....
  19. ....

SAME APPLICATION ON ZEBRA MC3300, Android v8.1 WORKS WITHOUT ANY EXCEPTION.

'SELECT' WORKS FINE ON PSQL.
NO ERRORS IN POSTGRESQL LOG.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions