[Mono-list] Dealock on creating a stream after threading

Eric Morgan eric at rengeo.com
Wed Dec 27 18:43:39 EST 2006


I have an interesting problem involving my .NET application running under Mono deadlocking when trying any file IO after threading.  It's very consistant, and happens when trying to create a StreamWriter, BinaryWriter, XmlDocument.save() or any kind of stream creation.  I have a main thread, which then calls a worker thread.  I have a few locking statements and I've double checked all that to make sure that deadlock isn't happening due to a poor locking mechanism.  If I comment out the immediate lines that write out a file, it finishes OK, but then will deadlock on the very next stream attempt.  It does not deadlock (using the exact same writing function) on any IO *before* the threads are started up.

The application is *very* large and the source code is confidential.  I'm wondering if other people have run into similar issues and if there's any advice that I can get to try to avoid this deadlocking issue.  I've read numerous articles about how to use threading in .NET, but I could be doing something wrong.

However, the code executes just fine under .NET, *and* Mono 1.2.2 for windows.  It only deadlocks under 1.2.2 and later on Mono.  I have both the standalone 1.2.2 Mono version and the latest svn built on my linux box running suse 10.1.  Deadlocks on both, so I'm thinking it could just be an error in my specific linux installation or configuration, since the windows version of Mono works.

Any help is greatly appreciated.  If I can, I'll try to come up with a test case in the next day or so, but I thought I'd toss a message out here first.


Eric Morgan
Renegade Geophysics 


More information about the Mono-list mailing list