Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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.
I wrote a short application to probe a character device to determine if it is a modem or not. Calling this application from the console works fine.
Calling the application from the PROGRAM= stanza of a udev rule causes the application to never terminate on certain systems only. I cannot determine what environmental factors cause the failure on which systems.
To verify that it isn't related to the application that is run, I wrote a single line Hello World application that also fails.
Attaching gdb to the non-terminated, frozen process, shows that mono is in sem_wait, called a few call stack levels down from mono_domain_finalize. gdb has no information about the 5 functions between sem_wait and mono_domain_finalize.
To reproduce (on a system where this occurs), add a udev rule to /etc/udev/rules.d called test.rules, containing:
Then run: udevadm trigger
This will attempt to run the program for every tty device in the system.
Some additional information: using udevadm test to call the application succeeds even though it is called from the udev rule; only calling the application from the udev daemon (via trigger, or a device plug-in) fails. Additionally, to eliminate some sort of binfmt_misc failure, you can change PROGRAM= to call a shell script that calls the mono binary, passing the assembly.exe file as an argument. This still fails.
Created attachment 923 [details]
Screenshot of gdb on a frozen thread, as called by udev
Created attachment 936 [details]
Demo binary that fails
Created attachment 937 [details]
Source code for demo binary that fails
Quick update -- this has been tried on both 2.10.2 and 2.10.5. I have an Ubuntu system where this works fine (on both versions) and a Gentoo system where this always fails (also both versions).
Created attachment 938 [details]
strace of mono running the test binary, from the console
Created attachment 939 [details]
strace of mono running the test binary, from a udev rule
Using the env -i command, I've eliminated environment variables as a cause --
env -i plus mono inside the udev rule works on one system and fails on the other, just as if we didn't use env -i
env -i plus mono on the console works on both systems
Created attachment 940 [details]
strace -f of mono running the test binary, from a udev rule
Mono users on Gentoo run into lots of strange bugs not reproducible elsewhere.
Gentto problems should be troubleshoot by upstream for a reliable test case.