Opened 15 years ago

Closed 14 years ago

Last modified 14 years ago

#131 closed enhancement (fixed)

Task memory dumps

Reported by: Jiri Svoboda Owned by:
Priority: major Milestone: 0.4.2
Component: helenos/unspecified Version: mainline
Keywords: Cc:
Blocker for: Depends on:
See also:

Description

We need a mechanism to dump the memory of a task which has crashed (a.k.a. core dump).

The idea is that when a task is terminated because of some error, the system does not clean up its memory immediately. Instead the user-space takes action according to system policy (e.g. copies the contents of the memory to a file, starts up a debugger) and only after this action finishes, the task memory is freed. This mechanism has three main parts:

  • Ensure that task memory is not immediately freed.
  • Notify some user-space server that a task was terminated.
  • After the action is finished, notify kernel that the task memory can be freed.

It would be advisable to minimize the danger that task memory does not get freed up if the dump action fails.

Change History (2)

comment:1 by Jiri Svoboda, 14 years ago

Resolution: fixed
Status: newclosed

Task dump infrastructure was merged in changeset:head,222.

Udebug method AREAS_READ was added for retrieving a list of memory areas from an application. The utility taskdump uses this to dump a list of memory areas (and optionally their contents with the -m option) from the specified task. It can be applied to a running task or it can be used to dump crashing tasks.

A task monitoring service taskmon registers for kernel FAULT notifications. When a thread faults and is about to terminate, it generates this kernel event and waits for a debugging session. Taskmon executes taskdump which dumps the task state. After the debugging session is over, the faulting thread continues and terminates the whole task.

By default a full memory dump is not taken when a task crashes because it takes a lot of time and memory. To get full memory dumps enable the configuration option Verbose task dumps.

Future improvements: Taskdump is in a good position to dump a stack trace of the faulting thread, but does not do so. Taskdump should be able to dump core files in binary ELF format.

Notes: Redirection of stdout does not seem to work properly if stdin is not redirected and console is not available. It also appears that if udebug.active_cv is broadcasted with udebug.lock held, the system hangs. This may have connection with the fact that the exception handlers appear not to be preemptible.

comment:2 by Jakub Jermář, 14 years ago

Milestone: post 0.5.00.4.2
Note: See TracTickets for help on using tickets.