Bug 23548 - Syscall poll with timeout hangs ad infinitum
Summary: Syscall poll with timeout hangs ad infinitum
Alias: None
Product: Class Libraries
Classification: Mono
Component: Mono.POSIX ()
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2014-10-02 08:35 UTC by mholenko
Modified: 2014-12-01 02:37 UTC (History)
3 users (show)

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

Solution required to reproduce the bug. (2.62 MB, application/x-tar)
2014-10-02 08:35 UTC, mholenko

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:

Description mholenko 2014-10-02 08:35:12 UTC
Created attachment 8283 [details]
Solution required to reproduce the bug.

    Calling Syscall.poll with 500ms timeout on "/dev/ptmx" descriptor never ends.

    This is not straightforward: problem is reproducible only under debugger (tested in monodevelop debug mode)
    in XWT application with nested Application.Invoke calls. Syscall.poll works fine until call to Application.Exit method.

    I couldn't extract simpler example, but I attach solution project.

    The attached code works fine on non pseudo-terminal files.
    The attached code works fine without debug.

Steps to Reproduce:

    1) Run attached solution in debug mode in monodevelop (tested on MD 5.7)
    2) Wait for "After app run" text on console
    3) Pause Execution in MD
    4) Go to Threads list
    5) Select "Testing thread"
    6) Observe the hang

Actual Results: What the application did after performing the above steps.

    Application prints:
    Sleeping 5s...
    After app exit
    After app run

    and does not end.

Expected Results: What the application should have done, were the bug not present.

    Application should print:
    Sleeping 5s...
    After app exit
    After app run

    And finish.

Additional Information:

    Attached code works fine (even in MD, debug mode) on mono 3.4.0 (d511ef), but fails on mono 3.10.1 (fc7c8e9).
Comment 1 mholenko 2014-12-01 02:37:58 UTC
On the current master (33861cf32b8df64ed2d01d2581a7982a096485c6) this bug no occurs.