[Mesa-users] Invalid reads of inlist: bug?

RICHARD H D TOWNSEND townsend at astro.wisc.edu
Tue Apr 10 19:48:26 EDT 2018


Hi Michael --

I've encountered these leaks myself. They appear related to the GNU Fortran (gfortran) library handling of namelists, and therefore aren't something that we can fix on the MESA side. Fortunately, they don't seem to lead to improper operation and/or significant memory loss.

cheers,

Rich

> On Apr 10, 2018, at 4:25 PM, Zhang, Zhaoxi M. (Michael) <mz at astro.caltech.edu> wrote:
> 
> Hello everyone,
> 
> I think I found a bug in the code that reads the inlist.  When I use valgrind to monitor MESA running, I see two invalid reads, both in star_job_ctrls_io.f90:read_star_job_file.  This happens for every MESA model I've tried.  I suspect that there's a mismatch between the huge star_job namelist that's receiving the information (star_job_ctrls_io.f90:36) and the actual structure of the star_jobs controls, but I didn't know of a quick way to find the problematic control(s).
> 
> The valgrind output is attached below.  
> 
> Cheers,
> 
> Michael
> 
> 
> ==24373== Invalid read of size 16
> ==24373==    at 0x7FC45D3: __strcmp_sse2_unaligned (strcmp-sse2-unaligned.S:53)
> ==24373==    by 0x711CE0F: find_nml_node.isra.6 (list_read.c:2684)
> ==24373==    by 0x711EA72: nml_get_obj_data (list_read.c:3333)
> ==24373==    by 0x711EA72: _gfortrani_namelist_read (list_read.c:3619)
> ==24373==    by 0x7126DEC: finalize_transfer (transfer.c:3891)
> ==24373==    by 0x7127048: _gfortran_st_read_done (transfer.c:4078)
> ==24373==    by 0x5B5837: __star_job_ctrls_io_MOD_read_star_job_file (in /home/stanley/simulations/test_memleak/star)
> ==24373==    by 0x5BB267: __star_job_ctrls_io_MOD_do_read_star_job (star_job_ctrls_io.f90:556)
> ==24373==    by 0x408FE9: __star_lib_MOD_read_star_job (star_lib.f90:84)
> ==24373==    by 0x40DD1A: __run_star_support_MOD_do_read_star_job (run_star_support.f90:1653)
> ==24373==    by 0x404E83: MAIN__ (run.f:10)
> ==24373==    by 0x404EDA: main (run.f:2)
> ==24373==  Address 0x8d99f30 is 2 bytes after a block of size 30 alloc'd
> ==24373==    at 0x4C2CBFD: malloc (vg_replace_malloc.c:299)
> ==24373==    by 0x7045F24: _gfortrani_xmalloc (memory.c:42)
> ==24373==    by 0x7122B25: set_nml_var.isra.4 (transfer.c:4206)
> ==24373==    by 0x71235D4: _gfortran_st_set_nml_var (transfer.c:4253)
> ==24373==    by 0x5B13A1: __star_job_ctrls_io_MOD_read_star_job_file (in /home/stanley/simulations/test_memleak/star)
> ==24373==    by 0x5BB267: __star_job_ctrls_io_MOD_do_read_star_job (star_job_ctrls_io.f90:556)
> ==24373==    by 0x408FE9: __star_lib_MOD_read_star_job (star_lib.f90:84)
> ==24373==    by 0x40DD1A: __run_star_support_MOD_do_read_star_job (run_star_support.f90:1653)
> ==24373==    by 0x404E83: MAIN__ (run.f:10)
> ==24373==    by 0x404EDA: main (run.f:2)
> ==24373==
> ==24373== Invalid read of size 16
> ==24373==    at 0x7FC45ED: __strcmp_sse2_unaligned (strcmp-sse2-unaligned.S:59)
> ==24373==    by 0x711CE0F: find_nml_node.isra.6 (list_read.c:2684)
> ==24373==    by 0x711EA72: nml_get_obj_data (list_read.c:3333)
> ==24373==    by 0x711EA72: _gfortrani_namelist_read (list_read.c:3619)
> ==24373==    by 0x7126DEC: finalize_transfer (transfer.c:3891)
> ==24373==    by 0x7127048: _gfortran_st_read_done (transfer.c:4078)
> ==24373==    by 0x5B5837: __star_job_ctrls_io_MOD_read_star_job_file (in /home/stanley/simulations/test_memleak/star)
> ==24373==    by 0x5BB267: __star_job_ctrls_io_MOD_do_read_star_job (star_job_ctrls_io.f90:556)
> ==24373==    by 0x408FE9: __star_lib_MOD_read_star_job (star_lib.f90:84)
> ==24373==    by 0x40DD1A: __run_star_support_MOD_do_read_star_job (run_star_support.f90:1653)
> ==24373==    by 0x404E83: MAIN__ (run.f:10)
> ==24373==    by 0x404EDA: main (run.f:2)
> ==24373==  Address 0x8d99f40 is 18 bytes after a block of size 30 alloc'd
> ==24373==    at 0x4C2CBFD: malloc (vg_replace_malloc.c:299)
> ==24373==    by 0x7045F24: _gfortrani_xmalloc (memory.c:42)
> ==24373==    by 0x7122B25: set_nml_var.isra.4 (transfer.c:4206)
> ==24373==    by 0x71235D4: _gfortran_st_set_nml_var (transfer.c:4253)
> ==24373==    by 0x5B13A1: __star_job_ctrls_io_MOD_read_star_job_file (in /home/stanley/simulations/test_memleak/star)
> ==24373==    by 0x5BB267: __star_job_ctrls_io_MOD_do_read_star_job (star_job_ctrls_io.f90:556)
> ==24373==    by 0x408FE9: __star_lib_MOD_read_star_job (star_lib.f90:84)
> ==24373==    by 0x40DD1A: __run_star_support_MOD_do_read_star_job (run_star_support.f90:1653)
> ==24373==    by 0x404E83: MAIN__ (run.f:10)
> ==24373==    by 0x404EDA: main (run.f:2)
> 
> _______________________________________________
> mesa-users at lists.mesastar.org
> https://lists.mesastar.org/mailman/listinfo/mesa-users




More information about the Mesa-users mailing list