Bug 325262 (MONO82595) - getting proxy for ContextBoundObject with virtual generic functions fails
Summary: getting proxy for ContextBoundObject with virtual generic functions fails
Status: RESOLVED MOVED
Alias: MONO82595
Product: Mono: Runtime
Classification: Mono
Component: remoting (show other bugs)
Version: 1.2
Hardware: Other Other
: P3 - Medium : Major
Target Milestone: ---
Assignee: Lluis Sanchez
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-08-25 22:02 UTC by Jan Oravec
Modified: 2007-09-15 21:24 UTC (History)
1 user (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 20:50:28 UTC


---- Reported by jan.oravec@6com.sk 2007-08-25 15:02:15 MST ----

When object derived from ContextBoundObject contains virtual generic
function (or derive from interface with such function) is created, runtime
throws exception in native code.

1. Compile this code:

class C : System.ContextBoundObject
{
  public virtual T Q<T> (T t)
  {
    return t;
  }
  
  public static void Main ()
  {
    new C ();
  }
}

2. Run compiled program

Actual Results:



** (./foo.exe:18282): WARNING **: type 0x1e not handled

** ERROR **: file marshal.c: line 3347 (mono_mb_emit_restore_result):
should not be reached
aborting...
Stacktrace:

  at (wrapper managed-to-native)
System.Runtime.Remoting.Proxies.RealProxy.InternalGetTransparentProxy
(string) <0x0000b>
  at (wrapper managed-to-native)
System.Runtime.Remoting.Proxies.RealProxy.InternalGetTransparentProxy
(string) <0xffffffff>
  at System.Runtime.Remoting.Proxies.RealProxy.GetTransparentProxy () <0x00160>
  at
System.Runtime.Remoting.RemotingServices.CreateClientProxyForContextBound
(System.Type,object[]) <0x000d1>
  at
System.Runtime.Remoting.Activation.ActivationServices.CreateProxyForType
(System.Type) <0x0008b>
  at (wrapper runtime-invoke)
System.Runtime.Remoting.Activation.ActivationServices.runtime_invoke_object_Type
(object,intptr,intptr,intptr) <0xffffffff>
  at (wrapper managed-to-native)
System.Object.__icall_wrapper_mono_object_new_specific (intptr) <0x0000b>
  at (wrapper managed-to-native)
System.Object.__icall_wrapper_mono_object_new_specific (intptr) <0xffffffff>
  at C.Main () <0x00011>
  at (wrapper runtime-invoke) C.runtime_invoke_void
(object,intptr,intptr,intptr) <0xffffffff>

Native stacktrace:

        /usr/bin/mono [0x51a891]
        /lib/libpthread.so.0 [0x2b9b52a5cfb0]
        /lib/libc.so.6(gsignal+0x35) [0x2b9b52cee885]
        /lib/libc.so.6(abort+0x10e) [0x2b9b52cefb3e]
        /usr/lib/libglib-2.0.so.0(g_logv+0x46e) [0x2b9b527d95fe]
        /usr/lib/libglib-2.0.so.0(g_log+0x83) [0x2b9b527d9693]
        /usr/lib/libglib-2.0.so.0(g_assert_warning+0x76) [0x2b9b527d9716]
        /usr/bin/mono [0x468340]
        /usr/bin/mono [0x474ce9]
        /usr/bin/mono [0x4e93aa]
        /usr/bin/mono [0x49b1aa]
        /usr/bin/mono [0x49b637]
        /usr/bin/mono [0x4a2272]
        [0x4024eb90]

Debug info from gdb:

(no debugging symbols found)
Using host libthread_db library "/lib/libthread_db.so.1".
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
[Thread debugging using libthread_db enabled]
[New Thread 47946111363872 (LWP 18282)]
[New Thread 1075988800 (LWP 18284)]
[New Thread 1073822016 (LWP 18283)]
0x00002b9b52d77672 in select () from /lib/libc.so.6
  3 Thread 1073822016 (LWP 18283)  0x00002b9b52a5c641 in ?? ()
   from /lib/libpthread.so.0
  2 Thread 1075988800 (LWP 18284)  0x00002b9b52a59726 in
pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
  1 Thread 47946111363872 (LWP 18282)  0x00002b9b52d77672 in select ()
   from /lib/libc.so.6

Thread 3 (Thread 1073822016 (LWP 18283)):
#0  0x00002b9b52a5c641 in ?? () from /lib/libpthread.so.0
#1  0x00000000004c3690 in ?? ()
#2  0x00002b9b52a55135 in start_thread () from /lib/libpthread.so.0
#3  0x00002b9b52d7d62d in clone () from /lib/libc.so.6
#4  0x0000000000000000 in ?? ()

Thread 2 (Thread 1075988800 (LWP 18284)):
#0  0x00002b9b52a59726 in pthread_cond_wait@@GLIBC_2.3.2 ()
   from /lib/libpthread.so.0
#1  0x00000000004cd055 in ?? ()
#2  0x00000000004cf460 in ?? ()
#3  0x00000000004cfcde in ?? ()
#4  0x000000000051fb41 in ?? ()
#5  0x0000000000479193 in ?? ()
#6  0x00000000004c8297 in ?? ()
#7  0x00000000004defe2 in ?? ()
#8  0x00002b9b52a55135 in start_thread () from /lib/libpthread.so.0
#9  0x00002b9b52d7d62d in clone () from /lib/libc.so.6
#10 0x0000000000000000 in ?? ()

Thread 1 (Thread 47946111363872 (LWP 18282)):
#0  0x00002b9b52d77672 in select () from /lib/libc.so.6
#1  0x00002b9b52802108 in g_spawn_sync () from /usr/lib/libglib-2.0.so.0
#2  0x00002b9b528024f8 in g_spawn_command_line_sync ()
   from /usr/lib/libglib-2.0.so.0
#3  0x000000000051a927 in ?? ()
#4  <signal handler called>
#5  0x00002b9b52cee885 in raise () from /lib/libc.so.6
#6  0x00002b9b52cefb3e in abort () from /lib/libc.so.6
#7  0x00002b9b527d95fe in g_logv () from /usr/lib/libglib-2.0.so.0
#8  0x00002b9b527d9693 in g_log () from /usr/lib/libglib-2.0.so.0
#9  0x00002b9b527d9716 in g_assert_warning () from /usr/lib/libglib-2.0.so.0
#10 0x0000000000468340 in ?? ()
#11 0x0000000000474ce9 in ?? ()
#12 0x00000000004e93aa in ?? ()
#13 0x000000000049b1aa in ?? ()
#14 0x000000000049b637 in ?? ()
#15 0x00000000004a2272 in ?? ()
#16 0x000000004024eb90 in ?? ()
#17 0x00007fff58631f80 in ?? ()
#18 0x00002aaaab770be0 in ?? ()
#19 0x00007fff586320f8 in ?? ()
#20 0x0061003700370062 in ?? ()
#21 0x0036003500630035 in ?? ()
#22 0x000000004024eb3b in ?? ()
#23 0x00002aaaab77ed90 in ?? ()
#24 0x0000000000000000 in ?? ()
#0  0x00002b9b52d77672 in select () from /lib/libc.so.6


=================================================================
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


Expected Results:

no exception


How often does this happen? 

always



---- Additional Comments From robertj@gmx.net 2007-08-25 15:16:16 MST ----



*** This bug has been marked as a duplicate of https://bugzilla.novell.com/show_bug.cgi?id=MONO78882 ***



---- Additional Comments From robertj@gmx.net 2007-08-28 12:37:31 MST ----

BTW, when I run you sample on MS.NET, I got this:


Unbehandelte Ausnahme: System.TypeLoadException: Kontextgebundene
Objekte mit generischen Methoden werden nicht unterstützt.

Translation: Unhanded exception: System.TypeLoadException: context-
bound objects with generic methods are not supported.


So we need to catch this in Mono as well.




---- Additional Comments From jan.oravec@6com.sk 2007-08-28 17:46:44 MST ----

Interesting it's not supported on MS.NET. It appears to work fine on
Mono with your 2 patches.

I've got our application with generic remoting code working on Mono
SVN head + your 2 patches. We use it to get services from server,
pattern like (on the client):

IServiceManager sm = whatever_code_to_get_service_manager_from_server;
...
sm.Get<ISomeService> ().DoSomething ();
sm.Get<ITransactionService> ().Commit ();

There are some reasons that ServiceManager and all other services are
ContextBoundObjects (keeping track of current transaction, ...).

Do you plan to commit your patches to SVN, so that
generic+ContextBoundObject will work on Mono, or implement checks and
throw exception like MS.NET does? (I would obviously prefer first
choice, as I think that feature is very usable).

Thanks



---- Additional Comments From jan.oravec@6com.sk 2007-08-28 17:49:50 MST ----

Adding Robert to CC so he can see my response.




---- Additional Comments From robertj@gmx.net 2007-08-28 19:21:16 MST ----

I will not block CBOs, unless I overlooked something important.
But it's still a bad idea to use a feature that doesn't work
on MS.NET.

I can only guess why MS dropped the support of generic methods
in CBOs:

- they encountered some severe problems with
  COM+ (EnterpriseServices)

- IMessage & friends were not changed to expose generic arguments,
  so writing full interceptor sinks or proxies for CBOs is nearly
  impossible.



Unknown bug field "cf_op_sys_details" encountered while moving bug
   <cf_op_sys_details>mono-1.2.5 preview 5 on amd64</cf_op_sys_details>
Unknown operating system unknown. Setting to default OS "Other".
This bug was marked DUPLICATE in the database it was moved from.
    Changing resolution to "MOVED"