janestreet / janestreet/memtrace
Memtrace does not play well with asynchronous exceptions
- Dominant language
- OCaml
- Stars
- 87
- Forks
- 26
- PR merge metrics
- No merged PRs in 30d
Description
Memtrace catches exceptions without necessarily re-raising them, and places itself in an invalid state when this happens (see https://github.com/janestreet/memtrace/blob/master/src/memprof_tracer.ml). But some programs around rely on exceptions arising from signals handlers (e.g. for sigint or sigalrm) or finalisers (e.g. Gc.alarms), which do not denote a failure of memtrace but should always be re-raised by the memprof callbacks.
The most straightforward solution is to delay the possibly-raising callbacks inside the memprof callbacks with a solution such as proposed here: https://github.com/ocaml/ocaml/pull/8961. I record this issue as a reminder for when such a solution is available.
Contributor guide
Research direction
Start with src/memprof_tracer.ml to understand how exceptions from memprof callbacks can leave memtrace invalid. Review the linked OCaml pull request 8961 before choosing an approach, then check signal-handler and finaliser cases such as SIGINT, SIGALRM, and Gc.alarms. Done means these exceptions are re-raised without corrupting memtrace state.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ocaml
- Domain
- performance, tooling
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100