[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 20020529: error -- posixio.c:277: failed assertion `offset < X_INT_MAX' .. Abort trap



>To: address@hidden
>From: "Jae S. Choi" <address@hidden>
>Subject: error -- posixio.c:277: failed assertion `offset < X_INT_MAX' .. 
>Abort trap
>Organization: ?
>Keywords: 200205291744.g4THicp21665 netCDF large file MacOS-X

Hi Jae,

> I am trying to use your library in my application and am obtaining the 
> following error:
> 
>       posixio.c:277: failed assertion `offset < X_INT_MAX'
>       Abort trap
> 
> The datafile that is output is very large (2.4 GB). In comparison, the 
> ASCII formatted data dump is < 5MB. I have used the interface previously 
> with success on other platforms but am not sure what is causing the 
> current difficulty. Any help would be greatly appreciated.
> 
> 
> Thank you in advance,
> Jae
> ---
> 
> Background information:
> 
> 1. complier: Absoft Fortran95 compiler (v7) with current updates.
> 2. OS: MAC OS X/PPC
> 3. all built-in tests complete successfully

It turns out that the C library must be compiled with the -DNDEBUG
flag in order to permit writing large files, because of an incorrect
assert() statement left in for debugging purposes at line 277 of
libsrc/posixio.c:

        assert(offset < X_INT_MAX); /* sanity check */

Compiling with -DNDEBUG turns off assertion checking and allows large
files to be written.  Alternatively you can just change the above statement
to
        assert(offset >= 0); /* sanity check */

and recompile the library.

We have also fixed occurrences of these too-strict assertions in the
beta version netcdf-3.5.1-beta3.tar.Z available from

  ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-beta.tar.Z

As to why your program is writing a large file (> 2 Gbytes) when you
only have a few megabytes of data, I can't tell without a way to
reproduce the problem.  When you use "ncgen -b" on the ASCII (CDL)
version of the file to generate the binary netCDF file, does ncgen
also create the large file?  Can you isolate the problem into a small
program that demonstrates the bug?

-- Russ

_____________________________________________________________________

Russ Rew                                         UCAR Unidata Program
address@hidden                     http://www.unidata.ucar.edu