valgrind
shows me the following:
==13880== Warning: invalid file descriptor -1 in syscall close()
Is there an easy way to investigate this error? I mean - to show stack-trace for example?
It's a huge project, I can't manually check each close
. Also, I guess this would be the same for each sys call on bad filed descriptor.
I run it like:
valgrind --trace-children=yes --track-fds=yes --log-fd=2 --error-limit=no \
--leak-check=full --show-possibly-lost=yes --track-origins=yes \
--show-reachable=yes ./exe
the exe
is with debug information.
A bigger piece of the valgrind
's output is:
==13880== Conditional jump or move depends on uninitialised value(s)
==13880== at 0x5A4022F: ??? (in /lib/i686/cmov/libc-2.11.3.so)
==13880== by 0x5A57323: ??? (in /lib/i686/cmov/libc-2.11.3.so)
==13880== by 0x5A56EC2: ??? (in /lib/i686/cmov/libc-2.11.3.so)
==13880== by 0x5A5555B: localtime_r (in /lib/i686/cmov/libc-2.11.3.so)
==13880== by 0x754E983: ??? (in /usr/lib/libapr-1.so.0.4.2)
==13880== by 0x754EAC9: apr_time_exp_lt (in /usr/lib/libapr-1.so.0.4.2)
==13880== by 0x6056B56: log4cxx::helpers::TimeZoneImpl::LocalTimeZone::explode(apr_time_exp_t*, long long) const (in /usr/lib/liblog4cxx.so.10.0.0)
==13880== by 0x6037940: log4cxx::helpers::SimpleDateFormat::format(std::string&, long long, log4cxx::helpers::Pool&) const (in /usr/lib/liblog4cxx.so.10.0.0)
==13880== by 0x5FBE539: log4cxx::pattern::CachedDateFormat::format(std::string&, long long, log4cxx::helpers::Pool&) const (in /usr/lib/liblog4cxx.so.10.0.0)
==13880== by 0x5FCEA2B: log4cxx::pattern::DatePatternConverter::format(log4cxx::helpers::ObjectPtrT<log4cxx::spi::LoggingEvent> const&, std::string&, log4cxx::helpers::Pool&) const (in /usr/lib/liblog4cxx.so.10.0.0)
==13880== by 0x601EE10: log4cxx::PatternLayout::format(std::string&, log4cxx::helpers::ObjectPtrT<log4cxx::spi::LoggingEvent> const&, log4cxx::helpers::Pool&) const (in /usr/lib/liblog4cxx.so.10.0.0)
==13880== by 0x605BCAB: log4cxx::WriterAppender::subAppend(log4cxx::helpers::ObjectPtrT<log4cxx::spi::LoggingEvent> const&, log4cxx::helpers::Pool&) (in /usr/lib/liblog4cxx.so.10.0.0)
==13880== Uninitialised value was created by a heap allocation
==13880== at 0x40255BC: malloc (vg_replace_malloc.c:270)
==13880== by 0x5A57A03: ??? (in /lib/i686/cmov/libc-2.11.3.so)
==13880== by 0x5A56D17: ??? (in /lib/i686/cmov/libc-2.11.3.so)
==13880== by 0x5A56E20: ??? (in /lib/i686/cmov/libc-2.11.3.so)
==13880== by 0x5A5555B: localtime_r (in /lib/i686/cmov/libc-2.11.3.so)
==13880== by 0x754E983: ??? (in /usr/lib/libapr-1.so.0.4.2)
==13880== by 0x754EAC9: apr_time_exp_lt (in /usr/lib/libapr-1.so.0.4.2)
==13880== by 0x605701D: log4cxx::helpers::TimeZoneImpl::LocalTimeZone::getTimeZoneName() (in /usr/lib/liblog4cxx.so.10.0.0)
==13880== by 0x6055D53: log4cxx::helpers::TimeZone::getDefault() (in /usr/lib/liblog4cxx.so.10.0.0)
==13880== by 0x6038606: log4cxx::helpers::SimpleDateFormat::SimpleDateFormat(std::string const&) (in /usr/lib/liblog4cxx.so.10.0.0)
==13880== by 0x5FCF09D: log4cxx::pattern::DatePatternConverter::getDateFormat(std::vector<std::string, std::allocator<std::string> > const&) (in /usr/lib/liblog4cxx.so.10.0.0)
==13880== by 0x5FCF587: log4cxx::pattern::DatePatternConverter::DatePatternConverter(std::vector<std::string, std::allocator<std::string> > const&) (in /usr/lib/liblog4cxx.so.10.0.0)
==13880==
==13880== Warning: invalid file descriptor -1 in syscall close()
The empty line before the Warning
makes me think the stacktrace above is NOT relevant to the warning. Also, after the Warning
comes the Summary
, nothing else.
Running valgrind (ver.3) with -v produces also for invalid file descriptor warnings a stacktrace.
The obvious way seems to be: put a breakpoint in close()
. This of course assumes you can run your program in a debugger, but if you can run it in Valgrind that doesn't seem very far-fetched.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With