[Mono-dev] Mono hangs on shutdown when /dev/ttySx ports were opened.
vargaz at gmail.com
Mon Sep 21 08:03:48 EDT 2009
This is very tricky problem. The runtime waits for all application threads
to finish before exiting in order to have a predictable shutdown and to be
compatible with ms.net. If we didn't
wait for them, and started to free up the runtime data structures, then one
of the running threads could access the freed data and crash/misbehave. You
might want to try to
close the file descriptor the thread is waiting on, that might break the
On Mon, Sep 21, 2009 at 10:07 AM, Christian Hoff <christian_hoff at gmx.net>wrote:
> Leszek Ciesielski wrote:
> > I am experiencing Mono hangup when my application should terminate.
> > The application opens multiple serial ports, but the bug has also
> > manifested when network sockets were hanging on reads or writes - it
> > seems to be related to a pending I/O operation, asynchronous
> > networking helps somewhat. Anyway, the managed code exits, Mono CPU
> > usage jumps to 100%, /proc/PID/status shows 4 threads and the
> > application never exits.
> Great to see that this issue is being actively worked on! I'm
> experiencing the same problem with my application which uses serial
> ports. The workaround I'm using so far is to set the read timeout to
> something about 500.
> As you have probably figured out already, the problem seems to be that
> Mono does not abort calls to native API. SerialPort.ReadByte pinvokes a
> blocking function in MonoPosixHelper.
> I'm not sure if native API calls should be aborted by the Mono runtime.
> Maybe the best solution here is to see how the func is implemented in
> MonoPosixHelper and see if we possibly avoid the blocking native call.
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Mono-devel-list