jekhokie / raspberry-noaa-v2

V2 of the fantastic Raspberry Pi NOAA setup
GNU General Public License v3.0
533 stars 100 forks source link

Filter out wxtoimg error messages when applying map overlay for known/acceptable issue #1013

Closed creas002 closed 1 month ago

creas002 commented 1 month ago

Since the source code to WXTOIMG is not available I used gdc (w/o symbols) and strace and see what is causing the 'free invalid pointer' error. I determined that it happens on application clean up after successfully processing the map overlay file into the final image. Everything is working correctly except the clean up of a 3rd memory location which is failing because it was already removed by the kernel I believe.

strace snippet: munmap(0xef6b8000, 20533248) = 0 munmap(0xee323000, 20533248) = 0 munmap(0xecf8e000, 20533248) = 0 writev(2, [{iov_base="free(): invalid pointer", iov_len=23}, {iov_base="\n", iov_len=1}], 2) = 24

The first two munmap calls worked and the third munmap fails as its already deallocated.

The munmap() system call deletes the mappings for the specified address range, and causes further references to addresses within the range to generate invalid memory references. The region is also automatically unmapped when the process is terminated. On the other hand, closing the file descriptor does not unmap the region.

At this point I'm happy to know it successfully allocated those memory slots for processing

mmap2(NULL, 20533248, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xef6b8000 mmap2(NULL, 20533248, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xee323000 mmap2(NULL, 20533248, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xecf8e000

but it was freeing up memory on the last address that it threw the error.

This modification to receive_noaa.sh script is being done to filter out the 'free invalid pointer' and 'Aborted' messages before its written out to the RN2 log.