ValveSoftware / steamworks-vr-api

Source for the Steamworks VR API
Other
137 stars 30 forks source link

shm_open fails composing an address path longer than SHM_NAME_MAX #20

Open nferruzzi opened 10 years ago

nferruzzi commented 10 years ago

Recently one problem we have been facing on macosx is the impossibility to run steamvr (latest BETA and dk2 0.4.x).

vrserver_osx.txt [...] Fri Sep 05 17:33:54 2014 UTC - VR server (v1408996868) starting up with config=/Applications/Steam.app/Contents/config Fri Sep 05 17:33:54 2014 UTC - Unable to create shared memory for IPC client Fri Sep 05 17:33:54 2014 UTC - Failed to start server with error 302 [...]

After some debugging of vrserver_osx using dtrace I found the problem is caused by shm_open failing with errno ENAMETOOLONG.

[...] 2196/0x1b6ab: 1003347 4 2 read_nocancel(0xF, "[oculus]\r\n\r\n[vortex]\r\n\r\n\r\n\0", 0x1000) = 26 0 2196/0x1b6ab: 1003360 5 3 close_nocancel(0xF) = 0 0 2196/0x1b6ab: 1003370 2 0 shm_open(0x4589C0, 0xA02, 0x1FF) = -1 Err#63 2196/0x1b6ab: 1003379 6 4 write_nocancel(0xE, "Fri Sep 05 11:45:01 2014 UTC - Unable to create shared memory for IPC client\n\0", 0x4D) = 77 0 2196/0x1b6ab: 1003385 4 2 write_nocancel(0xE, "Fri Sep 05 11:45:01 2014 UTC - Failed to start server with error 302\n\0", 0x45) = 69 0 2196/0x1b6ab: 1003396 2 0 shutdown(0xC, 0x1, 0x45) = -1 Err#57 2196/0x1b6ab: 1003403 6 5 close(0xC) = 0 0 [...]

dumping the address of shm_open arg0 I got something like this

"/Shm/VR_nferruzzi_41d166ec_2828"

Basically calls to shm_open should avoid a situation where they are close to this SHM_NAME_MAX limit; unfortunately I can't provide a patch since this repo is not updated :D :(

dtrace scripts used

!/usr/sbin/dtrace -s

syscall::shm_open:entry { printf("addr: 0x%08x -> %s flags: 0x%04x(%s) mode: 0x%04x", arg0, copyinstr(arg0), arg1, (arg1 & O_RDWR) ? "rw" : (arg1 == O_RDONLY) ? "read" : (arg1 & O_CREAT) ? "create" : "other", arg2); }

syscall::shm_open:return { printf("ret: %d errno: %d", arg0, errno); }

JoeLudwig commented 10 years ago

This is great to know. I'll take a look.

tibbon commented 10 years ago

Are there any temporary workarounds currently?