Coder Social home page Coder Social logo

Comments (5)

epickrram avatar epickrram commented on September 15, 2024

Hi @benwimpory
if you can supply a test case that demonstrates the problem, then please do. The library should work in the situation you describe (or at least fail with a reasonable message).

from chronicle-wire.

benwimpory avatar benwimpory commented on September 15, 2024

@epickrram Unit test that demonstrates the issue...

package wireobject;

import net.openhft.chronicle.queue.ChronicleQueue;
import net.openhft.chronicle.queue.ExcerptAppender;
import net.openhft.chronicle.queue.impl.single.SingleChronicleQueueBuilder;
import net.openhft.chronicle.wire.DocumentContext;
import org.junit.Test;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

public class WireObjectTest
{
    @Test(expected = StackOverflowError.class)
    public void shouldAppendBToQueue()
    {
        final B b = new B(new ArrayList<>(10), 2);

        final ChronicleQueue queue = SingleChronicleQueueBuilder.binary("/tmp/testqueue").build();
        final ExcerptAppender appender = queue.acquireAppender();

        try (DocumentContext ctx = appender.writingDocument())
        {
            ctx.wire().getValueOut().object(b);
        }
    }
}

class A implements Serializable
{
    private List<B> listOfB;

    public A(List<B> listOfB)
    {
        this.listOfB = listOfB;
    }

    public List<B> getListOfB()
    {
        return listOfB;
    }
}

class B extends A
{
    private int x;

    public B(List<B> listOfB, int x)
    {
        super(listOfB);
        this.x = x;
    }

    public int getX()
    {
        return x;
    }
}

from chronicle-wire.

epickrram avatar epickrram commented on September 15, 2024

Thanks for the test case, this issue will be prioritised and fixed in due course.

from chronicle-wire.

RobAustin avatar RobAustin commented on September 15, 2024

This use case is not currently supported and is not simple to fix, as chronicle-wire first builds its data structures then propagates them with data, see

see net.openhft.chronicle.wire.Wires#writeMarshallable(java.lang.Object, net.openhft.chronicle.wire.WireOut)

    public static void writeMarshallable(@NotNull Object marshallable, @NotNull WireOut wire) {
        WireMarshaller wm = WireMarshaller.WIRE_MARSHALLER_CL.get(marshallable.getClass());
        wm.writeMarshallable(marshallable, wire);
    }

( As I know you are aware ) The problem with your test case, is although your data is not recursive, your data structure ( used by chronicle-wire for mapping your data off heap ) is, and chronicle-wire gets a stack overflow building your data structure.

Thanks for reporting this issue if you required this issue to be fixed promptly please consider purchasing a support contract by contacting [email protected].

Chronicle-Wire does not currently support this use case and as such - We going to mark this as wont fix. If however you would like it fixed, please purchase a support contract.

I thank you again for reporting this issue and sorry that we are not able to fix it on this occasion.

from chronicle-wire.

peter-lawrey avatar peter-lawrey commented on September 15, 2024

from chronicle-wire.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.