[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-aio
Subject:    BUG REPORT: aio occasionally returns duplicate completion events in 4.4.0 kernel
From:       Geoffrey Blake <Geoffrey.Blake () arm ! com>
Date:       2016-09-08 20:05:41
Message-ID: CBAD7263-5851-4ECB-9EAD-077C76E01300 () arm ! com
[Download RAW message or body]

[Attachment #2 (text/plain)]

Hi,

I am working on an application that leverages the Linux aio facility and I am \
occasionally seeing duplicate completion events being returned from io_getevents().  \
My application uses the iocb.data field to store a pointer to an object that \
maintains state for a single IO operation, upon the first completion this object is \
valid and is subsequently freed.  My application crashes when a duplicate completion \
appears and tries to access the already freed object pointed to by the duplicate \
event.

To help with trying to catch when duplicates appear and work-around the issues I see, \
I have been running a patched kernel that adds an extra user_data field to aio_kiocb, \
and leverages reserved2 in iocb and res2 in io_event to track a sequence number for \
the object I store in iocb to detect a duplicate when the sequence numbers in the \
object do not match the one stored in the iocb.  So far this seems to be working, but \
the bug appears sporadically and is hard to reproduce.

Please let me know if there is anything I can do to help track down this bug (debug \
settings to activate), or if you want more information.

Thanks,
Geoffrey Blake

Staff Research Engineer
5707 Southwest Pkwy
Encino Trace
Bld 1 Suite 100, Austin TX 78735
T +(1) 512-329-7263

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and \
may also be privileged. If you are not the intended recipient, please notify the \
sender immediately and do not disclose the contents to any other person, use it for \
any purpose, or store or copy the information in any medium. Thank you.


[Attachment #3 (text/html)]

<html xmlns:o="urn:schemas-microsoft-com:office:office" \
xmlns:w="urn:schemas-microsoft-com:office:word" \
xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" \
xmlns="http://www.w3.org/TR/REC-html40"> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Title" content="">
<meta name="Keywords" content="">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:12.0pt;
	font-family:Calibri;}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:#0563C1;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-priority:99;
	color:#954F72;
	text-decoration:underline;}
span.EmailStyle17
	{mso-style-type:personal-compose;
	font-family:Calibri;
	color:windowtext;}
span.msoIns
	{mso-style-type:export-only;
	mso-style-name:"";
	text-decoration:underline;
	color:teal;}
.MsoChpDefault
	{mso-style-type:export-only;
	font-family:Calibri;}
@page WordSection1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
	{page:WordSection1;}
--></style>
</head>
<body bgcolor="white" lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt">Hi, <o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">I am working on an application \
that leverages the Linux aio facility and I am occasionally seeing duplicate \
completion events being returned from io_getevents().&nbsp; My application uses the \
iocb.data field to  store a pointer to an object that maintains state for a single IO \
operation, upon the first completion this object is valid and is subsequently \
freed.&nbsp; My application crashes when a duplicate completion appears and tries to \
access the already freed object  pointed to by the duplicate event.&nbsp; \
<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-size:11.0pt"><o:p>&nbsp;</o:p></span></p> <p class="MsoNormal"><span \
style="font-size:11.0pt">To help with trying to catch when duplicates appear and \
work-around the issues I see, I have been running a patched kernel that adds an extra \
user_data field to aio_kiocb, and leverages reserved2 in iocb and  res2 in io_event \
to track a sequence number for the object I store in iocb to detect a duplicate when \
the sequence numbers in the object do not match the one stored in the iocb.&nbsp; So \
far this seems to be working, but the bug appears sporadically and is hard  to \
reproduce.&nbsp; <o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-size:11.0pt"><o:p>&nbsp;</o:p></span></p> <p class="MsoNormal"><span \
style="font-size:11.0pt">Please let me know if there is anything I can do to help \
track down this bug (debug settings to activate), or if you want more \
information.&nbsp; <o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Thanks,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Geoffrey \
Blake<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-size:11.0pt"><o:p>&nbsp;</o:p></span></p> <p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Times New Roman&quot;;color:black">Staff \
Research Engineer<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Times New Roman&quot;;color:black">5707 \
Southwest Pkwy<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Times New Roman&quot;;color:black">Encino \
Trace<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Times New Roman&quot;;color:black">Bld 1 \
Suite 100, Austin TX 78735<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Times New Roman&quot;;color:black">T \
&#43;(1) 512-329-7263</span><span style="font-size:11.0pt"><o:p></o:p></span></p> <p \
class="MsoNormal"><span style="font-size:11.0pt"><o:p>&nbsp;</o:p></span></p> </div>
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and \
may also be privileged. If you are not the intended recipient, please notify the \
sender immediately and do not disclose the contents to any other person, use it for \
any purpose,  or store or copy the information in any medium. Thank you.
</body>
</html>


--
To unsubscribe, send a message with 'unsubscribe linux-aio' in
the body to majordomo@kvack.org.  For more info on Linux AIO,
see: http://www.kvack.org/aio/
Don't email: <a href=mailto:"aart@kvack.org">aart@kvack.org</a>

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic