Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GlobalReplayer has no entry for ThreadId[8,1,1] - basically a thread that spawns but does nothing #50

Open
bhavanamehta5 opened this issue Nov 2, 2021 · 2 comments

Comments

@bhavanamehta5
Copy link
Collaborator

Behavior:
Basically this is what I see(screenshots below):
image
So here there is no event associated with [8,1,1] as we can see in recordlog:
image

The only time [8,1,1] appears in recordlog is in the above image(line3) as:
(event:ThreadInitialized((thread_id:(8,1,1,0,0,0,0,0,0,0),size:3)),channel_variant:None,chan_id:(det_thread_id:(thread_id:(0,0,0,0,0,0,0,0,0,0),size:0),channel_id:0),type_name:"Thread")

So the thread [8,1,1] was spawned by [8,1,0] but it has no event - not used anywhere else.

Hypothesis:
We are assuming atleast one event is always there otherwise we leave the recordlog empty.
For a thread that spawns but does nothing we don't create an empty logger but during replay we assume we will be able to take its entry from the global replayer.

Disambiguation of the hypothesis:
Assertion to disambiguate the hypothesis above in servo(maybe write a test later - expensive)

Solutions:

@bhavanamehta5
Copy link
Collaborator Author

possible solutions:

  • give the spawned threads an event like a det_id so that it's not an empty event
  • remove that condition?

@bhavanamehta5
Copy link
Collaborator Author

Solution: Record all the spawned threads in recordlog.

This crash was happening because during replay mode the Global Replayer was trying to find an entry for the spawned threads which does nothing after being spawned. These kinds of threads were earlier not recorded in the recordlog.

Fixed this by recording every spawned thread in the recordlog.

  1. created a new event in TivoEvent::ThreadSpawned which records all the spawned threads in recordlog, also implemented RecordEventChecker very similar to the one for ThreadInitialized.(see recordlog.rs)
  2. added code for recording after spawning happens in addition to recording after thread being initialized.(see detthread.rs)

As a result the Global Replayer always finds an entry for spawned threads that do nothing in the program, earlier these threads created no entry and as a result Global Replayer gave us an error from function take_entry.

Test Case: Added a test case in the test suite to check if all the spawned threads are being recorded in recordlog, especially the ones which are not being used after spawning.(see detthread.rs test suite).
This is now integrated with the test suite, to run it separately run:
cargo test detthread::tests::spawned_thread_recordreplay_test inside rr_channel directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant