Archived

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

BufferOverflowException when using callbacks

I added the ["amd"] tag on some of my methods so I can use the auto-generated callback objects. This seems to work for a while, then I start getting java.nio.BufferOverflowException when I call ice_response() on the callback object. Any ideas? Am I pounding the server too hard and have too many active callbacks? At this point I'm lost. Thanks.

Comments

  • bernard
    bernard Jupiter, FL
    Hi Isaac,

    Could you post the full stack trace, and platform/version information?

    Thanks,
    Bernard
  • bernard wrote: »
    Hi Isaac,

    Could you post the full stack trace, and platform/version information?

    Thanks,
    Bernard

    I'm using Ice 3.4.2 for Java on Linux. Here's the stack trace:
    java.nio.BufferOverflowException
            at java.nio.Buffer.nextPutIndex(Buffer.java:495)
            at java.nio.DirectByteBuffer.put(DirectByteBuffer.java:250)
            at IceInternal.BasicStream.writeBool(Unknown Source)
            at testproject.parser.types.ParserData.__write(ParserData.java:142)
            at testproject.parser.interfaces._AMD_ParserProcessor_unpackData.ice_response(_AMD_ParserProcessor_unpackData.java:39)
            at com.testproject.DataListener.notifySender(DataListener.java:83)
            at com.testproject.DataListener.onMessage(DataListener.java:47)
            at com.tibco.tibjms.TibjmsxSessionImp._submit(TibjmsxSessionImp.java:3821)
            at com.tibco.tibjms.TibjmsxSessionImp._dispatchAsyncMessage(TibjmsxSessionImp.java:2088)
            at com.tibco.tibjms.TibjmsxSessionImp$Dispatcher.run(TibjmsxSessionImp.java:3347)
    
  • bernard
    bernard Jupiter, FL
    Hi Isaac,

    This does not look like a memory exhaustion issue.

    Is there any possibility that your code is calling ice_response on the same callback object from two different threads? (Such a race condition is a possible explanation).

    AMD callbacks are not thread safe, and you should not use an AMD callback after calling ice_response on it.

    Best regards,
    Bernard
  • bernard wrote: »
    Is there any possibility that your code is calling ice_response on the same callback object from two different threads? (Such a race condition is a possible explanation).

    I've been through the code several times and can't see any threading issues. But, I will look again and get some of my colleagues involved to see if they can spot a threading issue. Thanks.