Bug 27774 - Fatal errors in window manager
Summary: Fatal errors in window manager
Status: RESOLVED INVALID
Alias: None
Product: Class Libraries
Classification: Mono
Component: Windows.Forms ()
Version: 3.12.0
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-03-09 09:54 UTC by ommymyca-6408
Modified: 2015-03-11 14:26 UTC (History)
2 users (show)

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

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:
Status:
RESOLVED INVALID

Description ommymyca-6408 2015-03-09 09:54:03 UTC
For my password manager project, I have created a small popup that appears whenever a lengthy operation takes place. Both to inform the user of said operation and also to prevent the user from interfering. This popup takes the form of a modal dialog that automatically closes whenever the operation is concluded.

The way I went about doing this is to simply create a separate thread for it.

Now, I keep running into issues while doing this in Linux (Ubuntu 14.10.1 to be precise); I keep experiencing fatal errors in the window manager. Fatal errors that I cannot implement any form of exception handling form as it seems to be outside the scope of whatever exception handling C# will allow me. I've also experienced SIGABRT fatal errors and such. I've coded some workarounds to close up most of these cases of fatal errors but I have not been completely successfull.

Leading me to conclude it is something I have no control over and it is simply a case of tardieness of some sort in either the window manager or in Mono.

For reference, see my implementation of a popup window: https://github.com/Altorffer/Invium/blob/master/Invium/Popup.cs
Comment 1 Mikayla Hutchinson [MSFT] 2015-03-09 15:54:05 UTC
You cannot access the UI from arbitrary threads.
Comment 2 ommymyca-6408 2015-03-11 06:09:05 UTC
I can, just fine. The code works... most of the time. Let me pose this to you -- if the code was flawed in some way or another, it should not compile or at the very least, should not work as expected. It does. It just randomly causes a fatal error in the window manager. Randomly. Had it been consistently, I might have agree the code was flawed.

Anyhow, given the fact the issue was closed as invalid, I suppose I'll have to come up with more workarounds. For the record, do some research, you will find there are plenty of issues still with all of the various window managers available in Linux. And with Mono itself. Point being -- don't dismiss this so easily, it's kind of insulting.

Leave this closed however, I do not have the time or the patience at this time.
Comment 3 ommymyca-6408 2015-03-11 06:56:22 UTC
Just for the record, an example of what I'm experiencing. 'Condition 'domain' not met' is just one example of random fatal errors in Mono. I've seen these before, completely random errors, totally unrelated to my code. Sometimes even network related errors. In an application that does not contain a single sliver of network code. Yeah, definitely my code that's flawed. ;)

Sorry, bad day at the office.

Anyhow... here's the error:

* Assertion at mini-exceptions.c:834, condition `domain' not met

Stacktrace:

  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) System.Environment.Exit (int) <0xffffffff>
  at Invium.Invium.InviumExit () <0x000a3>
  at Invium.Invium.Main (string[]) <0x0058b>
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <0xffffffff>

Native stacktrace:

	mono() [0x4accac]
	/lib/x86_64-linux-gnu/libpthread.so.0(+0xf830) [0x7f1e8d8c9830]
	/lib/x86_64-linux-gnu/libc.so.6(gsignal+0x37) [0x7f1e8d520947]
	/lib/x86_64-linux-gnu/libc.so.6(abort+0x148) [0x7f1e8d522588]
	mono() [0x6232f9]
	mono() [0x623507]
	mono() [0x623656]
	mono() [0x4abac2]
	mono() [0x4abb1c]
	mono() [0x57e6b1]
	mono() [0x5827ab]
	mono() [0x582c5d]
	mono() [0x531d26]
	[0x404a2cb2]

Debug info from gdb:

Could not attach to process.  If your uid matches the uid of the target
process, check the setting of /proc/sys/kernel/yama/ptrace_scope, or try
again as the root user.  For more details, see /etc/sysctl.d/10-ptrace.conf
ptrace: Operation not permitted.
No threads.

=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

Aborted
Comment 4 Mikayla Hutchinson [MSFT] 2015-03-11 14:26:52 UTC
The reason I closed it as invalid was because your sample is clearly accessing the UI code from a background thread.

This will not work reliably since System.Windows.Forms is not threadsafe (and practically no UI toolkit in any language or OS is threadsafe).

About the best we could do to improve this case would be to add assertions to check the thread ID so that it would reliably fail, but this would have a non-negligible performance impact.

If you have other issues, please file them separately with test cases.