[mpich-discuss] valgrind warning with ROMIO hint file

123 a5467021 at 163.com
Thu Dec 21 19:24:01 CST 2017


Hi Eric,<br/><br/>Thank you for your reply.<br/>But it seems that that is not the same as my issue...<br/>I'm even unable to 'make' the source code.<br/>Probably there's something wrong with makefile files?<br/><br/>Sheng
At 2017-12-22 03:36:00, "Eric Chamberland" <Eric.Chamberland at giref.ulaval.ca> wrote:
>Hi,
>
>we have the same issue here...
>
>Reported this 3 days ago:
>
>https://github.com/pmodels/mpich/issues/2894
>
>Eric
>
>On 19/12/17 07:30 PM, Audet, Martin wrote:
>> MPI_Developers,
>> It seems that when a program using mpich uses MPI-IO, it try first to open
>> a hint file specified in the ROMIO_HINTS environment variable (or
>> "/etc/romio-hints" if it is undefined) and then try to read it. The problem
>> is that it will try to read from it with the file descriptor returned by
>> open() even if the open() failed and returned a -1 (ex: file not found).
>> When this happens read() also fails and also return -1.
>> The problem is when the program is run under valgrind (with the valgrind
>> friendly ch3:sock device), valgrind notice that an invalid file descriptor
>> was passed to read() and complain with a warning:
>> ==113473== Memcheck, a memory error detector
>> ==113473== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
>> ==113473== Using Valgrind-3.12.0 and LibVEX; rerun with -h for copyright 
>> info
>> ==113473== Command: ...
>> ==113473== Parent PID: 48694
>> ==113473==
>> ==113473== Warning: invalid file descriptor -1 in syscall read()
>> ==113473==
>> ==113473== HEAP SUMMARY:
>> ==113473==     in use at exit: 0 bytes in 0 blocks
>> ==113473==   total heap usage: 4,420 allocs, 4,209 frees, 72,241,561 
>> bytes allocated
>> ==113473==
>> ==113473== All heap blocks were freed -- no leaks are possible
>> ==113473==
>> ==113473== For counts of detected and suppressed errors, rerun with: -v
>> ==113473== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
>> The problem is that no matter how clean is the program, this warning will
>> appear in its valgrind report. A developer may think that his own code is
>> problematic and start investigating...
>> The solution is of course not trying to read the file if the file descriptor
>> is invalid. This could be done simply as follow (mpich 3.2.1):
>> --- mpich-3.2.1/src/mpi/romio/adio/common/system_hints.c
>> +++ mpich-3.2.1-patch/src/mpi/romio/adio/common/system_hints.c
>> @@ -98,7 +98,7 @@
>>       buffer = (char *)ADIOI_Calloc(HINTFILE_MAX_SIZE, sizeof (char));
>>       if (rank == 0) {
>> -       ret = read(fd, buffer, HINTFILE_MAX_SIZE);
>> +       ret = (fd >= 0) ? read(fd, buffer, HINTFILE_MAX_SIZE) : -1;
>>          /* any error: bad/nonexistent fd, no perms, anything: set up a null
>>           * buffer and the subsequent string parsing will quit 
>> immediately */
>>          if (ret == -1)
>> Could you consider applying this patch (or an equivalent one)
>> to mpich ?  It would be much appreciated.
>> Thanks in advance,
>> Martin Audet
>_______________________________________________
>discuss mailing list     discuss at mpich.org
>To manage subscription options or unsubscribe:
>https://lists.mpich.org/mailman/listinfo/discuss
_______________________________________________
discuss mailing list     discuss at mpich.org
To manage subscription options or unsubscribe:
https://lists.mpich.org/mailman/listinfo/discuss


More information about the discuss mailing list