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

Add debug logging output to Sender #11582

Closed
larsbergstrom opened this issue Jan 15, 2014 · 6 comments
Closed

Add debug logging output to Sender #11582

larsbergstrom opened this issue Jan 15, 2014 · 6 comments
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@larsbergstrom
Copy link
Contributor

It would be great if we could get logging output from channels so that send would do something like:

sending message MSG from task TASK

And any call to recv would do

received message MSG in task TASK

In Servo, we frequently need to debug race conditions and deadlocks or just explain what happens when e.g. we get a mouse click in the window. Having this debugging info would greatly help (and let us build visualization tools on top of the output).

@alexcrichton
Copy link
Member

Note that debugging a message would probably involve using {:?}, which I'm hesistant to commit to in the usage of channels. I'd be OK with by default, these messages would be logged

  • task {name} - sending message
  • task {name} - blocking for a message
  • task {name} - received a message

If you built libstd with --cfg debug (or something like that), then we could include the {:?} format of the message. I figure that if we put the task name up front it's easier to scan over.

@larsbergstrom
Copy link
Contributor Author

That strategy sounds perfect.

Additionally, with the blocking for a message output, if we also have a way of logging task exit, it would help with another problem that we have in servo right now, which is that when you do pool.shutdown() and have a green thread blocked in recv, it doesn't show up in threads list (LLDB), but the fact that it was blocking would show up in the output.

@alexcrichton alexcrichton changed the title Add debug logging output to Chan Add debug logging output to Sender May 7, 2014
@steveklabnik
Copy link
Member

Triage: no change that I'm aware of.

@larsbergstrom do you still feel this pain?

@larsbergstrom
Copy link
Contributor Author

So we feel the pain a bit less after the removal of green threads, because there's always a stack backtrace above the thread.

That said, we have these concurrency problems ALL the time, leading to huge numbers of intermittents in Servo. I suspect, though, that the right solution is for us to be using https://github.com/mozilla/rr to debug these issues in Servo, though, rather than broken printf-debugging. If we want that, we can always (at least on linux) use some cheesy gdb-automation breakpoints to spit out messages similar to the ones @alexcrichton is suggesting, without bloating the stdlib.

@apasel422
Copy link
Contributor

We could take the approach @alexcrichton described, but use specialization to log the actual values when T: Debug.

@steveklabnik steveklabnik added T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. and removed A-libs labels Mar 24, 2017
@Mark-Simulacrum Mark-Simulacrum added the C-enhancement Category: An issue proposing an enhancement or a PR with one. label Jul 20, 2017
@steveklabnik
Copy link
Member

Triage: with no comments in years, I don't think this is likely to happen. I'm going to give it a close. If anyone strongly desires this, please let me know, and we can re-open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants