E. Case
E. Case

Reputation: 71

nf90_create causes forrtl: error (76): Abort trap signal from malloc(): corrupted top size

I have a subroutine in output.f90 to write out netcdf files. It's currently failing at nc_create.

The paths and outputSpeed are set earlier, end up as:

path_out_1d = "ec/res4/scratch/nld4814/test-gs/output/"

fname_out_1d = "FGRN055_test-gs_1D_1.nc"

module output
    !*** functions and subroutines for writing data to netcdf files

    use netcdf, only: nf90_create, nf90_def_dim, nf90_def_var, nf90_real, nf90_int, nf90_noerr, &
        nf90_enddef, nf90_put_var, nf90_close, nf90_unlimited, nf90_put_att, NF90_CLOBBER

    implicit none
    private

    public :: Accumulate_Output, Write_Initial_Output, To_out_1D, To_out_2D, To_out_2Ddetail, Save_out_1D, Save_out_2D, Save_out_2Ddetail, Save_out_restart
    
contains

subroutine Save_out_1D(outputSpeed, path_out_1d, fname_out_1d, out_1D)
    !*** Write the 1D output variables to a netcdf file !***
    
    ! declare arguments
    integer, intent(in) :: outputSpeed
    double precision, dimension((outputSpeed+50),18), intent(in) :: out_1D
    character*255, intent(in) :: path_out_1d, fname_out_1d

    ! declare local arguments
    integer :: status, ncid, dimid_t, varID(18)
    character*255 :: pad

    pad = trim(path_out_1d)//trim(fname_out_1d)

    status = nf90_create(trim(pad), NF90_CLOBBER, ncid)

...

I get the following error running status = nf90_create....

malloc(): corrupted top size
forrtl: error (76): Abort trap signal
Image              PC                Routine            Line        Source             
IMAU-FDM_np_gp_1.  000000000044B41B  Unknown               Unknown  Unknown
libpthread-2.28.s  000014B4CAC8DCF0  Unknown               Unknown  Unknown
libc-2.28.so       000014B4CA700ACF  gsignal               Unknown  Unknown
libc-2.28.so       000014B4CA6D3EA5  abort                 Unknown  Unknown
libc-2.28.so       000014B4CA741CD7  Unknown               Unknown  Unknown
libc-2.28.so       000014B4CA748FDC  Unknown               Unknown  Unknown
libc-2.28.so       000014B4CA74C7B8  Unknown               Unknown  Unknown
libc-2.28.so       000014B4CA74D81E  __libc_malloc         Unknown  Unknown
libnetcdf.so.19.2  000014B4CBC9D6D0  posixio_create        Unknown  Unknown
libnetcdf.so.19.2  000014B4CBC76D4A  NC3_create            Unknown  Unknown
libnetcdf.so.19.2  000014B4CBC1964D  NC_create             Unknown  Unknown
libnetcdf.so.19.2  000014B4CBC19405  nc__create            Unknown  Unknown
libnetcdff.so.7.2  000014B4CC28C4D2  nf_create_            Unknown  Unknown
libnetcdff.so.7.2  000014B4CC2D18F9  netcdf_mp_nf90_cr     Unknown  Unknown
IMAU-FDM_np_gp_1.  0000000000417168  output_mp_save_ou         366  output.f90
IMAU-FDM_np_gp_1.  0000000000441C75  MAIN__                    143  main.f90
IMAU-FDM_np_gp_1.  000000000040BAA2  Unknown               Unknown  Unknown
libc-2.28.so       000014B4CA6ECD85  __libc_start_main     Unknown  Unknown
IMAU-FDM_np_gp_1.  000000000040B9AE  Unknown               Unknown  Unknown

The path is correct; a file is created in the expected location, but it's unopenable.

The path length isn't overly long -- 63 characters

The netcdf libraries are linked.

Is there anything else to check? Any other hints to what is going on? My model compiles just fine with the following flags:

FFLAGS = -warn all -diag-enable remark -O0 -g -debug -traceback -check stack -module $(MOD_DIR) $(NETCDF4_INCLUDE)

Upvotes: -1

Views: 50

Answers (0)

Related Questions