Bug 39865 - 32bit Mono crashes with Assertion failed: (sizeof(uint64)==8) when saving tiff file
Summary: 32bit Mono crashes with Assertion failed: (sizeof(uint64)==8) when saving tif...
Status: VERIFIED FIXED
Alias: None
Product: Runtime
Classification: Mono
Component: packaging ()
Version: unspecified
Hardware: PC Mac OS
: High major
Target Milestone: (C7)
Assignee: Alexis Christoforides
URL:
Depends on:
Blocks:
 
Reported: 2016-03-23 13:20 UTC by Alexander Köplinger [MSFT]
Modified: 2016-04-18 14:18 UTC (History)
5 users (show)

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


Attachments
repro project (3.50 KB, application/x-msdownload)
2016-04-12 19:46 UTC, Peter Collins
Details


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:
VERIFIED FIXED

Description Alexander Köplinger [MSFT] 2016-03-23 13:20:25 UTC
This seems to be an issue with how libtiff is built in the universal libgdiplus binary. I'm using the latest C7 Mono build (https://wrench.internalx.com/Wrench/ViewLane.aspx?lane_id=2919&host_id=148&revision_id=734283) on OSX 10.11.4

Take the following code:

> using System;
> using System.Drawing;
> using System.Drawing.Imaging;
> 
> namespace ConsoleApplication
> {
>     public class Program
>     {
>         public static void Main(string[] args)
>         {
>             Console.WriteLine ("Hello World!");
> 
>             using (Bitmap bmp = new Bitmap (10, 10)) {
>                 Image tn = bmp.GetThumbnailImage (5, 5, null, IntPtr.Zero);
>                 tn.Save ("foo.tiff", ImageFormat.Tiff);
>             }
>         }
>     }
> }

Compile it:

> mcs Program.cs -r:System.Drawing.dll

Running it with 64bit Mono works fine and produces a foo.tiff file:

> mono64 Program.exe

Running it with 32bit Mono crashes:

> mono Program.exe

> Hello World!
> Assertion failed: (sizeof(uint64)==8), function TIFFClientOpen, file tif_open.c, line 99.
> Stacktrace:> 

>   at <unknown> <0xffffffff>
>   at (wrapper managed-to-native) System.Drawing.GDIPlus.GdipSaveImageToFile (intptr,string,System.Guid&,intptr) <0x00012>
>   at System.Drawing.Image.Save (string,System.Drawing.Imaging.ImageCodecInfo,System.Drawing.Imaging.EncoderParameters) <0x0006f>
>   at System.Drawing.Image.Save (string,System.Drawing.Imaging.ImageFormat) <0x0005b>
>   at (wrapper remoting-invoke-with-check) System.Drawing.Image.Save (string,System.Drawing.Imaging.ImageFormat) <0x00073>
>   at ConsoleApplication.Program.Main (string[]) <0x000a3>
>   at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <0x000a0>> 

> Native stacktrace:> 

> 	0   mono                                0x001895c6 mono_handle_native_sigsegv + 342
> 	1   mono                                0x001dc3f1 sigabrt_signal_handler + 145
> 	2   libsystem_platform.dylib            0x9b4fe79b _sigtramp + 43
> 	3   ???                                 0xffffffff 0x0 + 4294967295
> 	4   libsystem_c.dylib                   0x91c80c34 abort + 156
> 	5   libsystem_c.dylib                   0x91c49009 basename + 0
> 	6   libtiff.5.dylib                     0x02a2ffd9 TIFFClientOpen + 185
> 	7   libtiff.5.dylib                     0x02a45237 TIFFFdOpen + 167
> 	8   libtiff.5.dylib                     0x02a45672 TIFFOpen + 338
> 	9   libgdiplus.dylib                    0x02364b54 gdip_save_tiff_image_to_file + 52
> 	10  libgdiplus.dylib                    0x02332be1 GdipSaveImageToFile + 321
> 	11  ???                                 0x006fafd0 0x0 + 7319504
> 	12  ???                                 0x006faef0 0x0 + 7319280
> 	13  ???                                 0x006f9e6c 0x0 + 7315052
> 	14  ???                                 0x006f9ddc 0x0 + 7314908
> 	15  ???                                 0x006f4f7c 0x0 + 7294844
> 	16  ???                                 0x006f5089 0x0 + 7295113
> 	17  mono                                0x000cf737 mono_jit_runtime_invoke + 951
> 	18  mono                                0x002a7cb6 mono_runtime_invoke + 150
> 	19  mono                                0x002adc71 mono_runtime_exec_main + 401
> 	20  mono                                0x002ada28 mono_runtime_run_main + 632
> 	21  mono                                0x0014dac5 mono_jit_exec + 213
> 	22  mono                                0x0014ff5c mono_main + 8364
> 	23  mono                                0x000c09ea main + 74
> 	24  mono                                0x000c0995 start + 53> 

> Debug info from gdb:> 

> "monobt" command installed
> (lldb) command source -s 0 '/tmp/mono-gdb-commands.ZuFc9M'
> Executing commands in '/tmp/mono-gdb-commands.ZuFc9M'.
> (lldb) process attach --pid 18559
> warning: (i386) /Library/Frameworks/Mono.framework/Versions/4.4.0/lib/mono/4.5/mscorlib.dll.dylib empty dSYM file detected, dSYM was created with an executable with no debug info.
> Process 18559 stopped
> * thread #1: tid = 0x7b28c, 0x9e494cee libsystem_kernel.dylib`__wait4 + 10, name = 'tid_50b', queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
>     frame #0: 0x9e494cee libsystem_kernel.dylib`__wait4 + 10
> libsystem_kernel.dylib`__wait4:
> ->  0x9e494cee <+10>: jae    0x9e494cfe                ; <+26>
>     0x9e494cf0 <+12>: calll  0x9e494cf5                ; <+17>
>     0x9e494cf5 <+17>: popl   %edx
>     0x9e494cf6 <+18>: movl   0x5dbe32f(%edx), %edx> 

> Executable module set to "/usr/local/bin/mono".
> Architecture set to: i386-apple-macosx.
> (lldb) thread list
> Process 18559 stopped
> * thread #1: tid = 0x7b28c, 0x9e494cee libsystem_kernel.dylib`__wait4 + 10, name = 'tid_50b', queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
>   thread #2: tid = 0x7b28f, 0x9e4943ea libsystem_kernel.dylib`__psynch_cvwait + 10
>   thread #3: tid = 0x7b290, 0x9e48d4d6 libsystem_kernel.dylib`semaphore_wait_trap + 10, name = 'tid_1303'
>   thread #4: tid = 0x7b291, 0x9e494d5e libsystem_kernel.dylib`__workq_kernreturn + 10
>   thread #5: tid = 0x7b292, 0x9e4957fa libsystem_kernel.dylib`kevent_qos + 10, queue = 'com.apple.libdispatch-manager'
>   thread #6: tid = 0x7b293, 0x9e494d5e libsystem_kernel.dylib`__workq_kernreturn + 10
>   thread #7: tid = 0x7b294, 0x9e494d5e libsystem_kernel.dylib`__workq_kernreturn + 10
> (lldb) thread backtrace all
> * thread #1: tid = 0x7b28c, 0x9e494cee libsystem_kernel.dylib`__wait4 + 10, name = 'tid_50b', queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
>   * frame #0: 0x9e494cee libsystem_kernel.dylib`__wait4 + 10
>     frame #1: 0x91ca07dc libsystem_c.dylib`waitpid$UNIX2003 + 48
>     frame #2: 0x0018968d mono`mono_handle_native_sigsegv(signal=6, ctx=0xbff4241c, info=0xbff423dc) + 541 at mini-exceptions.c:2348 [opt]
>     frame #3: 0x001dc3f1 mono`sigabrt_signal_handler(_dummy=<unavailable>, _info=<unavailable>, context=<unavailable>) + 145 at mini-posix.c:218 [opt]> 

>   thread #2: tid = 0x7b28f, 0x9e4943ea libsystem_kernel.dylib`__psynch_cvwait + 10
>     frame #0: 0x9e4943ea libsystem_kernel.dylib`__psynch_cvwait + 10
>     frame #1: 0x96abc538 libsystem_pthread.dylib`_pthread_cond_wait + 757
>     frame #2: 0x96abe276 libsystem_pthread.dylib`pthread_cond_wait$UNIX2003 + 71
>     frame #3: 0x003093db mono`thread_func [inlined] mono_os_cond_wait(mutex=0xb00810b0) + 18 at mono-os-mutex.h:105 [opt]
>     frame #4: 0x003093c9 mono`thread_func(thread_data=0x00000000) + 457 at sgen-thread-pool.c:118 [opt]
>     frame #5: 0x96abb780 libsystem_pthread.dylib`_pthread_body + 138
>     frame #6: 0x96abb6f6 libsystem_pthread.dylib`_pthread_start + 155
>     frame #7: 0x96ab8f7a libsystem_pthread.dylib`thread_start + 34> 

>   thread #3: tid = 0x7b290, 0x9e48d4d6 libsystem_kernel.dylib`semaphore_wait_trap + 10, name = 'tid_1303'
>     frame #0: 0x9e48d4d6 libsystem_kernel.dylib`semaphore_wait_trap + 10
>     frame #1: 0x002a559e mono`finalizer_thread [inlined] mono_os_sem_wait(flags=MONO_SEM_FLAGS_ALERTABLE) + 14 at mono-os-semaphore.h:72 [opt]
>     frame #2: 0x002a5590 mono`finalizer_thread [inlined] mono_coop_sem_wait(flags=MONO_SEM_FLAGS_ALERTABLE) + 10 at mono-coop-semaphore.h:40 [opt]
>     frame #3: 0x002a5586 mono`finalizer_thread(unused=0x00000000) + 118 at gc.c:711 [opt]
>     frame #4: 0x0027ea19 mono`start_wrapper [inlined] start_wrapper_internal + 540 at threads.c:717 [opt]
>     frame #5: 0x0027e7fd mono`start_wrapper(data=<unavailable>) + 29 at threads.c:764 [opt]
>     frame #6: 0x00338aad mono`inner_start_thread(arg=<unavailable>) + 349 at mono-threads-posix.c:92 [opt]
>     frame #7: 0x96abb780 libsystem_pthread.dylib`_pthread_body + 138
>     frame #8: 0x96abb6f6 libsystem_pthread.dylib`_pthread_start + 155
>     frame #9: 0x96ab8f7a libsystem_pthread.dylib`thread_start + 34> 

>   thread #4: tid = 0x7b291, 0x9e494d5e libsystem_kernel.dylib`__workq_kernreturn + 10
>     frame #0: 0x9e494d5e libsystem_kernel.dylib`__workq_kernreturn + 10
>     frame #1: 0x96abb34b libsystem_pthread.dylib`_pthread_wqthread + 1289
>     frame #2: 0x96ab8f56 libsystem_pthread.dylib`start_wqthread + 34> 

>   thread #5: tid = 0x7b292, 0x9e4957fa libsystem_kernel.dylib`kevent_qos + 10, queue = 'com.apple.libdispatch-manager'
>     frame #0: 0x9e4957fa libsystem_kernel.dylib`kevent_qos + 10
>     frame #1: 0x93fb17ea libdispatch.dylib`_dispatch_mgr_invoke + 234
>     frame #2: 0x93fb13be libdispatch.dylib`_dispatch_mgr_thread + 52> 

>   thread #6: tid = 0x7b293, 0x9e494d5e libsystem_kernel.dylib`__workq_kernreturn + 10
>     frame #0: 0x9e494d5e libsystem_kernel.dylib`__workq_kernreturn + 10
>     frame #1: 0x96abb34b libsystem_pthread.dylib`_pthread_wqthread + 1289
>     frame #2: 0x96ab8f56 libsystem_pthread.dylib`start_wqthread + 34> 

>   thread #7: tid = 0x7b294, 0x9e494d5e libsystem_kernel.dylib`__workq_kernreturn + 10
>     frame #0: 0x9e494d5e libsystem_kernel.dylib`__workq_kernreturn + 10
>     frame #1: 0x96abb34b libsystem_pthread.dylib`_pthread_wqthread + 1289
>     frame #2: 0x96ab8f56 libsystem_pthread.dylib`start_wqthread + 34
> (lldb) detach> 

> =================================================================
> 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.
> =================================================================
Comment 1 Peter Collins 2016-04-12 19:46:07 UTC
Created attachment 15683 [details]
repro project
Comment 2 Peter Collins 2016-04-12 19:49:13 UTC
I'm able to reproduce this, and behaviorally it's a regression from the currently stable mono 4.2.3 (explicit/832de4b). Attempting to run the attached executable with `mono Program.exe` will now crash with 4.4.x installed on disk, but not with 4.2.3.

I reproduced this crash with OSX 10.11.1 w/ mono-4.4.0-branch/10dcc6
Comment 4 Abhishek 2016-04-18 14:18:40 UTC
I have tried this issue and able to reproduce this issue with the following build:
MonoFramework-MDK-4.4.0.3.macos10.xamarin.universal_135ea40d49796944c2114d24e47ff076bda45a81

Screencast: http://www.screencast.com/t/HUFzV5fnHd
Terminal Output: https://gist.github.com/Abhishekk360/0991b7d1f167d2db580363b65f2752e1

To verify this issue I have checked this issue with the latest C7 mono build:
MonoFramework-MDK-4.4.0.134.macos10.xamarin.universal_229349ba7bc2b0472be553eae2903f0c3dc796ed

Now this issue is working fine. Here is the screencast for the same: http://www.screencast.com/t/nH0c7kjIVvF

Terminal Output: https://gist.github.com/Abhishekk360/6ebfb49004c7877604516dbd90e174a6

Hence closing this issue.

Thanks!