Valgrind/R is not working: “Fatal error: cannot create 'R_TempDir'”

怎甘沉沦 提交于 2019-12-10 16:24:17

问题


First of all, I'm not really skilled with these kind of stuff, so I may write stupid question, please be kind ;-)

I have an R code that call a c++ code. Unfortunately, there is a problem with my code, probably memory not mapped, and i would like to use valgrind to try to understand where the error is.

I already use it a couple of years ago, but now it seems to not work. When I lunch the following command

R -d valgrind

I get this output

==69495== Memcheck, a memory error detector
==69495== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==69495== Using Valgrind-3.14.0.GIT and LibVEX; rerun with -h for copyright info
==69495== Command: /Library/Frameworks/R.framework/Resources/bin/exec/R
==69495==
==69495== Conditional jump or move depends on uninitialised value(s)
==69495==    at 0x101472F31: ccaes_vng_ctr_crypt (in /usr/lib/system/libcorecrypto.dylib)
==69495==    by 0x101476D88: bcc_update (in /usr/lib/system/libcorecrypto.dylib)
==69495==    by 0x101476E2C: df_bcc_update (in /usr/lib/system/libcorecrypto.dylib)
==69495==    by 0x101476A15: df (in /usr/lib/system/libcorecrypto.dylib)
==69495==    by 0x101476631: nistctr_init (in /usr/lib/system/libcorecrypto.dylib)
==69495==    by 0x10147607B: init (in /usr/lib/system/libcorecrypto.dylib)
==69495==    by 0x101623C9E: arc4_init (in /usr/lib/system/libsystem_c.dylib)
==69495==    by 0x101623B59: arc4random (in /usr/lib/system/libsystem_c.dylib)
==69495==    by 0x101623F7D: arc4random_uniform (in /usr/lib/system/libsystem_c.dylib)
==69495==    by 0x10163E765: find_temp_path (in /usr/lib/system/libsystem_c.dylib)
==69495==    by 0x10163EABF: mkdtemp (in /usr/lib/system/libsystem_c.dylib)
==69495==    by 0x1002418CE: R_reInitTempDir (sysutils.c:1662)
==69495==
==69495== Conditional jump or move depends on uninitialised value(s)
==69495==    at 0x101472F31: ccaes_vng_ctr_crypt (in /usr/lib/system/libcorecrypto.dylib)
==69495==    by 0x101476D88: bcc_update (in /usr/lib/system/libcorecrypto.dylib)
==69495==    by 0x101476EBC: df_bcc_update (in /usr/lib/system/libcorecrypto.dylib)
==69495==    by 0x101476A15: df (in /usr/lib/system/libcorecrypto.dylib)
==69495==    by 0x101476631: nistctr_init (in /usr/lib/system/libcorecrypto.dylib)
==69495==    by 0x10147607B: init (in /usr/lib/system/libcorecrypto.dylib)
==69495==    by 0x101623C9E: arc4_init (in /usr/lib/system/libsystem_c.dylib)
==69495==    by 0x101623B59: arc4random (in /usr/lib/system/libsystem_c.dylib)
==69495==    by 0x101623F7D: arc4random_uniform (in /usr/lib/system/libsystem_c.dylib)
==69495==    by 0x10163E765: find_temp_path (in /usr/lib/system/libsystem_c.dylib)
==69495==    by 0x10163EABF: mkdtemp (in /usr/lib/system/libsystem_c.dylib)
==69495==    by 0x1002418CE: R_reInitTempDir (sysutils.c:1662)
==69495==
==69495== Conditional jump or move depends on uninitialised value(s)
==69495==    at 0x101472F31: ccaes_vng_ctr_crypt (in /usr/lib/system/libcorecrypto.dylib)
==69495==    by 0x101476D88: bcc_update (in /usr/lib/system/libcorecrypto.dylib)
==69495==    by 0x101476A6E: df (in /usr/lib/system/libcorecrypto.dylib)
==69495==    by 0x101476631: nistctr_init (in /usr/lib/system/libcorecrypto.dylib)
==69495==    by 0x10147607B: init (in /usr/lib/system/libcorecrypto.dylib)
==69495==    by 0x101623C9E: arc4_init (in /usr/lib/system/libsystem_c.dylib)
==69495==    by 0x101623B59: arc4random (in /usr/lib/system/libsystem_c.dylib)
==69495==    by 0x101623F7D: arc4random_uniform (in /usr/lib/system/libsystem_c.dylib)
==69495==    by 0x10163E765: find_temp_path (in /usr/lib/system/libsystem_c.dylib)
==69495==    by 0x10163EABF: mkdtemp (in /usr/lib/system/libsystem_c.dylib)
==69495==    by 0x1002418CE: R_reInitTempDir (sysutils.c:1662)
==69495==    by 0x1001B29AE: setup_Rmainloop (main.c:841)
==69495==
==69495== Conditional jump or move depends on uninitialised value(s)
==69495==    at 0x101472F31: ccaes_vng_ctr_crypt (in /usr/lib/system/libcorecrypto.dylib)
==69495==    by 0x101476B30: df (in /usr/lib/system/libcorecrypto.dylib)
==69495==    by 0x101476631: nistctr_init (in /usr/lib/system/libcorecrypto.dylib)
==69495==    by 0x10147607B: init (in /usr/lib/system/libcorecrypto.dylib)
==69495==    by 0x101623C9E: arc4_init (in /usr/lib/system/libsystem_c.dylib)
==69495==    by 0x101623B59: arc4random (in /usr/lib/system/libsystem_c.dylib)
==69495==    by 0x101623F7D: arc4random_uniform (in /usr/lib/system/libsystem_c.dylib)
==69495==    by 0x10163E765: find_temp_path (in /usr/lib/system/libsystem_c.dylib)
==69495==    by 0x10163EABF: mkdtemp (in /usr/lib/system/libsystem_c.dylib)
==69495==    by 0x1002418CE: R_reInitTempDir (sysutils.c:1662)
==69495==    by 0x1001B29AE: setup_Rmainloop (main.c:841)
==69495==    by 0x1001B3558: Rf_mainloop (main.c:1088)
==69495==
==69495== Conditional jump or move depends on uninitialised value(s)
==69495==    at 0x101476CBC: drbg_update (in /usr/lib/system/libcorecrypto.dylib)
==69495==    by 0x1014766AA: nistctr_init (in /usr/lib/system/libcorecrypto.dylib)
==69495==    by 0x10147607B: init (in /usr/lib/system/libcorecrypto.dylib)
==69495==    by 0x101623C9E: arc4_init (in /usr/lib/system/libsystem_c.dylib)
==69495==    by 0x101623B59: arc4random (in /usr/lib/system/libsystem_c.dylib)
==69495==    by 0x101623F7D: arc4random_uniform (in /usr/lib/system/libsystem_c.dylib)
==69495==    by 0x10163E765: find_temp_path (in /usr/lib/system/libsystem_c.dylib)
==69495==    by 0x10163EABF: mkdtemp (in /usr/lib/system/libsystem_c.dylib)
==69495==    by 0x1002418CE: R_reInitTempDir (sysutils.c:1662)
==69495==    by 0x1001B29AE: setup_Rmainloop (main.c:841)
==69495==    by 0x1001B3558: Rf_mainloop (main.c:1088)
==69495==    by 0x100000F5A: main (in /Library/Frameworks/R.framework/Resources/bin/exec/R)
==69495==
==69495== Conditional jump or move depends on uninitialised value(s)
==69495==    at 0x101472F31: ccaes_vng_ctr_crypt (in /usr/lib/system/libcorecrypto.dylib)
==69495==    by 0x10147621E: generate (in /usr/lib/system/libcorecrypto.dylib)
==69495==    by 0x101623B92: arc4random (in /usr/lib/system/libsystem_c.dylib)
==69495==    by 0x101623F7D: arc4random_uniform (in /usr/lib/system/libsystem_c.dylib)
==69495==    by 0x10163E765: find_temp_path (in /usr/lib/system/libsystem_c.dylib)
==69495==    by 0x10163EABF: mkdtemp (in /usr/lib/system/libsystem_c.dylib)
==69495==    by 0x1002418CE: R_reInitTempDir (sysutils.c:1662)
==69495==    by 0x1001B29AE: setup_Rmainloop (main.c:841)
==69495==    by 0x1001B3558: Rf_mainloop (main.c:1088)
==69495==    by 0x100000F5A: main (in /Library/Frameworks/R.framework/Resources/bin/exec/R)
==69495==
==69495== Conditional jump or move depends on uninitialised value(s)
==69495==    at 0x101472F31: ccaes_vng_ctr_crypt (in /usr/lib/system/libcorecrypto.dylib)
==69495==    by 0x101476C3F: drbg_update (in /usr/lib/system/libcorecrypto.dylib)
==69495==    by 0x101476269: generate (in /usr/lib/system/libcorecrypto.dylib)
==69495==    by 0x101623B92: arc4random (in /usr/lib/system/libsystem_c.dylib)
==69495==    by 0x101623F7D: arc4random_uniform (in /usr/lib/system/libsystem_c.dylib)
==69495==    by 0x10163E765: find_temp_path (in /usr/lib/system/libsystem_c.dylib)
==69495==    by 0x10163EABF: mkdtemp (in /usr/lib/system/libsystem_c.dylib)
==69495==    by 0x1002418CE: R_reInitTempDir (sysutils.c:1662)
==69495==    by 0x1001B29AE: setup_Rmainloop (main.c:841)
==69495==    by 0x1001B3558: Rf_mainloop (main.c:1088)
==69495==    by 0x100000F5A: main (in /Library/Frameworks/R.framework/Resources/bin/exec/R)
==69495==
==69495== Conditional jump or move depends on uninitialised value(s)
==69495==    at 0x101476C5C: drbg_update (in /usr/lib/system/libcorecrypto.dylib)
==69495==    by 0x101476269: generate (in /usr/lib/system/libcorecrypto.dylib)
==69495==    by 0x101623B92: arc4random (in /usr/lib/system/libsystem_c.dylib)
==69495==    by 0x101623F7D: arc4random_uniform (in /usr/lib/system/libsystem_c.dylib)
==69495==    by 0x10163E765: find_temp_path (in /usr/lib/system/libsystem_c.dylib)
==69495==    by 0x10163EABF: mkdtemp (in /usr/lib/system/libsystem_c.dylib)
==69495==    by 0x1002418CE: R_reInitTempDir (sysutils.c:1662)
==69495==    by 0x1001B29AE: setup_Rmainloop (main.c:841)
==69495==    by 0x1001B3558: Rf_mainloop (main.c:1088)
==69495==    by 0x100000F5A: main (in /Library/Frameworks/R.framework/Resources/bin/exec/R)
==69495==
==69495== Conditional jump or move depends on uninitialised value(s)
==69495==    at 0x101476CBC: drbg_update (in /usr/lib/system/libcorecrypto.dylib)
==69495==    by 0x101476269: generate (in /usr/lib/system/libcorecrypto.dylib)
==69495==    by 0x101623B92: arc4random (in /usr/lib/system/libsystem_c.dylib)
==69495==    by 0x101623F7D: arc4random_uniform (in /usr/lib/system/libsystem_c.dylib)
==69495==    by 0x10163E765: find_temp_path (in /usr/lib/system/libsystem_c.dylib)
==69495==    by 0x10163EABF: mkdtemp (in /usr/lib/system/libsystem_c.dylib)
==69495==    by 0x1002418CE: R_reInitTempDir (sysutils.c:1662)
==69495==    by 0x1001B29AE: setup_Rmainloop (main.c:841)
==69495==    by 0x1001B3558: Rf_mainloop (main.c:1088)
==69495==    by 0x100000F5A: main (in /Library/Frameworks/R.framework/Resources/bin/exec/R)
==69495==
==69495== Conditional jump or move depends on uninitialised value(s)
==69495==    at 0x101623F86: arc4random_uniform (in /usr/lib/system/libsystem_c.dylib)
==69495==    by 0x10163E765: find_temp_path (in /usr/lib/system/libsystem_c.dylib)
==69495==    by 0x10163EABF: mkdtemp (in /usr/lib/system/libsystem_c.dylib)
==69495==    by 0x1002418CE: R_reInitTempDir (sysutils.c:1662)
==69495==    by 0x1001B29AE: setup_Rmainloop (main.c:841)
==69495==    by 0x1001B3558: Rf_mainloop (main.c:1088)
==69495==    by 0x100000F5A: main (in /Library/Frameworks/R.framework/Resources/bin/exec/R)
==69495==
==69495== Use of uninitialised value of size 8
==69495==    at 0x10163E768: find_temp_path (in /usr/lib/system/libsystem_c.dylib)
==69495==    by 0x10163EABF: mkdtemp (in /usr/lib/system/libsystem_c.dylib)
==69495==    by 0x1002418CE: R_reInitTempDir (sysutils.c:1662)
==69495==    by 0x1001B29AE: setup_Rmainloop (main.c:841)
==69495==    by 0x1001B3558: Rf_mainloop (main.c:1088)
==69495==    by 0x100000F5A: main (in /Library/Frameworks/R.framework/Resources/bin/exec/R)
==69495==
==69495== Conditional jump or move depends on uninitialised value(s)
==69495==    at 0x10163E8BD: find_temp_path (in /usr/lib/system/libsystem_c.dylib)
==69495==    by 0x10163EABF: mkdtemp (in /usr/lib/system/libsystem_c.dylib)
==69495==    by 0x1002418CE: R_reInitTempDir (sysutils.c:1662)
==69495==    by 0x1001B29AE: setup_Rmainloop (main.c:841)
==69495==    by 0x1001B3558: Rf_mainloop (main.c:1088)
==69495==    by 0x100000F5A: main (in /Library/Frameworks/R.framework/Resources/bin/exec/R)
==69495==
--69495-- WARNING: unhandled amd64-darwin syscall: unix:475
--69495-- You may be able to write your own handler.
--69495-- Read the file README_MISSING_SYSCALL_OR_IOCTL.
--69495-- Nevertheless we consider this a bug.  Please report
--69495-- it at http://valgrind.org/support/bug_reports.html.
Fatal error: cannot create 'R_TempDir'
==69495==
==69495== HEAP SUMMARY:
==69495==     in use at exit: 189,122 bytes in 408 blocks
==69495==   total heap usage: 530 allocs, 122 frees, 504,429 bytes allocated
==69495==
==69495== LEAK SUMMARY:
==69495==    definitely lost: 1,664 bytes in 26 blocks
==69495==    indirectly lost: 0 bytes in 0 blocks
==69495==      possibly lost: 456 bytes in 10 blocks
==69495==    still reachable: 130,172 bytes in 237 blocks
==69495==         suppressed: 56,830 bytes in 135 blocks
==69495== Rerun with --leak-check=full to see details of leaked memory
==69495==
==69495== For counts of detected and suppressed errors, rerun with: -v
==69495== Use --track-origins=yes to see where uninitialised values come from
==69495== ERROR SUMMARY: 30 errors from 12 contexts (suppressed: 1 from 1)

and R is then not loaded. I don't know how to solve it. I know that the error "Fatal error: cannot create 'R_TempDir'" could mean that there is no more space on the hard drive, but this is not the case.

I'm on macbook pro, with High Sierra, and R 3.5.0


回答1:


Valgrind produces an error message telling that the unix:475 syscall is not handled.

In such a case, it reports to the guest application that the syscall failed, with errno ENOSYS.

Syscall 475 on darwin is the mkdirat syscall. I guess that when this syscall fails, R then reports the fatal error that it cannot create R_Tempdir.

As indicated in the error message, you should file a bug report on valgrind bugzilla.

You could also try to fix this : it might be a trivial change in the valgrind file m_syswrap/priv_syswrap-darwin.h, to make something similar to e.g. the line readlinkat a few lines above.



来源:https://stackoverflow.com/questions/53373903/valgrind-r-is-not-working-fatal-error-cannot-create-r-tempdir

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!