Skip to content

Memory Leak from JStreamVertxParallelStreamProcessor #912

@sharifahmad2061

Description

Image
 // tag::example[]
        var resultStream = parallelConsumer.vertxHttpReqInfoStream(context -> {
            var consumerRecord = context.getSingleConsumerRecord();
            log.info("Concurrently constructing and returning RequestInfo from record: {}", consumerRecord);
            Map<String, String> params = UniMaps.of("recordKey", consumerRecord.key(), "payload", consumerRecord.value());
            return new RequestInfo("localhost", port, "/api", params); // <1>
        });
        // end::example[]

        resultStream.forEach(x -> {
            log.info("From result stream: {}", x);
        });

existing example or code written in similar fashion will get into OOM situation if stream becomes empty at some point and is populated later on again.

in our case we didn't consume the result stream at all and it cause OOM errors.

what should be the correct way to consume resultStream. or I am wrong and resultStream.forEach should work fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions