Skip to content

Is it assumed that CompositeException is eligible to modify the cause of exceptions passed in constructor of CompositeException? #6747

Closed
@zubchenok

Description

@zubchenok

Since RxJava modifies exceptions during call of getCause method of CompositeException instance and connect these exceptions in chains we have finally millions of exceptions and quickly getting out of memory.

    @Test
    public void compositeExceptionIssue() {
        Single
            .just(new Throwable("ROOT ERROR"))
            .flatMapCompletable(rootError -> Observable
                .range(1, 10)
                .flatMapCompletable(testNumber -> Completable
                    .mergeArrayDelayError(
                        Completable.error(new RuntimeException("Test#" + testNumber + "A", rootError)),
                        Completable.error(new RuntimeException("Test#" + testNumber + "B", rootError))
                    )
                    .doOnError(Throwable::getCause)
                    .onErrorComplete()
                )
                .doOnComplete(() -> {
                    rootError.printStackTrace();
                })
            )
            .blockingAwait();
    }

This simple test demonstrates that cause of rootError throwable is changed.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions