Archived

This forum has been archived. Please start a new discussion on GitHub.

UnmarshallOutOfBoundsException - why?

hi

i get UnmarshallOutOfBoundsException in the case multiple threads
access the same proxy object.

is this observation right?

is there a clone methode?

thx for your help

tom

Comments

  • A proxy can be used by multiple threads. There is no need to clone the proxy. Typically you get UnmarshalOutOfBoundsException if the Slice code used by the client and the server do not match.
  • hi marc,

    do i need to take care about syncronization of the proxy?
    you see the exception occurrs randomly by chance.

    it looks like the exception is thrown because multiple threads write to the
    same incoming stream - producing invalid content

    thx
  • No, you do not need to take care of proxy synchronization. It is not possible that calls write into the same stream if they use the same proxy, as each call uses its own stream.

    Is this a regular call or an AMI call? If it is an AMI call, please make sure that you do not share the AMI callback object between threads. An AMI callback object cannot be used for multiple simultaneous calls, regardless of whether these are done in the same or different threads. However, the proxy can be shared, also for AMI calls.

    How do you determine that two calls write into the same stream?
  • im using regular calls.

    it was a suspicion with the stream.

    im building a smal sample project to demo the behaviour.

    im back in a few minutes
  • i cannot reproduce the problem in a seperate project. :-(

    you said:
    Typically you get UnmarshalOutOfBoundsException if the Slice code used by the client and the server do not match.

    how can this happen?

    client and server code is generated from the same file.
    both are recompiled at the same time.
    in occurs randomly


    as far i could debug into the problem: it happens on unmarshaling of sequences ( strings or structs )

    thx
  • Originally posted by DeepDiver
    i cannot reproduce the problem in a seperate project. :-(

    you said:


    how can this happen?

    client and server code is generated from the same file.
    both are recompiled at the same time.
    in occurs randomly


    as far i could debug into the problem: it happens on unmarshaling of sequences ( strings or structs )

    thx

    It could only happen if your client and server do not use code generated from the same Slice files. If this is not the case, then I'm afraid I don't know what the problem is. I would need to see an example that demonstrates the problem.
  • Demo Project !!!!

    hi,

    finally i was successfull to reproduce the problem in a seperate project!
    look like a problem in unmarshalling sequences of structs.

    start the server in console.
    start client in debugger and set break points in
    _CallbackDisp::___Notify01 and
    _CallbackDisp::___Notify02

    exception will be thrown in a call to startSeq

    have fun

    tom
  • Thansk you, we will investigate.
  • I tried reproducing this, but couldn't.

    In order to get your code to run, I had to comment out the call to _server.AddCallback(cb) in the server because _server was null, so this line caused the server to crash. After fixing this, the client ran OK.

    Are you sure that you have compiled client and server from consistent Slice definitions? (The most likely cause of an UnmarshalOutOfBoundsException is a mismatch in the Slice definitions used by client and server.)

    Michi.
  • hi,

    you are right:
    _server is null and the call AddServer will cause a crash.

    the problem:
    when i run it -> an exception is thrown in the line above:
    cb.Notify01( dates, n0, n1 );

    slice defintion:
    as you can see in the projects there is one .ice file. the projects run generate.exe
    you know i'm a lazy developer - i just copied one of your demo projects and
    modified it! :D

    compiler and .net version:
    Microsoft (R) Visual C# .NET Compiler version 7.10.6001.4
    for Microsoft (R) .NET Framework version 1.1.4322

    printout on client:
    client.exe: warning: dispatch exception:
    identity: 8a174c65-0f81-438a-8ecf-42549fc7e8b8
    facet:
    operation: Notify01
    Ice.UnmarshalOutOfBoundsException: UnmarshalOutOfBoundsException
    at IceInternal.BasicStream.checkSeq(Int32 bytesLeft)
    at IceInternal.BasicStream.startSeq(Int32 numElements, Int32 minSize)
    at _CallbackDisp.___Notify01(Callback __obj, Incoming __in, Current __current) in c:\ice-1.5.1\democs\ice\multidemo\generated\demo.cs:line 1172
    at _CallbackDisp.__dispatch(Incoming __in, Current __current) in c:\ice-1.5.1\democs\ice\multidemo\generated\demo.cs:line 1285
    at IceInternal.Incoming.invoke(ServantManager servantManager)


    any traces you'd like to have? Some version numbers?


    let me know!


    thx alot


    tom
  • i cleaned the project.

    executables included this time as well
    maybe you can get some inof from that.


    thx

    tom
  • I just tried reproducing this with the latest build of Ice for C#. It works fine with that build. Seeing that we will be releasing Ice 2.0 within the next day, could you wait and try again with the new release? Most likely, you will find that the problem will have disappeared with that.

    Thanks,

    Michi.
  • hi michi,

    not a problem!
    i'll wait for 2.0!

    thanks a lot up to now!


    CU Tom
  • 2.0 fixed the problem!

    thanks alot for your help.

    with 2.0 the problem disapeared.

    the reason was a missing call of __is.endSeq(szx);
    in the generated code with the compiler of 1.5.1


    thx alot


    tom
  • Yes, I made quite a few changes to the sequence code generation since 1.5.1. Glad to hear that your problem is fixed!

    Cheers,

    Michi.