rr-debugger / rr-debugger/rr

rr record seems to loop infinitely in 32-bit x86 with certain system calls

Open
#3,518 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
10.7k
Forks
662
Avg merge
2d 3h
Merged PRs (30d)
2

Description

I don't have a full diagnosis of what is going wrong here. The symptoms I've observed are that attempts to run rr-record on an x86 32-bit build of OpenJDK tip do not return from a call to the mmap system call. top reports that rr continue to run, but trace statements placed before and after the mmap call confirm that control does not return from mmap.

When I run the same 32-bit build outside rr, trace statements confirm that the mmap call is successful. I have also been able to step through (over) the call to mmap service with gdb.

This problem with mmap calls is not universal. I have found that during initialization of the JVM, the first 7 calls to mmap succeed. As far as I have been able to understand, all of the invocations are identical except for the size of the request:

With system call prototype: void *mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset)
The successful calls are parameterized, in order, as:

mmap(nullptr, 4096, PROT_NONE, MAP_PRIVATE | MAP_NORESERVE | MAP_ANONYMOUS, -1, 0);
mmap(nullptr, 8192, PROT_NONE, MAP_PRIVATE | MAP_NORESERVE | MAP_ANONYMOUS, -1, 0);
mmap(nullptr, 32768, PROT_NONE, MAP_PRIVATE | MAP_NORESERVE | MAP_ANONYMOUS, -1, 0);
mmap(nullptr, 251_658_240, PROT_NONE, MAP_PRIVATE | MAP_NORESERVE | MAP_ANONYMOUS, -1, 0);
mmap(nullptr, 45_056, PROT_NONE, MAP_PRIVATE | MAP_NORESERVE | MAP_ANONYMOUS, -1, 0);
mmap(nullptr, 962_560, PROT_NONE, MAP_PRIVATE | MAP_NORESERVE | MAP_ANONYMOUS, -1, 0);
mmap(nullptr, 962_560, PROT_NONE, MAP_PRIVATE | MAP_NORESERVE | MAP_ANONYMOUS, -1, 0);

The eight call, which has the largest requested size so far, is the one that fails to return (when running in rr):

mmap(nullptr, 1_073_741_824, PROT_NONE, MAP_PRIVATE | MAP_NORESERVE | MAP_ANONYMOUS, -1, 0);

Maybe this description is enough to prompt some thought about what might be going wrong. If not, I can provide more details regarding how to reproduce this problem and/or I can gather more details within my environment to help you debug futher.

Thanks.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing rr-record with the 32-bit OpenJDK build and compare the eighth mmap call with the successful calls, using the reported gdb stepping and trace statements. Done means identifying why the 1 GiB mmap does not return under rr and documenting or implementing a fix that allows recording to continue.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, java, linux
Domain
devtools, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.