7.4RC1 et al: cannot find block containing chunk

From: greimel(at)ing(dot)iac(dot)es (Robert Greimel)
To: pgsql-bugs(at)postgresql(dot)org
Subject: 7.4RC1 et al: cannot find block containing chunk
Date: 2003-11-09 17:33:22
Message-ID: 200311091733.hA9HXMnE003254@puppis.ing.iac.es
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

============================================================================
POSTGRESQL BUG REPORT TEMPLATE
============================================================================

Your name : Robert Greimel
Your email address : greimel ( at ) ing ( dot ) iac ( dot ) es

System Configuration
---------------------
Architecture (example: Intel Pentium) : Intel Pentium
AMD Athlon

Operating System (example: Linux 2.0.26 ELF) : Linux 2.4.18 ELF (RedHat-8)
Linux 2.4.22 ELF (homegrown)

PostgreSQL version (example: PostgreSQL-7.3): PostgreSQL-7.4RC1
PostgreSQL-7.2.3
PostgreSQL-7.2.2

Compiler used (example: gcc 2.95.2) : gcc 3.2

Please enter a FULL description of your problem:
------------------------------------------------

7.2.2 and RedHat 8
===================
using PostgreSQL-7.2.2 and several user defined C function - dynamically loaded
from one .so file - I (sometimes) see the following error message doing the
following query:

>psql database
=# SELECT id,deg2ra(ra),deg2dec(dec),frames FROM Fields;
ERROR: AllocSetFree: cannot find block containing chunk 0x83a5300

Here deg2dec and deg2ra are user functions defined as
CREATE FUNCTION deg2dec(float4) RETURNS text AS '/some/path/coord.so','deg2dec_float4' LANGUAGE C WITH (isStrict);
CREATE FUNCTION deg2dec(float8) RETURNS text AS '/some/path/coord.so','deg2dec_float8' LANGUAGE C WITH (isStrict);
CREATE FUNCTION deg2ra(float4) RETURNS text AS '/some/path/coord.so','deg2ra_float4' LANGUAGE C WITH (isStrict);
CREATE FUNCTION deg2ra(float8) RETURNS text AS '/some/path/coord.so','deg2ra_float8' LANGUAGE C WITH (isStrict);

and ra and dec are defined as REAL in table Fields.

The query
>psql database
=# SELECT id,ra,deg2dec(dec),frames FROM Fields;
id | ra | deg2dec | frames
-------+---------+---------------+--------
3706 | 99.4405 | -04:16:00.001 | {0}
...
(deg2ra function removed) works. There is only a minute difference in the
code for deg2dec and deg2ra, so I am fairly certain that its not a programming
error on my part - although this is my first go on extending Postgres.

Calling (in a new psql session) the deg2ra function once before the query
>psql database
=# SELECT deg2ra(300);
deg2ra
--------------
20:00:00.000
(1 row)
=# SELECT id,deg2ra(ra),deg2dec(dec),frames FROM Fields;
id | deg2ra | deg2dec | frames
-------+--------------+---------------+--------
3706 | 06:37:45.720 | -04:16:00.001 | {0}
...
makes the query work !!!

7.2.3 and RedHat 8
==================
using PostgreSQL-7.2.3 the same error is produced as in 7.2.2 .

However, the workaround of calling deg2ra before doing the query no longer
works. The single "SELECT deg2ra(300)" works - and I have never seen it fail -
but the table query afterwards produces the AllocSetFree error.

However, explicitly loading the dynamic code makes the query work again:
>psql database
=# LOAD '/some/path/coord.so';
=# SELECT id,deg2ra(ra),deg2dec(dec),frames FROM Fields;
id | deg2ra | deg2dec | frames
-------+--------------+---------------+--------
3706 | 06:37:45.720 | -04:16:00.001 | {0}
...
works !!!

Interestingly, reversing the columns that call the functions also makes the
query work (this does not need an explicit LOAD or single SELECT before):
>psql database
=# SELECT id,deg2dec(dec),deg2ra(ra),frames FROM Fields;
id | deg2dec | deg2ra | frames
-------+---------------+--------------+--------
3706 | -04:16:00.001 | 06:37:45.720 | {0}
...
works !!!

7.4RC1 and my own homegrown Linux
=================================
PostgreSQL-7.4RC1 still has the problem, but in a slightly different form.
The error is now

ERROR: could not find block containing chunk 0x82eff00

This time I also experimented with debug levels. For a straight query there
was a slight difference in the reported error for the different debug levels,
but none worked:

postmaster (without debug, -d 1 and -d 2)
>psql database
=# SELECT id,deg2dec(dec),deg2ra(ra),frames FROM Fields;
ERROR: could not find block containing chunk 0x82eca00

postmaster (-d 3 and -d 4)
>psql database
=# SELECT id,deg2dec(dec),deg2ra(ra),frames FROM Fields;
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.
!> \q

Doing the single SELECT before the query gives also different results depending
on debug level - it works for high debug levels but not for low:

postmaster (without debug, -d 1 and -d 2)
>psql database
=# SELECT deg2ra(300);
deg2ra
--------------
20:00:00.000
(1 row)

=# SELECT id,deg2dec(dec),deg2ra(ra),frames FROM Fields;
ERROR: could not find block containing chunk 0x82eca00

postmaster (-d 3 and -d 4)
>psql database
=# SELECT deg2ra(300);
deg2ra
--------------
20:00:00.000
(1 row)

=# SELECT id,deg2dec(dec),deg2ra(ra),frames FROM Fields;
id | deg2ra | deg2dec | frames
-------+--------------+---------------+--------
3706 | 06:37:45.720 | -04:16:00.001 | {0}
...

Doing the LOAD of the dynamic module explicitly worked for all debug levels.

postmaster (without debug, -d 1, -d 2, -d 3 and -d 4)
>psql database
=# LOAD '/some/path/coord.so';
=# SELECT id,deg2ra(ra),deg2dec(dec),frames FROM Fields;
id | deg2ra | deg2dec | frames
-------+--------------+---------------+--------
3706 | 06:37:45.720 | -04:16:00.001 | {0}
...

Reversing the column order worked for all debug levels

>psql database
=# SELECT id,deg2dec(dec),deg2ra(ra),frames FROM Fields;
id | deg2dec | deg2ra | frames
-------+---------------+--------------+--------
3706 | -04:16:00.001 | 06:37:45.720 | {0}
...

Hope this is useful in tracking down the bug - if you need more information,
please email me.

Please describe a way to repeat the problem. Please try to provide a
concise reproducible example, if at all possible:
----------------------------------------------------------------------

see above.

If you know how this problem might be fixed, list the solution below:
---------------------------------------------------------------------

see above for workarounds.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Peter Eisentraut 2003-11-09 20:57:34 Re: 7.4RC1 et al: cannot find block containing chunk
Previous Message Bruce Momjian 2003-11-09 04:23:44 Re: minor: ~ not resolved in psql