DynamoRIO / drmemory

Memory Debugger for Windows, Linux, Mac, and Android
Other
2.38k stars 257 forks source link

DO NOT REUSE THIS ISSUE: OPEN A NEW ONE [was: Dr. Memory fails to start with "WARNING: unable to locate results file since can't open .../resfile.PID: 2"] #9

Closed derekbruening closed 9 years ago

derekbruening commented 9 years ago

From timurrrr@google.com on June 29, 2010 11:02:36

Dr. Memory r19 + Dynamorio r363 work fine.

When I update Dr. Memory to r20 ( https://code.google.com/p/drmemory/source/detail?r=20 ) and re-build (nmake clean && cmake ... && nmake install), I get the following error when trying to run any executable: WARNING: unable to locate results file since can't open .../logs/resfile.XXXX: 2"

At first I thought the problem was my AV software but disabling it didn't help. This is happening on Windows XP.

Original issue: http://code.google.com/p/drmemory/issues/detail?id=9

derekbruening commented 9 years ago

From derek.br...@gmail.com on June 29, 2010 08:11:41

that's the frontend unable to find a file written by the client at startup. does the client fail in some manner? use -dr_debug: are there any DR asserts or messages?

derekbruening commented 9 years ago

From derek.br...@gmail.com on June 29, 2010 22:05:56

note that I have not observed any problems and most of my testing is on xp (though it's WOW64).

derekbruening commented 9 years ago

From timurrrr@google.com on July 01, 2010 03:19:07

It succeeds with -dr_debug... Looks like it is a heisenbug

derekbruening commented 9 years ago

From timurrrr on July 13, 2010 12:51:53

I've uploaded the same binary to the Chromium Dr.Memory buildbot and it exhibits the same issue. It's 32-bit Win XP SP3 there with almost no additional software installed. [sorry for the wrong e-mail, can't sign in with @google.com with my slow internet connection on vacation]

derekbruening commented 9 years ago

From timurrrr@google.com on July 19, 2010 07:17:04

I've tried "nmake test" and it sort-of-works (except issue #5 ) but looks like it's using -dr_debug. Any ideas how to provide more debugging info for you? See the reproducer below. // BUILD = cmake -G"NMake Makefiles" -DDynamoRIO_DIR:FILEPATH=C:\dynamorio\exports\cmake -DBUILD_DOCS:BOOL=OFF -DNTDLL_LIBPATH:FILEPATH=C:\WinDDK\7600.16385.1\lib\wxp\i386\ntdll.lib .. && nmake install // CLEANUP = rm build/*; rm -rf exports32/ // RUN = ..\exports32\bin\drmemory.exe -dr C:\dynamorio\exports -batch helloworld.exe 1) Sync to r19 2) CLEANUP & BUILD & Run -> works OK 3) Sync to r20 4) CLEANUP & BUILD & Run -> fails with resfile warning

Side effect found: 5) Sync to r19 , no cleanup 6) BUILD & Run -> fails with resfile warning Probably some dependencies are broken?

derekbruening commented 9 years ago

From timurrrr@google.com on July 19, 2010 07:46:48

I've narrowed the set of suspicious files.

1) Sync to r19 ("svn up -r 19 .." in drmemory/build) 2) svn up -r 20 ..\drmemory\options.* ..\drmemory\client_per_thread.h 3) CLEANUP & BUILD & Run -> works OK 4) svn up -r 20 ..\drmemory\fastpath.* ..\drmemory\readwrite.* 5) BUILD & Run -> resfile warning

Any ideas? Can this be hashtable data corruption? I use DynamoRIO rev 377

derekbruening commented 9 years ago

From derek.br...@gmail.com on July 19, 2010 09:05:38

this doesn't make any sense. if you haven't already can you just blow away the build dir and re-configure it for both DR and DrMem.

I don't normally use nmake but I just tried it and it works fine when I build DrMem w/ nmake.

I did see this resfile warning just now, but it only happens when using an old DR that does not contain all of DrMem's imports. It looks like instead of a release-build fatal usage error I only have a debug-build assert: CLIENT_ASSERT(false, "failure to process imports of client library"); And in release DR crashes silently (too early in init for good reporting). So that's one thing to fix. But if using the same version of DR, -dr_debug should result in that assert.

Can you try -dr_ops "-no_private_loader"

derekbruening commented 9 years ago

From timurrrr@google.com on July 19, 2010 11:48:22

Looks like a complete wipe-out & rebuild helped. Probably it was the problem with dependencies.

Usually I do "svn up && cmake ... && nmake install"

derekbruening commented 9 years ago

From timurrrr@google.com on August 04, 2010 07:14:01

Closing the issue. If/when the lack of dependencies between dr and drmemory becomes a problem, I'll file a separate issue

Status: WontFix

derekbruening commented 9 years ago

From derek.br...@gmail.com on August 20, 2010 15:59:30

in r410 I added a release-build notification when a client library can't be loaded due to dependencies

derekbruening commented 9 years ago

From eroman@chromium.org on January 14, 2011 00:21:45

I am getting this same error.

This is my first time running Dr. Memory, so maybe I am doing something wrong.

Here is what I did:

(1) Installed Dr. Memory on Windows 7 machine, using: http://drmemory.googlecode.com/files/DrMemory-Windows-1.3.1-1.exe (2) Ran:

drmemory.exe -- c:\windows\system32\notepad

This command returns 127, and prints out:

WARNING: unable to locate results file since can't open C:\Program Files (x86)\Dr. Memory/drmemory/logs/resfile.10996: 2

I tried passing the -logdir flag to move the results elsewhere, but same error.

If I add the -dr_debug flag then I additionally get a message-box containing:


DynamoRIO Notice: c:\windows\SysWOW64\notepad.exe(9540)

Application c:\windows\SysWOW64\notepad.exe (9540). Internal Error Internal DynamoRIO Error: C:/derek/dr/git/src/core/win32/loader.c:839 false (Error occurred @0 frags) version 2.1.0, custom build -client_lib 'C:\Program Files (x86)\Dr. Memory/bin/debug/drmemorylib.dll;0;-logdir C:\Program Files (x86)\Dr. Memory/drmemory/logs -resfile_out ' -code_api -probe_api -stack_size 36K -disa 0x002af4b8 0x150da356 0x002af5f0 0x15264084 0x002af624 0x15263c80 0x002af664 0x1518ef43 0x002af678 0x1518ea6e 0x002af698 0x152646aa 0x002af6b4 0x15263b47 0x002af6ec 0x1518ef43 0x002af700 0x1518ea6e 0x002af720 0x152646aa 0x002af73c 0x15263b47

OK

derekbruening commented 9 years ago

From bruen...@google.com on January 14, 2011 05:48:08

Are you on Windows 7? Windows 7 support is not yet there in 1.3.1.

derekbruening commented 9 years ago

From eroman@chromium.org on January 31, 2011 19:47:12

Yes, I am on Windows 7.

derekbruening commented 9 years ago

From sebastie...@gmail.com on July 07, 2011 13:12:02

I am having the same error on Windows 7 with the latest 1.4.1 installer.

derekbruening commented 9 years ago

From bruen...@google.com on July 24, 2011 13:40:17

I am having the same error on Windows 7 with the latest 1.4.1 installer.

Can you try 1.4.2?

derekbruening commented 9 years ago

From leeor.ah...@gmail.com on October 26, 2011 03:38:07

I'm seeing this same issue with 1.4.4-2. I did the same as in comment #11.

I'm using Windows 7 64bit, and am trying to debug a 32bit application.

Adding -logdir did not help. It doesn't happen with every application I try to debug.

derekbruening commented 9 years ago

From rnk@google.com on October 26, 2011 07:49:36

I also get this error when I pass -dr_debug to drmemory.exe when I'm trying to use a release build of DR. I think everyone adding comments to this bug is getting the same error message but possibly for different reasons. Ideally we could find a way to report more information back about why the child process is failing beyond "the frontend couldn't find the results file, the child must have failed."

derekbruening commented 9 years ago

From bruen...@google.com on October 26, 2011 07:57:20

I'm seeing this same issue with 1.4.4-2. I did the same as in comment #11. I'm using Windows 7 64bit, and am trying to debug a 32bit application. Adding -logdir did not help. It doesn't happen with every application I try to debug.

This doesn't give us enough information to act: like comment 17 said this is a visible symptom of any number of failures to launch the target app. Can you try with -dr_debug, and also tell us what app you're running.

derekbruening commented 9 years ago

From leeor.ah...@gmail.com on October 26, 2011 08:14:20

I'm trying to run a version of PuTTY I've compiled locally using VS2010. There's no problem running the original PuTTY 0.61 binary. Adding -dr_debug didn't add anything to the output. Running my binary without drmemory works fine, at least until later on when it crashes... ;-) But it doesn't even start under drmemory.


putty.exe - Application Error

The application was unable to start correctly (0x80000003). Click OK to close the application.

drmemory.exe's output: INFO: targeting application: "c:\Program Files (x86)\PuTTY\putty.exe" INFO: app cmdline: "c:\Program Files (x86)\PuTTY\putty.exe" "-load" "office/muse" INFO: logdir is "c:\Program Files (x86)\PuTTY" INFO: configuring putty.exe pid=456 dr_ops="-disable_traces -bb_single_restore_prefix -max_bb_instrs 256 -stack_size 36K " INFO: configuring client "c:\Program Files (x86)\Dr. Memory/bin/release/drmemorylib.dll" ops="-results_to_stderr -logdir c:\Progam Files (x86)\PuTTY -resfile 456 " INFO: waiting for app to exit... WARNING: unable to locate results file since can't open c:\Program Files (x86)\PuTTY/resfile.456: 2

derekbruening commented 9 years ago

From bruen...@google.com on October 26, 2011 08:20:06

putty app crash filed as issue #645

derekbruening commented 9 years ago

From Aleksey.Vaneev on December 27, 2012 09:59:08

Hello! Can you please tell me if it's a correct assumption that when DRMemory 1.5.0-5 reports this "WARNING: unable to locate results file since can't open" the application had no issues during its run?

The application executes just fine under drmemory, but on its finish I get that warning and nothing else. Documentation is not specific about the causes of this warning.

derekbruening commented 9 years ago

From zhao...@google.com on December 27, 2012 10:09:28

The result file is for generating the final result to user. It usually won't affect the execution, but may affect the error reports.

derekbruening commented 9 years ago

From Aleksey.Vaneev on December 27, 2012 10:25:47

But why do I get that warning after my application finished its execution? Does this mean something went wrong with DRMemory? I can't understand the cause of this warning.

derekbruening commented 9 years ago

From zhao...@google.com on December 27, 2012 10:43:35

when an application is running with drmemory, DrM will create a resfile (resfile.pid) and update that file during the execution. After the execution, a front-end process will try to read that file and produce the final result file (results.txt). The warning happens when the front-end process fail to open the resfile.pid.

This could happen (that's why only a warning, not a fatal error), for example: after the app exited and another app of same pid could start up. It could also mean the drm fail to create one, which you can check it easily from drmemory's log directory.

derekbruening commented 9 years ago

From Aleksey.Vaneev on December 27, 2012 10:49:08

DRMemory writes nothing to the log directory (the directory structure is original from the ZIP file) together with issuing this warning. I start it as D:\DrMemory\bin\drmemory.exe

derekbruening commented 9 years ago

From zhao...@google.com on December 27, 2012 10:51:42

please make sure drmemory has the right to write that directory. can you try debug build, and see if any error message?

derekbruening commented 9 years ago

From Aleksey.Vaneev on December 27, 2012 12:04:16

It has write rights since it creates dynamorio\ and symbols\ subdirectories there. But it does not write anything else at all.

I've also run the "attrib -R /S ." command in the directory.

I've also tried -debug option, but the behavior is same - nothing is written.

INFO: targeting application: "D:\libvox\Sources\Apps\DrumSplitter\DrumSplitter.exe" INFO: app cmdline: "D:\libvox\Sources\Apps\DrumSplitter\DrumSplitter.exe" INFO: logdir is "D:\DrMemory/drmemory/logs" INFO: using symbol path D:/DrMemory/drmemory/logs/symbols as the local store INFO: using symbol path srvD:/DrMemory/drmemory/logs/symbols http://msdl.microsoft.com/download/symbols to fetch symbols INFO: configuring DrumSplitter.exe pid=40388 dr_ops="-disable_traces -bb_single_restore_prefix -max_bb_instrs 256 -no_early_inject -logdir D:\DrMemory/drmemory/logs/dynamorio " INFO: configuring client "D:\DrMemory/bin/debug/drmemorylib.dll" ops="-logdir D:\DrMemory/drmemory/logs -resfile 40388 " INFO: waiting for app to exit... WARNING: unable to locate results file since can't open D:\DrMemory/drmemory/logs/resfile.40388: 2

derekbruening commented 9 years ago

From Aleksey.Vaneev on December 28, 2012 01:46:58

By the way, I'm under Win7 x64 SP1 (8 GB of memory).

I've tried several versions of DrMemory starting at 1.1.0, but all of them show that warning message without writing any log files.

DrMemory looks like a great piece of software utilizing advanced run-time code adjustment techniques - exactly what is needed for catching uninitialized memory accesses. But I have no idea what is going on with it - it seems to slow-down execution, but logs are empty nevertheless.

I also have DrWeb antiviral software installed - can this be an obstacle?

derekbruening commented 9 years ago

From Aleksey.Vaneev on December 28, 2012 01:52:54

I've tried it on WinXP computer without antiviral software - same results.

Maybe it requires Windows Debugging package to function properly?

derekbruening commented 9 years ago

From zhao...@google.com on December 28, 2012 08:13:54

It is difficult to know what exactly happens from the information. Can you run the program with option -debug -dr_debug -dr_ops "-msgbox_mask 0xf", which will print out some message and report any mis-behavior.

derekbruening commented 9 years ago

From Aleksey.Vaneev on December 28, 2012 08:40:09

No difference with these options, nothing is displayed beside that warning.

derekbruening commented 9 years ago

From Aleksey.Vaneev on December 28, 2012 08:42:02

Here is the output of drmemory when no application was specified:

ERROR: no app specified

usage: Dr. Memory [options] -- -version [ false] Display Dr. Memory version -dr [ ""] Path to DynamoRIO installation -drmemory [ ""] Path to Dr. Memory installation -srcfilter [ ""] Only show errors referencing named file -top_stats [ false] Show time taken and memory usage of whole process -fetch_symbols [ false] Fetch missing symbol files at the end of the run -follow_children [ true] Monitor child processes -nudge [ 0] Process id to nudge -v [ false] Display verbose information in the Dr. Memory front end -brief [ false] Show simplified and easier-to-read error reports -logdir ["/logs"] Base directory for result file subdirectories and symbol cache -verbose [ 1] Verbosity level in log files -quiet [ false] Suppress stderr messages and results -results_to_stderr [ true] Print error reports to stderr in addition to results.txt -log_suppressed_errors [ false] Log suppressed error reports for postprocessing. -ignore_asserts [ false] Do not abort on debug-build asserts -pause_at_error [ false] Pause at each reported error of any type -pause_at_unaddressable [ false] Pause at each unaddressable access -pause_at_uninitialized [ false] Pause at each uninitialized read -pause_at_exit [ false] Pause at exit -pause_at_assert [ false] Pause at each debug-build assert -pause_via_loop [ false] Pause via loop (not wait for stdin) -callstack_max_frames [ 12] How many call stack frames to record -callstack_style [0x0301] Set of flags that controls the callstack printing style -callstack_truncate_below ["main,wmain,WinMain,wWinMain,_RtlUserThreadStart,_threadstartex"] ,-separated list of function names at which to truncate callstacks -callstack_modname_hide ["drmemory"] ,-separated list of module names to hide in callstack frames -callstack_exe_hide [ true] Whether to omit the executable name from callstack frames -callstack_srcfile_hide [ ""] ,-separated list of source file paths to hide in callstack frames -callstack_srcfile_prefix [ ""] ,-separated list of path prefixes to remove -callstack_use_top_fp [ true] Use the top-level ebp/rbp register as the first frame pointer -callstack_use_top_fp_selectively [ true] Use the top-level ebp/rbp register as the first frame pointer in certain situations -callstack_max_scan [ 2048] How far to scan to locate the first or next stack frame -check_leaks [ true] List details on memory leaks detected -count_leaks [ true] Look for memory leaks -symbol_offsets [ false] Deprecated: use -callstack_style flag 0x4 -ignore_early_leaks [ true] Ignore pre-app leaks -check_leaks_on_destroy [ true] Report leaks on heap destruction -possible_leaks [ true] Show possible-leak callstacks -check_encoded_pointers [ true] Check for encoded pointers -midchunk_size_ok [ true] Consider mid-chunk post-size pointers legitimate -midchunk_new_ok [ true] Consider mid-chunk post-new[]-header pointers legitimate -midchunk_inheritance_ok [ true] Consider mid-chunk multi-inheritance pointers legitimate -midchunk_string_ok [ true] Consider mid-chunk std::string pointers legitimate -show_reachable [ false] List reachable allocs -suppress [ ""] File containing errors to suppress -default_suppress [ true] Use the set of default suppressions -gen_suppress_offs [ true] Generate mod+offs suppressions in the output suppress file -gen_suppress_syms [ true] Generate mod!syms suppressions in the output suppress file -show_threads [ true] Print the callstack of each thread creation point referenced in an error -show_all_threads [ false] Print the callstack of each thread creation point -conservative [ false] Be conservative whenever reading application memory -check_uninit_cmps [ true] Check definedness of comparison instructions -check_uninit_non_moves [ false] Check definedness of all non-move instructions -check_uninit_all [ false] Check definedness of all instructions -strict_bitops [ false] Fully check definedness of bit operations -stack_swap_threshold [0x9000] Stack change amount to consider a swap -redzone_size [ 16] Buffer on either side of each malloc -report_max [ 20000] Maximum non-leak errors to report (-1=no limit) -report_leak_max [ 10000] Maximum leaks to report (-1=no limit) -batch [ false] Do not invoke notepad at the end -summary [ true] Display a summary of results to stderr -use_symcache [ true] Cache results of symbol lookups to speed up future runs -symcache_dir ["/logs/symcache"] Directory for symbol cache files -symcache_minsize [ 1000] Minimum module size to cache symbols for -use_symcache_postcall [ true] Cache post-call sites to speed up future runs -preload_symbols [ false] Preload debug symbols on module load -skip_msvcimporters [ true] Do not search for alloc routines in modules that import from msvc -warn_null_ptr [ false] Warn if NULL passed to free/realloc -delay_frees [ 2000] Frees to delay before committing -delay_frees_maxsz [20000000] Maximum size of frees to delay before committing -delay_frees_stack [ false] Record callstacks on free to use when reporting use-after-free -leaks_only [ false] Check only for leaks and not memory access errors -check_uninitialized [ true] Check for uninitialized read errors -check_stack_bounds [ false] For -no_check_uninitialized, whether to check for beyond-top-of-stack accesses -check_stack_access [ false] For -no_check_uninitialized, whether to check for errors on stack or frame references -check_alignment [ false] For -no_check_uninitialized, whether to consider alignment -fault_to_slowpath [ true] For -no_check_uninitialized, use faults to exit to slowpath -check_gdi [ true] Check for GDI API usage errors -check_handle_leaks [ false] Check for handle leak errors -check_delete_mismatch [ true] Whether to check for free/delete/delete[] mismatches -prctl_whitelist [ ""] Disable instrumentation unless PR_SET_NAME is on list -auxlib [ ""] Load auxiliary system call handling library -analyze_unknown_syscalls [ true] For unknown syscalls use memory comparison to find output params -syscall_dword_granularity [ true] For unknown syscall comparisons, use dword granularity -syscall_sentinels [ false] Use sentinels to detect writes on unknown syscalls. -prefer_msize [ true] Prefer _msize to malloc_usable_size when both are present -perturb [ false] Perturb thread scheduling to increase chances of catching races -perturb_only [ false] Perturb thread scheduling but disable memory checking -perturb_max [ 50] Maximum delay added by -perturb -perturb_seed [ 0] Seed used for random delays added by -perturb -light [ false] Enables a lightweight mode that detects only critical errors -pattern [ 0] Enables pattern mode. A non-zero 2-byte value must be provided -persist_code [ false] Cache instrumented code to speed up future runs -persist_dir ["/logs/codecache"] Directory for code cache files -soft_kills [ true] Ensure external processes terminated by this one exit cleanly -leak_scan [ true] Perform leak scan

derekbruening commented 9 years ago

From zhao...@google.com on December 28, 2012 08:51:24

Can you please show the exact comment to run the program?

derekbruening commented 9 years ago

From zhao...@google.com on December 28, 2012 08:53:14

I mean the command

derekbruening commented 9 years ago

From Aleksey.Vaneev on December 28, 2012 08:53:30

Here is the exact command line with your suggested options: D:\DrMemory\bin\drmemory -debug -dr_debug -dr_ops "-msgbox_mask 0xf" -- D:\libvox\Sources\Apps\DrumSplitter\DrumSplitter.exe

I've tried running Windows notepad that way, and some other programs - the same warning is shown.

derekbruening commented 9 years ago

From zhao...@google.com on December 28, 2012 10:01:51

  1. in windows, it should be drmemory.exe
  2. is DrumSplitter.exe a 32-bit, the released DrM only works for 32-bit binary.
  3. try to run dynamorio with the program first, something like: D:\DrMemory\dynamorio\bin32\drrun.exe -debug -ops "-msgbox_mask 0xf" -- D:\libvox\Sources\Apps\DrumSplitter\DrumSplitter.exe
derekbruening commented 9 years ago

From Aleksey.Vaneev on December 28, 2012 10:04:55

The application is 32-bit one. There is no difference between drmemory.exe and drmemory.

There is no drrun.exe present in the directory - it isn't available in the original ZIP file.

derekbruening commented 9 years ago

From zhao...@google.com on December 28, 2012 10:26:51

DrMemory must running on top of DynamoRIO. where did you get the zip file? The zip file DrMemory-Windows-1.5.0-5.zip I got from https://code.google.com/p/drmemory/downloads/list C:\Users\zhaoqin\Downloads\DrMemory-Windows-1.5.0-5\DrMemory-Windows-1.5.0-5>dir Volume in drive C has no label. Volume Serial Number is 6601-D655

Directory of C:\Users\zhaoqin\Downloads\DrMemory-Windows-1.5.0-5\DrMemory-Windows-1.5.0-5

12/28/2012 12:59 PM

. 12/28/2012 12:59 PM .. 12/28/2012 12:58 PM bin 12/28/2012 12:58 PM drmemory 12/28/2012 12:58 PM dynamorio 12/28/2012 12:59 PM ext 12/28/2012 12:58 PM 2,709 README.txt 1 File(s) 2,709 bytes 6 Dir(s) 816,848,302,080 bytes free

derekbruening commented 9 years ago

From Aleksey.Vaneev on December 28, 2012 21:02:27

Yes, it is exactly directory structure I have, and I did download it from https://code.google.com/p/drmemory/downloads/list

derekbruening commented 9 years ago

From Aleksey.Vaneev on December 29, 2012 01:42:40

I've also noticed that DRMemory does not work correctly when installed via EXE file to the Program Files directory. I have a non-English username in Win7.

derekbruening commented 9 years ago

From Aleksey.Vaneev on December 29, 2012 01:55:15

Yes, right, after creating a new Windows user with English letters only, DRMemory worked as expected.

derekbruening commented 9 years ago

From Aleksey.Vaneev on December 29, 2012 06:00:19

Much thanks for this tool! Caught a couple of hard-to-find bugs.

derekbruening commented 9 years ago

From bruen...@google.com on December 29, 2012 11:26:33

Re: non-ascii support: that was issue #1040 and was fixed in r1112 . You can use a recent build from http://build.chromium.org/p/client.drmemory/builds/ Re: the problems running DrumSplitter and apparently notepad, on both win8 and xp: you're saying that was all really issue #1040 , I'm assuming.

Summary: DO NOT REUSE THIS ISSUE: OPEN A NEW ONE [was: Dr. Memory fails to start with "WARNING: unable to locate results file since can't open .../resfile.PID: 2"] (was: Dr. Memory fails to start with "WARNING: unable to locate results file since can't open .../resfile.PID: 2")

derekbruening commented 9 years ago

From Aleksey.Vaneev on December 29, 2012 21:58:47

Thanks! What a relief ;-)