18

I had this message in my kernel log : INFO: task XXX blocked for more than 120 seconds. I would like to know what it means technically: under what conditions does the kernel display this message about a task?

For the record, my blocked task was multipathd, but I'm also interested in the general meaning of this error.

Anthon
  • 78,313
  • 42
  • 165
  • 222
Totor
  • 19,302
  • 17
  • 75
  • 102

2 Answers2

14

If a task is blocked, it waits for resources to become available again.

In your case there was propably either a IO-problem or a contention in the disk-area. Or your system-load was so high that there was not enough CPU-power available to finish the job in time.

I have seen this error from cron, if it tries to start a job in a very busy time.

Nils
  • 18,202
  • 11
  • 46
  • 82
  • Can you be more specific? Does "blocked" mean "continuously in an uninterruptible state"? – Totor Aug 13 '13 at 23:17
  • @Totor In this context it is waiting for resources. So other io is not interruptable . – Nils Aug 19 '13 at 20:53
8

Basically this logging is triggered if the CPU scheduler hasn't switched to the process in the given amount of time, and the process doesn't qualify for an exception.

The exceptions are special cases where a process hasn't been switched to but it shouldn't get logged about. I don't clearly understand the conditions for the exceptions; FWIW the comments on the cases in the code are:

Also, skip vfork and any other user process that freezer should skip.

Also, when a freshly created task is scheduled once, changes
its state to TASK_UNINTERRUPTIBLE without having ever been
switched out once, it musn't be checked.

(from check_hung_task() in Linux hung_task.c) https://elixir.bootlin.com/linux/v5.12.12/source/kernel/hung_task.c#L92

As to why a task might not be scheduled for a long period of time, it being continuously in TASK_UNINTERRUPTABLE ('D' state in top), such as when blocked waiting for I/O to complete, would be one possibility, but I don't know what others there might be.

rakslice
  • 1,147
  • 2
  • 11
  • 17
  • Perhaps a relevant bug: Linux 3.14-3.17 on Haswell processors - processes can hang on futex_wait - https://groups.google.com/d/msg/mechanical-sympathy/QbmpZxp6C64/BonaHiVbEmsJ – rakslice May 14 '15 at 22:00