Bug 30868 - ObjectDisposedException in mono 4.0.1.28, but not mono 3.12.1
Summary: ObjectDisposedException in mono 4.0.1.28, but not mono 3.12.1
Status: VERIFIED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: System ()
Version: master
Hardware: PC Linux
: Normal normal
Target Milestone: Untriaged
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2015-06-06 12:28 UTC by xamarin
Modified: 2015-07-14 06:03 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Change gpgPath to where it is on the repro machine. Compile and run process_bug.exe. (3.69 KB, text/x-csharp)
2015-06-06 12:28 UTC, xamarin
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
VERIFIED FIXED

Description xamarin 2015-06-06 12:28:23 UTC
Created attachment 11492 [details]
Change gpgPath to where it is on the repro machine. Compile and run process_bug.exe.

Duplicati (backup software) used to run fine with mono 3.12.1 on ArchLinux. After updating mono to 4.0.1.28, Duplicati stopped working. I tracked this down to what appears to be a mono bug.

Duplicati uses gpg to encrypt content by starting a gpg process and writing to the process's stdin, then it copies bytes from process's stdout out to target encrypted file.

With mono 3.12.1, that encryption logic works fine with no exceptions thrown.
With mono 4.0.1.28, the same logic throws ObjectDisposedException.

The attached test program can be used to reproduce the issue. You just need to adjust the path to gpg.



Unhandled Exception:
System.ObjectDisposedException: The object was used after being disposed.
  at System.IO.FileStream.Flush () [0x00000] in <filename unknown>:0 
  at System.IO.StreamWriter.Flush (Boolean flushStream, Boolean flushEncoder) [0x00000] in <filename unknown>:0 
  at System.IO.StreamWriter.Dispose (Boolean disposing) [0x00000] in <filename unknown>:0 
  at System.IO.StreamWriter.Close () [0x00000] in <filename unknown>:0 
  at System.Diagnostics.Process.Dispose (Boolean disposing) [0x00000] in <filename unknown>:0 
  at System.ComponentModel.Component.Dispose () [0x00000] in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) System.ComponentModel.Component:Dispose ()
  at MonoBug.StreamWrapper.Dispose (Boolean disposing) [0x00000] in <filename unknown>:0 
  at System.IO.Stream.Close () [0x00000] in <filename unknown>:0 
  at System.IO.Stream.Dispose () [0x00000] in <filename unknown>:0 
  at MonoBug.ProcessBug.Main () [0x00000] in <filename unknown>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.ObjectDisposedException: The object was used after being disposed.
  at System.IO.FileStream.Flush () [0x00000] in <filename unknown>:0 
  at System.IO.StreamWriter.Flush (Boolean flushStream, Boolean flushEncoder) [0x00000] in <filename unknown>:0 
  at System.IO.StreamWriter.Dispose (Boolean disposing) [0x00000] in <filename unknown>:0 
  at System.IO.StreamWriter.Close () [0x00000] in <filename unknown>:0 
  at System.Diagnostics.Process.Dispose (Boolean disposing) [0x00000] in <filename unknown>:0 
  at System.ComponentModel.Component.Dispose () [0x00000] in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) System.ComponentModel.Component:Dispose ()
  at MonoBug.StreamWrapper.Dispose (Boolean disposing) [0x00000] in <filename unknown>:0 
  at System.IO.Stream.Close () [0x00000] in <filename unknown>:0 
  at System.IO.Stream.Dispose () [0x00000] in <filename unknown>:0 
  at MonoBug.ProcessBug.Main () [0x00000] in <filename unknown>:0
Comment 1 Marek Safar 2015-06-08 07:30:27 UTC
Fixed in master
Comment 2 Udham Singh 2015-06-30 09:43:46 UTC
I have checked this issue with latest master build MonoFramework-MDK-4.3.0.329.macos10.xamarin.x86_9b4901ba68c22a6e7cbb89788290e063c42cc27e and observed that this issue has been fixed with this build. Hence I am closing this issue.

Screencast : http://www.screencast.com/t/vWl3hKbl

To verify this issue, I have checked this with latest beta channel mono 4.0.2.5 (C5SR2) and able to reproduce this issue successfully.

Environment Info : 

=== Xamarin Studio ===

Version 5.9.4 (build 5)
Installation UUID: ce927b2a-2c07-44c5-b186-09cfdafba6dc
Runtime:
	Mono 4.3.0 (explicit/9b4901b)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 403000329

=== Apple Developer Tools ===

Xcode 6.2 (6776)
Build 6C131e

=== Build Information ===

Release ID: 509040005
Git revision: 8010a90f6e246b32364e3fb46ef2c9d1be9c9a2b
Build date: 2015-06-08 16:52:06-04
Xamarin addins: 7e93e9c3503f28770f23ce1b7eafd829919f18e8

=== Operating System ===

Mac OS X 10.9.5
Darwin Xamarin76s-Mac-mini.local 13.4.0 Darwin Kernel Version 13.4.0
    Sun Aug 17 19:50:11 PDT 2014
    root:xnu-2422.115.4~1/RELEASE_X86_64 x86_64
Comment 3 Udham Singh 2015-07-14 06:03:17 UTC
I have checked this issue with latest C5SR3 build MonoFramework-MDK-4.0.3.13.macos10.xamarin.x86_429313d4ad8e4dbb5f6640060f5cae589cd991b3 and observed that this issue has been fixed with this build also.

Screencast : http://www.screencast.com/t/2hOEBPBIS

Environment Info :

=== Xamarin Studio ===

Version 5.9.4 (build 5)
Installation UUID: ce927b2a-2c07-44c5-b186-09cfdafba6dc
Runtime:
	Mono 4.0.3 ((detached/429313d)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400030013

=== Apple Developer Tools ===

Xcode 6.2 (6776)
Build 6C131e

=== Build Information ===

Release ID: 509040005
Git revision: 8010a90f6e246b32364e3fb46ef2c9d1be9c9a2b
Build date: 2015-06-08 16:52:06-04
Xamarin addins: 7e93e9c3503f28770f23ce1b7eafd829919f18e8

=== Operating System ===

Mac OS X 10.9.5
Darwin Xamarin76s-Mac-mini.local 13.4.0 Darwin Kernel Version 13.4.0
    Sun Aug 17 19:50:11 PDT 2014
    root:xnu-2422.115.4~1/RELEASE_X86_64 x86_64