{"id":69,"date":"2009-03-25T13:21:26","date_gmt":"2009-03-25T17:21:26","guid":{"rendered":"http:\/\/www.cs.toronto.edu\/~jhancock\/wlog\/?p=69"},"modified":"2009-03-25T13:21:26","modified_gmt":"2009-03-25T17:21:26","slug":"file-locking-and-imap-writes","status":"publish","type":"post","link":"http:\/\/www.cs.toronto.edu\/~jhancock\/wlog\/?p=69","title":{"rendered":"File locking and IMAP writes"},"content":{"rendered":"<p>Occasionally in the lab, users have had problems accessing or copying email from their inbox.\u00a0 The cause is often kernel file locking.\u00a0 Here are the two situations I&#8217;ve seen the problem occur in:<\/p>\n<ol>\n<li>User has a problem with Pine, and it crashes or is killed in a way that doesn&#8217;t release the kernel lock on the file (kill -9).<\/li>\n<li>An offline operation to move a message (\u201cUID COPY\u201d) from one IMAP folder to another fails in some way, saying &#8220;Timeout while waiting for lock&#8221;.<\/li>\n<\/ol>\n<p>For us, the first case is much more common.\u00a0 Yesterday was the first time I&#8217;ve seen something like #2.\u00a0 A user was unable to copy a message from his inbox to another imap folder in Apple Mail.\u00a0 Our server is running dovecot, so I checked and saw that there was a .lock file being created and that the imap process moving the email was frozen.<\/p>\n<p>I did the following:<\/p>\n<ul>\n<li>stopped the imap process and closed the client mail app<\/li>\n<li><strong>ls -li <\/strong><em><strong>imapfolder<\/strong> <\/em>to get the inode number of the file (we use mbox format so all imap folders are files)<\/li>\n<li><strong>cat \/proc\/locks<\/strong> to check and see if there was a kernel lock on the file<\/li>\n<li><strong>mv<em> imapfolder imapfolder_tmp; <\/em>cp<em> imapfolder_tmp imapfolder<\/em><\/strong> This creates a new file with a new inode number that can be written.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Occasionally in the lab, users have had problems accessing or copying email from their inbox.\u00a0 The cause is often kernel file locking.\u00a0 Here are the two situations I&#8217;ve seen the problem occur in: User has a problem with Pine, and it crashes or is killed in a way that doesn&#8217;t release the kernel lock on [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[28,29],"_links":{"self":[{"href":"http:\/\/www.cs.toronto.edu\/~jhancock\/wlog\/index.php?rest_route=\/wp\/v2\/posts\/69"}],"collection":[{"href":"http:\/\/www.cs.toronto.edu\/~jhancock\/wlog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.cs.toronto.edu\/~jhancock\/wlog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.cs.toronto.edu\/~jhancock\/wlog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.cs.toronto.edu\/~jhancock\/wlog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=69"}],"version-history":[{"count":2,"href":"http:\/\/www.cs.toronto.edu\/~jhancock\/wlog\/index.php?rest_route=\/wp\/v2\/posts\/69\/revisions"}],"predecessor-version":[{"id":71,"href":"http:\/\/www.cs.toronto.edu\/~jhancock\/wlog\/index.php?rest_route=\/wp\/v2\/posts\/69\/revisions\/71"}],"wp:attachment":[{"href":"http:\/\/www.cs.toronto.edu\/~jhancock\/wlog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=69"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.cs.toronto.edu\/~jhancock\/wlog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=69"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.cs.toronto.edu\/~jhancock\/wlog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=69"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}