|
From: Dennis L. <pla...@in...> - 2006-02-27 18:50:30
|
Hello, Im currently tracking some bugs with V (SVN) and found something that looks like a subtle bug in V, but does not make entirely sense to me. I have added some VALGRIND_CHECK_DEFINED macros all over the place to track the origin of some undefined value down, and noticed the following behaviour: Some uninitialized bytes are passed around in the program, and to some other thread, there it is detected by the macro, and outputted. At another occasion, and in another thread, but in the same code the check does trigger too, but it doesnt see where the memory is from (in the first one, it says its on another threads stack. In the second one, its just ~100bytes above that address). And I dont think its right when it says that its on the stack, since the object where I have the uninitialized data is always created on the freestore. After the catch of the unitialized memory through the client request, its complaining about invalid reads (of memory it doesnt know anything of it says). usually that kind of reads immediately results in segfaults, but it doesnt here. This is the debug output of the program and V when the client request is done the first time: Address of hid: 0x4e9a254 ==13416== Thread 2: ==13416== Uninitialised byte(s) found during client check request ==13416== at 0x40C01BD: iwear::net::ScheduledCall::dispatch() (valgrind.h:42) ==13416== by 0x43B722D: iwear::ScheduleThread::deliver_event(iwear::EventBase*) (eventscheduler.cpp:58) ==13416== by 0x43B90CD: iwear::ScheduleThread::Run() (eventscheduler.cpp:87) ==13416== by 0x43EC08C: iwear::Thread::Trampoline() (thread.cpp:48) ==13416== by 0x43EC5C9: iwear::Thread::start_thread_execution(void*) (thread.cpp:92) ==13416== by 0x4045296: start_thread (in /lib/tls/libpthread-2.3.5.so) ==13416== by 0x42CF37D: clone (in /lib/tls/libc-2.3.5.so) ==13416== by 0x4897BAF: ??? ==13416== Address 0x4E9A254 is on thread 5's stack While this is the same thing, the second time: Address of hid: 0x4e9a190 ==13416== ==13416== Thread 3: ==13416== Unaddressable byte(s) found during client check request ==13416== at 0x40C01BD: iwear::net::ScheduledCall::dispatch() (valgrind.h:42) ==13416== by 0x43B722D: iwear::ScheduleThread::deliver_event(iwear::EventBase*) (eventscheduler.cpp:58) ==13416== by 0x43B90CD: iwear::ScheduleThread::Run() (eventscheduler.cpp:87) ==13416== by 0x43EC08C: iwear::Thread::Trampoline() (thread.cpp:48) ==13416== by 0x43EC5C9: iwear::Thread::start_thread_execution(void*) (thread.cpp:92) ==13416== by 0x4045296: start_thread (in /lib/tls/libpthread-2.3.5.so) ==13416== by 0x42CF37D: clone (in /lib/tls/libc-2.3.5.so) ==13416== by 0x4A98BAF: ??? ==13416== Address 0x4E9A190 is not stack'd, malloc'd or (recently) free'd ==13416== ==13416== Invalid read of size 4 ==13416== at 0x43F2FBC: iwear::uid::uid(iwear::uid const&) (uid.cpp:78) ==13416== by 0x40C0258: iwear::net::ScheduledCall::dispatch() (scheduledcall.cpp:65) ==13416== by 0x43B722D: iwear::ScheduleThread::deliver_event(iwear::EventBase*) (eventscheduler.cpp:58) ==13416== by 0x43B90CD: iwear::ScheduleThread::Run() (eventscheduler.cpp:87) ==13416== by 0x43EC08C: iwear::Thread::Trampoline() (thread.cpp:48) ==13416== by 0x43EC5C9: iwear::Thread::start_thread_execution(void*) (thread.cpp:92) ==13416== by 0x4045296: start_thread (in /lib/tls/libpthread-2.3.5.so) ==13416== by 0x42CF37D: clone (in /lib/tls/libc-2.3.5.so) ==13416== by 0x4A98BAF: ??? ==13416== Address 0x4E9A194 is not stack'd, malloc'd or (recently) free'd ==13416== Sorry if this all is somewhat vague, but I dont have any nearer idea on what more information to provide. And again, I personally ran into some case where it would be just great when V would be able to tell me where exactly that uninitialized memory comes from. greets Dennis |