[Mono-bugs] [Bug 579146] Disk Full Error doesn't release handle on files

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Feb 11 11:09:30 EST 2010


http://bugzilla.novell.com/show_bug.cgi?id=579146

http://bugzilla.novell.com/show_bug.cgi?id=579146#c1


--- Comment #1 from Hubert FONGARNAND <informatique.internet at fiducial.fr> 2010-02-11 16:09:30 UTC ---
In fact... when mono close the file, it tries to flush the data to the disk

if it fails... the handle is never released (BAD)

protected virtual void Dispose (bool disposing)

        {
            if (handle != MonoIO.InvalidHandle) {
                FlushBuffer ();

                if (owner) {
                    MonoIOError error;

                    MonoIO.Close (handle, out error);
                    if (error != MonoIOError.ERROR_SUCCESS) {
                        // don't leak the path information for isolated storage
                        throw MonoIO.GetException (GetSecureFileName (name),
error);
                    }

                    handle = MonoIO.InvalidHandle;
                }
            }

            canseek = false;
            access = 0;
            if (disposing) {
                buf = null;
            }
            if (disposing)
                GC.SuppressFinalize (this);
        }


you definitely should add a try/finally block around FlushBuffer (); and Close
the handle in the finally block

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list