user exception causes unmarshalling exception

Stuart BrodskyStuart Brodsky Member Stuart BrodskyOrganization: SGIProject: a framwork to support clustere management
I have an interesting case of cause where I can't get a user defined exception back to a client. i wind up getting an UnmarshalOutofBounds exception being returned.

I have a client calling a server who then becomes a client to another server. This middle server/client is sending a synchronous command to the other server. Under normal conditions things work just fine but if a user defined exception is thrown at the end server, the server/client middle code sees an UnmarshalOutOfBounds exception and not the user exception. This middle server/client would like report the user exception back to the original client.

I have a test case where the original client calls directly to the ending server bypassing the middle server/client and when an exception occurs, it does see the user thrown exception. The unmarshal error only occurs if I go through the middle server/client scenario.

Everyone is using the same slice file definitions. Any ideas?

Comments

  • mesmes CaliforniaAdministrators, ZeroC Staff Mark SpruiellOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    Hi Stuart,

    Have you reviewed our FAQ on this exception?

    If you're still having trouble, please describe your environment (including operating system, compiler, and Ice versions).

    Regards,
    Mark
  • Stuart BrodskyStuart Brodsky Member Stuart BrodskyOrganization: SGIProject: a framwork to support clustere management
    I am running SLED 10.2, gcc 4.2.1 with Ice 3.3.0. This is a 32 bit machine but it also fails on our x86 64 bit SLES 10.2 machines.

    Here is the slice definition for the exception:

    exception HalException
    {
    string reason;
    };
    exception NoPermissionException extends HalException
    {
    };

    The test client, the middle server/client and the end server all use this definition. I can't see the mis-match definitions between any client and server here.
  • Stuart BrodskyStuart Brodsky Member Stuart BrodskyOrganization: SGIProject: a framwork to support clustere management
    I ran my server with Trace.Slicing and it does show that the exception is an unknown exception. The server/client is built with .h file defining the the exception but for some reason when it receives the exception, doesn't know what it is.
  • Stuart BrodskyStuart Brodsky Member Stuart BrodskyOrganization: SGIProject: a framwork to support clustere management
    One other item to add is that I am not using the application class for my server/client code. My test code is uses the application class and that receives the user thrown exception correctly. What does the application class do that sets things up to know what a user thrown exception is?
  • matthewmatthew NL, CanadaMember Matthew NewhookOrganization: ZeroC, Inc.Project: Internet Communications Engine ✭✭✭
    The best thing to do is to post a complete self-compilable example that demonstrates your issue.
  • Stuart BrodskyStuart Brodsky Member Stuart BrodskyOrganization: SGIProject: a framwork to support clustere management
    What I have found is that my client/server code uses a .so library that is built using the same slice definition file. When built with the linked library, I get the marshalling error. However, when I take the modules and build them directly into my client/server code, it works just fine.
  • matthewmatthew NL, CanadaMember Matthew NewhookOrganization: ZeroC, Inc.Project: Internet Communications Engine ✭✭✭
    I'm not sure what you are doing wrong, but it is certainly possible to build the slice generated code into a shared library. After all, this is what the Ice runtime does (it builds the generated code for Router.ice, and other slice definitions into the runtime).
  • bernardbernard Jupiter, FLAdministrators, ZeroC Staff Bernard NormierOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    The problem could also come from a GCC visibility flag, see http://www.zeroc.com/forums/bug-reports/4216-tcp-connection-timeouts-throw-exceptions-reconnecting-fails.html#post18600

    If you're building with -fvisibility=hidden, remove this flag!

    Best regards,
    Bernard
  • Stuart BrodskyStuart Brodsky Member Stuart BrodskyOrganization: SGIProject: a framwork to support clustere management
    The problem lies in the fact that I do a slice2cpp in both the library and my code that links to the library. Somehow the exceptions get confused at that point. By only doing a slice2cpp once in the library and grabbing the .h files generated there, the code works.
Sign In or Register to comment.