Bug 26983 - Console properties might deadlock for background properties
Summary: Console properties might deadlock for background properties
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: mscorlib (show other bugs)
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-02-12 07:54 UTC by Rolf Bjarne Kvinge [MSFT]
Modified: 2017-03-31 11:22 UTC (History)
2 users (show)

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


Attachments

Description Rolf Bjarne Kvinge [MSFT] 2015-02-12 07:54:07 UTC
Test case:

class C {
	static void Main ()
	{
		System.Console.WriteLine (System.Console.WindowWidth);
	}
}

To repro (might have to do this for a while until it deadlocks, probably best in a loop):
    mono test.cs &

Result: process doesn't terminate

lldb shows this:

rolf@Rolfs-Mac-Pro.local ~/test > mono test3.exe &
[2] 13006
rolf@Rolfs-Mac-Pro.local ~/test > lldb -p 13006
(lldb) process attach --pid 13006
warning: (i386) /Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/4.5/mscorlib.dll.dylib empty dSYM file detected, dSYM was created with an executable with no debug info.
Process 13006 stopped
Executable module set to "/usr/bin/mono".
Architecture set to: i386-apple-macosx.
(lldb) bt
* thread #1: tid = 0x38c2e9, 0x981c2232 libsystem_kernel.dylib`__ioctl + 10, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
  * frame #0: 0x981c2232 libsystem_kernel.dylib`__ioctl + 10
    frame #1: 0x95af53c2 libsystem_c.dylib`tcsetattr + 181
    frame #2: 0x0020c025 mono`ves_icall_System_ConsoleDriver_TtySetup + 421
    frame #3: 0x005cd428
    frame #4: 0x017b1285 mscorlib.dll.dylib`System_TermInfoDriver_Init + 741
    frame #5: 0x017b287a mscorlib.dll.dylib`System_TermInfoDriver_get_WindowWidth + 42
    frame #6: 0x0175d12e mscorlib.dll.dylib`System_ConsoleDriver_get_WindowWidth + 46
    frame #7: 0x0175bdf8 mscorlib.dll.dylib`System_Console_get_WindowWidth + 24
    frame #8: 0x005cbdec
    frame #9: 0x005cbe8e
    frame #10: 0x0010d68f mono`mono_jit_runtime_invoke + 751
    frame #11: 0x002cc7ff mono`mono_runtime_invoke + 127
    frame #12: 0x002d2641 mono`mono_runtime_exec_main + 401
    frame #13: 0x002d23ea mono`mono_runtime_run_main + 682
    frame #14: 0x00182dbd mono`mono_jit_exec + 93
    frame #15: 0x00185090 mono`mono_main + 7904
    frame #16: 0x000fffa0 mono`main + 768
    frame #17: 0x000ffc95 mono`start + 53
(lldb) monobt
frame #0: 0x981c2232 libsystem_kernel.dylib`__ioctl + 10
frame #1: 0x95af53c2 libsystem_c.dylib`tcsetattr + 181
frame #2: 0x0020c025 mono`ves_icall_System_ConsoleDriver_TtySetup + 421
frame #3: 0x005cd428 (wrapper managed-to-native) System.ConsoleDriver:TtySetup (string,string,byte[]&,int*&) + 0x50 (0x5cd3d8 0x5cd462) [0x78e318d0 - test3.exe]
frame #4: 0x017b1285 mscorlib.dll.dylib`System_TermInfoDriver_Init + 741
frame #5: 0x017b287a mscorlib.dll.dylib`System_TermInfoDriver_get_WindowWidth + 42
frame #6: 0x0175d12e mscorlib.dll.dylib`System_ConsoleDriver_get_WindowWidth + 46
frame #7: 0x0175bdf8 mscorlib.dll.dylib`System_Console_get_WindowWidth + 24
frame #8: 0x005cbdec C:Main () + 0xc (0x5cbde0 0x5cbdf6) [0x78e318d0 - test3.exe]
frame #9: 0x005cbe8e (wrapper runtime-invoke) object:runtime_invoke_void (object,intptr,intptr,intptr) + 0x7e (0x5cbe10 0x5cbe9a) [0x78e318d0 - test3.exe]
frame #10: 0x0010d68f mono`mono_jit_runtime_invoke + 751
frame #11: 0x002cc7ff mono`mono_runtime_invoke + 127
frame #12: 0x002d2641 mono`mono_runtime_exec_main + 401
frame #13: 0x002d23ea mono`mono_runtime_run_main + 682
frame #14: 0x00182dbd mono`mono_jit_exec + 93
frame #15: 0x00185090 mono`mono_main + 7904
frame #16: 0x000fffa0 mono`main + 768
frame #17: 0x000ffc95 mono`start + 53
(lldb)
Comment 1 Rolf Bjarne Kvinge [MSFT] 2015-04-28 10:27:50 UTC
This still happens with Mono 4.0.

> $ mono --version
> Mono JIT compiler version 4.0.0 ((detached/d136b79 Mon Apr 13 14:40:59 EDT 2015)
> Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
> 	TLS:           normal
> 	SIGSEGV:       altstack
> 	Notification:  kqueue
> 	Architecture:  x86
> 	Disabled:      none
> 	Misc:          softdebug 
> 	LLVM:          yes(3.6.0svn-mono-(detached/a173357)
> 	GC:            sgen
> $ lldb -p 92694
> (lldb) process attach --pid 92694
> bt
> warning: (i386) /Library/Frameworks/Mono.framework/Versions/4.0.0/lib/libglib-2.0.0.dylib empty dSYM file detected, dSYM was created with an executable with no debug info.
> warning: (i386) /Library/Frameworks/Mono.framework/Versions/4.0.0/lib/libintl.8.dylib empty dSYM file detected, dSYM was created with an executable with no debug info.
> [...]
> (lldb) monobt
> frame #0: 0x9980fdd6 libsystem_kernel.dylib`__read + 10
> frame #1: 0x05a38c40 libmonosgen-2.0.dylib`console_read(handle=<unavailable>, buffer=0x0681f950, numbytes=1024, bytesread=<unavailable>, overlapped=0x00000000) + 96 at io.c:1078
> frame #2: 0x0593d916 libmonosgen-2.0.dylib`ves_icall_System_IO_MonoIO_Read(handle=0x00000000, dest=<unavailable>, dest_offset=<unavailable>, count=1024, error=<unavailable>) + 150 at file-io.c:803
> frame #3: 0x077eedb0 (wrapper managed-to-native) System.IO.MonoIO:Read (intptr,byte[],int,int,System.IO.MonoIOError&) + 0x58 (0x77eed58 0x77eee00) [0x2301930 - mdtool.exe]
> frame #4: 0x077eed14 System.IO.MonoIO:Read (System.Runtime.InteropServices.SafeHandle,byte[],int,int,System.IO.MonoIOError&) + 0x54 (0x77eecc0 0x77eed49) [0x2301930 - mdtool.exe]
> frame #5: 0x077eec40 System.IO.FileStream:ReadData (System.Runtime.InteropServices.SafeHandle,byte[],int,int) + 0x38 (0x77eec08 0x77eecb0) [0x2301930 - mdtool.exe]
> frame #6: 0x077ee5b8 System.IO.FileStream:ReadInternal (byte[],int,int) + 0x80 (0x77ee538 0x77ee720) [0x2301930 - mdtool.exe]
> frame #7: 0x077ee390 System.IO.FileStream:Read (byte[],int,int) + 0xd0 (0x77ee2c0 0x77ee4ec) [0x2301930 - mdtool.exe]
> frame #8: 0x086c71a9 System.IO.StreamReader:ReadBuffer () + 0x2e9 (0x86c6ec0 0x86c737f) [0x2301930 - mdtool.exe]
> frame #9: 0x086c8116 System.IO.StreamReader:Read () + 0x5e (0x86c80b8 0x86c8262) [0x2301930 - mdtool.exe]
> frame #10: 0x0bcc7ccf System.TermInfoDriver:GetCursorPosition () + 0x87 (0xbcc7c48 0xbcc7e09) [0x2301930 - mdtool.exe]
> frame #11: 0x0bcc75c4 System.TermInfoDriver:Init () + 0x6e4 (0xbcc6ee0 0xbcc7631) [0x2301930 - mdtool.exe]
> frame #12: 0x0bcc6eb0 System.TermInfoDriver:get_WindowWidth () + 0x20 (0xbcc6e90 0xbcc6ec4) [0x2301930 - mdtool.exe]
> frame #13: 0x0bcc6e71 System.ConsoleDriver:get_WindowWidth () + 0x19 (0xbcc6e58 0xbcc6e73) [0x2301930 - mdtool.exe]
> frame #14: 0x0bcc6e44 System.Console:get_WindowWidth () + 0xc (0xbcc6e38 0xbcc6e46) [0x2301930 - mdtool.exe]
> frame #15: 0x0bcc6a80 MonoDevelop.Core.ProgressMonitoring.ConsoleProgressMonitor:.ctor () + 0x30 (0xbcc6a50 0xbcc6acb) [0x2301930 - mdtool.exe]
> frame #16: 0x0a54a958 MonoDevelop.Projects.BuildTool:Run (string[]) + 0x290 (0xa54a6c8 0xa54b03c) [0x2301930 - mdtool.exe]
> frame #17: 0x026a6462 MonoDevelopProcessHost:Main (string[]) + 0x56a (0x26a5ef8 0x26a658f) [0x2301930 - mdtool.exe]
> frame #18: 0x026a676f (wrapper runtime-invoke) <Module>:runtime_invoke_int_object (object,intptr,intptr,intptr) + 0xc7 (0x26a66a8 0x26a67b4) [0x2301930 - mdtool.exe]
> frame #19: 0x0580f00f libmonosgen-2.0.dylib`mono_jit_runtime_invoke(method=<unavailable>, obj=<unavailable>, params=<unavailable>, exc=<unavailable>) + 751 at mini.c:6669
> frame #20: 0x059d122f libmonosgen-2.0.dylib`mono_runtime_invoke(method=0x078012c8, obj=0x00000000, params=<unavailable>, exc=<unavailable>) + 127 at object.c:2862
> frame #21: 0x059d72b1 libmonosgen-2.0.dylib`mono_runtime_exec_main(method=0x078012c8, args=<unavailable>, exc=0x00000000) + 401 at object.c:4119
> frame #22: 0x059d7054 libmonosgen-2.0.dylib`mono_runtime_run_main(method=0x078012c8, argc=<unavailable>, argv=<unavailable>, exc=<unavailable>) + 660 at object.c:3745
> frame #23: 0x058899ad libmonosgen-2.0.dylib`mono_jit_exec(domain=0x02301930, assembly=0x021019e0, argc=<unavailable>, argv=<unavailable>) + 93 at driver.c:1008
> frame #24: 0x0588bc80 libmonosgen-2.0.dylib`mono_main [inlined] main_thread_handler + 7904 at driver.c:1067
> frame #25: 0x0588bc42 libmonosgen-2.0.dylib`mono_main(argc=<unavailable>, argv=<unavailable>) + 7842 at driver.c:2067
> frame #26: 0x0000252b mdtool`main + 2411
> frame #27: 0x00001bb5 mdtool`start + 53
Comment 2 Rolf Bjarne Kvinge [MSFT] 2017-03-31 11:14:54 UTC
Mono 5.0:

"<unnamed thread>"  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) System.IO.MonoIO.Read (intptr,byte[],int,int,System.IO.MonoIOError&) <0x00012>
  at System.IO.MonoIO.Read (System.Runtime.InteropServices.SafeHandle,byte[],int,int,System.IO.MonoIOError&) [0x00010] in <04300341516a482b9708b764d58af7ca>:0
  at System.IO.FileStream.ReadData (System.Runtime.InteropServices.SafeHandle,byte[],int,int) [0x00002] in <04300341516a482b9708b764d58af7ca>:0
  at System.IO.FileStream.ReadInternal (byte[],int,int) [0x00026] in <04300341516a482b9708b764d58af7ca>:0
  at System.IO.FileStream.Read (byte[],int,int) [0x000a1] in <04300341516a482b9708b764d58af7ca>:0
  at System.IO.StreamReader.ReadBuffer () [0x000b3] in <04300341516a482b9708b764d58af7ca>:0
  at System.IO.StreamReader.Read () [0x00021] in <04300341516a482b9708b764d58af7ca>:0
  at System.TermInfoDriver.GetCursorPosition () [0x00048] in <04300341516a482b9708b764d58af7ca>:0
  at System.TermInfoDriver.Init () [0x002dc] in <04300341516a482b9708b764d58af7ca>:0
  at System.TermInfoDriver.set_ForegroundColor (System.ConsoleColor) [0x00008] in <04300341516a482b9708b764d58af7ca>:0
  at System.ConsoleDriver.set_ForegroundColor (System.ConsoleColor) [0x00019] in <04300341516a482b9708b764d58af7ca>:0
  at System.Console.set_ForegroundColor (System.ConsoleColor) [0x00000] in <04300341516a482b9708b764d58af7ca>:0
  at Mono.XBuild.CommandLine.MainClass.ShowDeprecationNotice () [0x00000] in <27924e7bb62246f1b7e4257e58389664>:0
  at Mono.XBuild.CommandLine.MainClass.Execute () [0x0004d] in <27924e7bb62246f1b7e4257e58389664>:0
  at Mono.XBuild.CommandLine.MainClass.Main (string[]) [0x00005] in <27924e7bb62246f1b7e4257e58389664>:0
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) [0x0004e] in <27924e7bb62246f1b7e4257e58389664>:0

(lldb) monobt
frame #0: 0xa17d6d06 libsystem_kernel.dylib`__read + 10
frame #1: 0x00229733 mono`console_read(handle=<unavailable>, buffer=0x04016e60, numbytes=<unavailable>, bytesread=<unavailable>) at w32file-unix.c:1815 [opt]
frame #2: 0x00259ead mono`ves_icall_System_IO_MonoIO_Read(handle=<unavailable>, dest=<unavailable>, dest_offset=<unavailable>, count=1024, error=<unavailable>) at w32file.c:880 [opt]
frame #3: 0x0058ea28 (wrapper managed-to-native) System.IO.MonoIO:Read (intptr,byte[],int,int,System.IO.MonoIOError&) {0x7e2600b8} + 0x58 (0x58e9d0 0x58ea78) [0x7c241720 - xbuild.exe]
frame #4: 0x014e3bbd mscorlib.dll.dylib`System_IO_MonoIO_Read_System_Runtime_InteropServices_SafeHandle_byte___int_int_System_IO_MonoIOError_ + 93
frame #5: 0x014e28b2 mscorlib.dll.dylib`System_IO_FileStream_ReadData_System_Runtime_InteropServices_SafeHandle_byte___int_int + 66
frame #6: 0x014e0b16 mscorlib.dll.dylib`System_IO_FileStream_ReadInternal_byte___int_int + 134
frame #7: 0x014e0943 mscorlib.dll.dylib`System_IO_FileStream_Read_byte___int_int + 243
frame #8: 0x01502a72 mscorlib.dll.dylib`System_IO_StreamReader_ReadBuffer + 290
frame #9: 0x01501e65 mscorlib.dll.dylib`System_IO_StreamReader_Read + 101
frame #10: 0x01210cc5 mscorlib.dll.dylib`System_TermInfoDriver_GetCursorPosition + 149
frame #11: 0x01210568 mscorlib.dll.dylib`System_TermInfoDriver_Init + 1464
frame #12: 0x01210bfa mscorlib.dll.dylib`System_TermInfoDriver_set_ForegroundColor_System_ConsoleColor + 42
frame #13: 0x011f6fdd mscorlib.dll.dylib`System_ConsoleDriver_set_ForegroundColor_System_ConsoleColor + 77
frame #14: 0x011f5bfe mscorlib.dll.dylib`System_Console_set_ForegroundColor_System_ConsoleColor + 30
frame #15: 0x0058fe7c Mono.XBuild.CommandLine.MainClass:ShowDeprecationNotice () {0x7ca72588} + 0x14 (0x58fe68 0x58fea2) [0x7c241720 - xbuild.exe]
frame #16: 0x0058b664 Mono.XBuild.CommandLine.MainClass:Execute () {0x7da97798} + 0xf4 (0x58b570 0x58c24f) [0x7c241720 - xbuild.exe]
frame #17: 0x0058908c Mono.XBuild.CommandLine.MainClass:Main (string[]) {0x7ca5a2b8} + 0x54 (0x589038 0x58908e) [0x7c241720 - xbuild.exe]
frame #18: 0x0058913f (wrapper runtime-invoke) <Module>:runtime_invoke_void_object (object,intptr,intptr,intptr) {0x7da978b0} + 0x97 (0x5890a8 0x589164) [0x7c241720 - xbuild.exe]
frame #19: 0x000f6135 mono`mono_jit_runtime_invoke(method=<unavailable>, obj=<unavailable>, params=<unavailable>, error=<unavailable>) at mini-runtime.c:2530 [opt]
frame #20: 0x0030fc10 mono`do_runtime_invoke(method=<unavailable>, obj=<unavailable>, params=<unavailable>, exc=<unavailable>, error=<unavailable>) at object.c:2860 [opt]
frame #21: 0x003134c7 mono`do_exec_main_checked [inlined] mono_runtime_invoke_checked(method=0x7ca5a2b8, params=0x040002a0, error=0x0030fbc2) at object.c:3018 [opt]
frame #22: 0x0031346e mono`do_exec_main_checked(method=<unavailable>, args=<unavailable>, error=0x0030fbc2) at object.c:4680 [opt]
frame #23: 0x00312199 mono`mono_runtime_run_main_checked [inlined] mono_runtime_exec_main_checked(method=0x7ca5a2b8, args=0x040002a0, error=0xbff1d2c8) at object.c:4781 [opt]
frame #24: 0x00312179 mono`mono_runtime_run_main_checked(method=0x7ca5a2b8, argc=5, argv=0xbff1d6dc, error=0xbff1d2c8) at object.c:4230 [opt]
frame #25: 0x001713f7 mono`mono_jit_exec(domain=0x7c241720, assembly=0x7c440ef0, argc=<unavailable>, argv=<unavailable>) at driver.g.c:1037 [opt]
frame #26: 0x00173d62 mono`mono_main [inlined] main_thread_handler at driver.g.c:1106 [opt]
frame #27: 0x00173d24 mono`mono_main(argc=<unavailable>, argv=<unavailable>) at driver.g.c:2215 [opt]
frame #28: 0x000e54fb mono`main [inlined] mono_main_with_options(argc=6, argc=6, argc=6, argv=0xbff1d6d8, argv=0xbff1d6d8, argv=0xbff1d6d8) at main.c:45 [opt]
frame #29: 0x000e54da mono`main(argc=6, argv=0xbff1d6d8) at main.c:338 [opt]
frame #30: 0x000e4d15 mono`start + 53
Comment 3 Rolf Bjarne Kvinge [MSFT] 2017-03-31 11:22:27 UTC
This just happened too:

Unhandled Exception:
System.IO.IOException: Invalid handle to path "/work/maccore/master/xamarin-macios/external/fsharp/src/fsharp/FSharp.Core/[Unknown]"
  at System.IO.FileStream.ReadData (System.Runtime.InteropServices.SafeHandle safeHandle, System.Byte[] buf, System.Int32 offset, System.Int32 count) [0x0002d] in <04300341516a482b9708b764d58af7ca>:0 
  at System.IO.FileStream.ReadInternal (System.Byte[] dest, System.Int32 offset, System.Int32 count) [0x00026] in <04300341516a482b9708b764d58af7ca>:0 
  at System.IO.FileStream.Read (System.Byte[] array, System.Int32 offset, System.Int32 count) [0x000a1] in <04300341516a482b9708b764d58af7ca>:0 
  at System.IO.StreamReader.ReadBuffer () [0x000b3] in <04300341516a482b9708b764d58af7ca>:0 
  at System.IO.StreamReader.Read () [0x00021] in <04300341516a482b9708b764d58af7ca>:0 
  at System.TermInfoDriver.GetCursorPosition () [0x00048] in <04300341516a482b9708b764d58af7ca>:0 
  at System.TermInfoDriver.Init () [0x002dc] in <04300341516a482b9708b764d58af7ca>:0 
  at System.TermInfoDriver.set_ForegroundColor (System.ConsoleColor value) [0x00008] in <04300341516a482b9708b764d58af7ca>:0 
  at System.ConsoleDriver.set_ForegroundColor (System.ConsoleColor value) [0x00019] in <04300341516a482b9708b764d58af7ca>:0 
  at System.Console.set_ForegroundColor (System.ConsoleColor value) [0x00000] in <04300341516a482b9708b764d58af7ca>:0 
  at Mono.XBuild.CommandLine.MainClass.ShowDeprecationNotice () [0x00000] in <27924e7bb62246f1b7e4257e58389664>:0 
  at Mono.XBuild.CommandLine.MainClass.Execute () [0x0004d] in <27924e7bb62246f1b7e4257e58389664>:0 
  at Mono.XBuild.CommandLine.MainClass.Main (System.String[] args) [0x00005] in <27924e7bb62246f1b7e4257e58389664>:0

Note You need to log in before you can comment on or make changes to this bug.