
{"id":8650,"date":"2013-07-08T15:30:48","date_gmt":"2013-07-08T15:30:48","guid":{"rendered":"http:\/\/www.beautifulwork.org\/?page_id=8650"},"modified":"2013-07-08T15:30:48","modified_gmt":"2013-07-08T15:30:48","slug":"hung_task_timeout_secs-hung-task-timeout","status":"publish","type":"post","link":"https:\/\/www.trueangle.org\/index.php\/2013\/07\/08\/hung_task_timeout_secs-hung-task-timeout\/","title":{"rendered":"hung_task_timeout_secs( topic related to linux kernel  hangup )"},"content":{"rendered":"<p><u>ABOUT hung_task_timeout_secs<\/u><\/p>\n<pre style=\"font-size:100%\"> \nif a task(process) is hung then hung_task_timeout_secs value<br \/> decides if the hung task needs no reboot or reboot after <br \/>n seconds\n<\/pre>\n<p>LINUX KERNEL RELATED PARAMETER<br \/>$cat \/proc\/sys\/kernel\/hung_task_timeout_secs<br \/>120<br \/>$<\/p>\n<p>$echo 0 | sudo tee &#8211;append \/proc\/sys\/kernel\/ hung_task_timeout_secs<br \/>0<br \/>$sudo cat \/proc\/sys\/kernel\/hung_task_timeout_secs<br \/>0<br \/>$<\/p>\n<pre style=\"font-size:70%\">\nWhen a task in D state did not get scheduled for more than<br \/>this value report a warning.This file shows up if CONFIG_<br \/>DETECT_HUNG_TASK is enabled.\n\n0: means infinite timeout - no checking done. Possible values<br \/>to set are in range {0..LONG_MAX\/HZ}.\n\n<\/pre>\n<p>PARAMETER RELATED<\/p>\n<p>TEST-MAIL1 ~ #dmesg<\/p>\n<p>&#8220;echo 0 &gt; \/proc\/sys\/kernel\/hung_task_timeout_secs&#8221; disables this message.<br \/>rm D ffff88107f472c40 0 16705 22512 0x00000000<br \/>ffff881014693810 0000000000000086 ffff881000000000 ffff88102013b040<br \/>0000000000012c40 ffff880471855fd8 0000000000012c40 ffff880471854010<br \/>ffff880471855fd8 0000000000012c40 ffff881017ff8e40 0000000100000000<br \/>Call Trace:<br \/>[&lt;ffffffff8148d45d&gt;] ? schedule_timeout+0x1ed\/0x2d0<br \/>[&lt;ffffffffa0b7d1ea&gt;] ? dlmlock+0x8a\/0xda0 [ocfs2_dlm]<br \/>[&lt;ffffffff8148ce5c&gt;] ? wait_for_common+0x12c\/0x1a0<br \/>[&lt;ffffffff81052230&gt;] ? try_to_wake_up+0x280\/0x280<br \/>[&lt;ffffffffa0a3b9c0&gt;] ? __ocfs2_cluster_lock+0x1f0\/0x780 [ocfs2]<br \/>[&lt;ffffffff8148ce80&gt;] ? wait_for_common+0x150\/0x1a0<br \/>[&lt;ffffffffa0a9c6bc&gt;] ? ocfs2_buffer_cached+0x8c\/0x180 [ocfs2]<br \/>[&lt;ffffffffa0a40bc6&gt;] ? ocfs2_inode_lock_full_nested+0x126\/0x540 [ocfs2]<br \/>[&lt;ffffffffa0a5922e&gt;] ? ocfs2_lookup_lock_orphan_dir+0x6e\/0x1b0 [ocfs2]<br \/>[&lt;ffffffffa0a5922e&gt;] ? ocfs2_lookup_lock_orphan_dir+0x6e\/0x1b0 [ocfs2]<br \/>[&lt;ffffffffa0a5ba1a&gt;] ? ocfs2_prepare_orphan_dir+0x4a\/0x290 [ocfs2]<br \/>[&lt;ffffffffa0a5e621&gt;] ? ocfs2_unlink+0x6e1\/0xbb0 [ocfs2]<br \/>[&lt;ffffffff811bcfea&gt;] ? may_link+0xda\/0x170<br \/>[&lt;ffffffff81141c8e&gt;] ? vfs_unlink+0x9e\/0x100<br \/>[&lt;ffffffff81145881&gt;] ? do_unlinkat+0x1a1\/0x1d0<br \/>[&lt;ffffffff81147b00&gt;] ? vfs_readdir+0xa0\/0xe0<br \/>[&lt;ffffffff8116fedb&gt;] ? fsnotify_find_inode_mark+0x2b\/0x40<br \/>[&lt;ffffffff81170c24&gt;] ? dnotify_flush+0x54\/0x110<br \/>[&lt;ffffffff81133eec&gt;] ? filp_close+0x5c\/0x90<br \/>[&lt;ffffffff81496912&gt;] ? system_call_fastpath+0x16\/0x1b<\/p>\n<pre>CLASSROOM\n<br \/>\nWhile  waiting for  read()  or write()  to\/from  a file  <br \/>descriptor return, the process  will be put in aspecial  <br \/>kind of sleep, known as \"D\"  or \"Disk Sleep\". This  is <br \/>special, because  the process can not  be killed  or <br \/>interrupted  while in  such a  state.  A process waiting <br \/>for  a return from  ioctl()\nwould also  be put to  sleep in this manner.\n\n<\/pre>\n<p>RELATED SOURCE CODE EXPOSURE<\/p>\n<p>\/*<br \/>* Ok, the task did not get scheduled for more than 2 minutes,<br \/>* complain:<br \/>*\/<br \/>if (sysctl_hung_task_warnings) {<br \/>if (sysctl_hung_task_warnings &gt; 0)<br \/>sysctl_hung_task_warnings&#8211;;<br \/>pr_err(&#8220;INFO: task %s:%d blocked for more than %ld seconds.\\n&#8221;,<br \/>t-&gt;comm, t-&gt;pid, timeout);<br \/>pr_err(&#8221; %s %s %.*s%s\\n&#8221;,<br \/>print_tainted(), init_utsname()-&gt;release,<br \/>(int)strcspn(init_utsname()-&gt;version, &#8221; &#8220;),<br \/>init_utsname()-&gt;version,<br \/>LINUX_PACKAGE_ID);<br \/>pr_err(&#8220;\\&#8221;echo 0 &gt; \/proc\/sys\/kernel\/hung_task_timeout_secs\\&#8221;&#8221;<br \/>&#8221; disables this message.\\n&#8221;);<br \/>sched_show_task(t);<br \/>hung_task_show_lock = true;<br \/>}<br \/>[\/c]<\/p>\n<p>[c light=&#8221;true&#8221;]<br \/>\/*<br \/>* Process updating of timeout sysctl<br \/>*\/<br \/>int proc_dohung_task_timeout_secs(struct ctl_table * styletable, int write,<br \/>void __user *buffer,<br \/>size_t *lenp, loff_t *ppos)<br \/>{<br \/>int ret;<\/p>\n<p>ret = proc_doulongvec_minmax(table, write, buffer, lenp, ppos);<\/p>\n<p>if (ret || !write)<br \/>goto out;<\/p>\n<p>wake_up_process(watchdog_task);<\/p>\n<p>out:<br \/>return ret;<br \/>}<br \/>[\/c]<br \/>SOURCE CODE TAKEN FROM OFFICIAL LINUX KERNEL<\/p>\n<p>RELATED FROM RESEARCH PAPER<\/p>\n<pre style=\"font-size:100%\">\nKernel  data collection  tools. Several  monitoring  facilities are\nprovided by  the Linux  kernel, which have  been exploited  in this\nwork. In  particular, we use  KProbes which inserts  breakpoints in\narbitrary binary code locations in charge of triggering user-defined\nhandler  functions. Handlers  can  be used  to collect  information\nabout internal kernel  variables; subsequently, kernel execution is\nrestored. Kdump is a tool  for failure data collection based on the\nexecution of  a secondary kernel,  namely capture kernel,  which is\npreliminarily  loaded  into  a  reserved memory  region.  When  the\nprimary kernel fails, the capture  kernel is executed; then, it can\ncollect failure  data by reading  the main memory  state.  Built-in\nhang  detection mechanisms. Several  hang detection  mechanisms are\navailable in the Linux OS,  which can be enabled by recompiling the\nkernel.  In particular, the  following facilities  can be  used for\nhang  detection: Soft  lockup detection,  i.e., the  kernel detects\nwhether a  \"canary\" task  is not scheduled  within a  timeout; Hard\nlockup detection, i.e.,  if any CPU in the  system does not handles\nlocal    timer    interrupt   for    longer    than   a    timeout;\nSleep-inside-spinlock   checking,  i.e.,  assertions   that  verify\nwhether there are spinlocks  that have been acquired before calling\na  sleeping function  (i.e., a  function during  which  the current\nthread may block and be preempted by the scheduler); Checks on lock\nAPI  usage, that  is: missing  lock initialization,  release  of an\nalready freed lock, release of a  lock by a thread or CPU different\nfrom the lock holder, lock data structure corruption.\n\n \n\nsource : http:\/\/tinyurl.com\/7pt5j9a\n\nAssessment and Improvement of Hang Detection in the Linux Operating System\n2009 28th IEEE International Symposium on Reliable Distributed System\n<\/pre>\n<p>LINKS<br \/><a href=\"https:\/\/access.redhat.com\/solutions\/60572\">https:\/\/access.redhat.com\/solutions\/60572<\/a><br \/><a href=\"https:\/\/www.linuxquestions.org\/questions\/linux-software-2\/kernel-panic-echo-0-proc-sys-kernel-4175629199\/\">https:\/\/www.linuxquestions.org\/questions\/linux-software-2\/kernel-panic-echo-0-proc-sys-kernel-4175629199\/<\/a><br \/><a href=\"https:\/\/www.kernel.org\/doc\/Documentation\/sysctl\/kernel.txt\">https:\/\/www.kernel.org\/doc\/Documentation\/sysctl\/kernel.txt<\/a><br \/><a href=\"https:\/\/stackoverflow.com\/questions\/84882\/sudo-echo-something-etc-privilegedfile-doesnt-work-is-there-an-alterna\">https:\/\/stackoverflow.com\/questions\/84882\/sudo-echo-something-etc-privilegedfile-doesnt-work-is-there-an-alterna<\/a><br \/><a href=\"https:\/\/www.tldp.org\/LDP\/tlk\/kernel\/processes.html\">https:\/\/www.tldp.org\/LDP\/tlk\/kernel\/processes.html<\/a><br \/><a href=\"https:\/\/www.nico.schottelius.org\/blog\/reboot-linux-if-task-blocked-for-more-than-n-seconds\/\">https:\/\/www.nico.schottelius.org\/blog\/reboot-linux-if-task-blocked-for-more-than-n-seconds\/<\/a><br \/><a href=\"http:\/\/stackoverflow.com\/questions\/1475683\/linux-process-states\">http:\/\/stackoverflow.com\/questions\/1475683\/linux-process-states<\/a><\/p>\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>ABOUT hung_task_timeout_secs if a task(process) is hung then hung_task_timeout_secs value decides if the hung task needs no reboot or reboot after n seconds LINUX KERNEL RELATED PARAMETER$cat \/proc\/sys\/kernel\/hung_task_timeout_secs120$ $echo 0 | sudo tee &#8211;append \/proc\/sys\/kernel\/ hung_task_timeout_secs0$sudo cat \/proc\/sys\/kernel\/hung_task_timeout_secs0$ When a task in D state did not get scheduled for more thanthis value report a warning.This &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.trueangle.org\/index.php\/2013\/07\/08\/hung_task_timeout_secs-hung-task-timeout\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;hung_task_timeout_secs( topic related to linux kernel  hangup )&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[83],"tags":[848,913,914,1298],"_links":{"self":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/8650"}],"collection":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/comments?post=8650"}],"version-history":[{"count":0,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/8650\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/media?parent=8650"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/categories?post=8650"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/tags?post=8650"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}