{"action":"created","issue":{"url":"https://api.github.com/repos/mozilla/rr/issues/1585","labels_url":"https://api.github.com/repos/mozilla/rr/issues/1585/labels{/name}","comments_url":"https://api.github.com/repos/mozilla/rr/issues/1585/comments","events_url":"https://api.github.com/repos/mozilla/rr/issues/1585/events","html_url":"https://github.com/mozilla/rr/issues/1585","id":115776235,"number":1585,"title":"Large read-only shared mappings can be unnecessarily expensive","user":{"login":"rocallahan","id":296135,"avatar_url":"https://avatars.githubusercontent.com/u/296135?v=3","gravatar_id":"","url":"https://api.github.com/users/rocallahan","html_url":"https://github.com/rocallahan","followers_url":"https://api.github.com/users/rocallahan/followers","following_url":"https://api.github.com/users/rocallahan/following{/other_user}","gists_url":"https://api.github.com/users/rocallahan/gists{/gist_id}","starred_url":"https://api.github.com/users/rocallahan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rocallahan/subscriptions","organizations_url":"https://api.github.com/users/rocallahan/orgs","repos_url":"https://api.github.com/users/rocallahan/repos","events_url":"https://api.github.com/users/rocallahan/events{/privacy}","received_events_url":"https://api.github.com/users/rocallahan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-11-09T01:26:52Z","updated_at":"2015-11-11T03:38:18Z","closed_at":null,"body":"Firefox stackwalking code reads a lot of symbol information by walking `/proc/.../maps`, mapping the entirety of every file it finds `MAP_SHARED` and `PROT_READ`, processing symbol data, and then unmapping the file. One of these files is `libxul.so` which is 800MB (including debug info!) on my system. During recording we copy all that data into the trace. Then during replay `finish_shared_mmap` creates an EmuFs entry and copies that data into a temporary EmuFs file. Even worse, the processing takes quite a long time and happens off the main thread, so during debugging a number of session clones are created --- each on of which makes its own copy of all that data. On one replay run I see 11 copies of `libxul.so` being created in `/dev/shm`, at which point it fills up and we can't replay any more... This is all entirely pointless since `libxul.so` does not change during the recorded run!\r\n\r\nA number of other `r--s` mappings occur persistently in Firefox --- fontconfig cache, `mime.cache`, `gconf-modules.cache`. So if we can detect shared mappings that never change and reduce the cost of them, that would really help."},"comment":{"url":"https://api.github.com/repos/mozilla/rr/issues/comments/155652781","html_url":"https://github.com/mozilla/rr/issues/1585#issuecomment-155652781","issue_url":"https://api.github.com/repos/mozilla/rr/issues/1585","id":155652781,"user":{"login":"rocallahan","id":296135,"avatar_url":"https://avatars.githubusercontent.com/u/296135?v=3","gravatar_id":"","url":"https://api.github.com/users/rocallahan","html_url":"https://github.com/rocallahan","followers_url":"https://api.github.com/users/rocallahan/followers","following_url":"https://api.github.com/users/rocallahan/following{/other_user}","gists_url":"https://api.github.com/users/rocallahan/gists{/gist_id}","starred_url":"https://api.github.com/users/rocallahan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rocallahan/subscriptions","organizations_url":"https://api.github.com/users/rocallahan/orgs","repos_url":"https://api.github.com/users/rocallahan/repos","events_url":"https://api.github.com/users/rocallahan/events{/privacy}","received_events_url":"https://api.github.com/users/rocallahan/received_events","type":"User","site_admin":false},"created_at":"2015-11-11T03:38:18Z","updated_at":"2015-11-11T03:38:18Z","body":"> If we decline to copy a file in should_copy_mmap_region, then later a different mapping of the same file should also decline to copy it, since we've already committed to the assumption that the file won't change. That would fix these stackwalking maps completely; we wouldn't even write the binaries to the trace.\r\n\r\nImplemented in https://github.com/mozilla/rr/commit/da63bfe680d6c2bb5e0e8c587740df1cf45aafb2."}}