[Mono-dev] Mono hangs on shutdown when /dev/ttySx ports were opened.
christian_hoff at gmx.net
Mon Sep 21 04:07:45 EDT 2009
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.
More information about the Mono-devel-list